What is DOM (Document Object Model)?

Turkish: DOM

The DOM turns an HTML or XML document into a tree of objects that browsers can read and change through JavaScript.

What is the DOM?

DOM (Document Object Model) is the tree of objects a browser creates from an HTML document. A heading, button, form field, or list item becomes a node that scripts can inspect, update, move, or remove.

How Does It Work?

The browser parses HTML, builds the DOM tree, combines it with CSS information, and uses the result during rendering. JavaScript accesses the tree through APIs such as querySelector, addEventListener, classList, and appendChild. Changing button text after a click or showing a validation message is DOM manipulation.

The DOM is live. When code changes content, classes, or layout-sensitive styles, the browser may need to recalculate style, run layout, and repaint the page. Frequent unplanned updates can make an interface feel slow.

  • Node: Any point in the DOM tree, including elements, text, and comments
  • Element: A node represented by an HTML tag
  • Event: A click, input, submit, or other user/system action
  • Shadow DOM: Encapsulated DOM used by Web Components

Business Use

Form validation, shopping carts, filters, modals, live notifications, and admin panels all become visible through DOM updates. Frameworks such as React and Vue reduce manual DOM work; approaches like the Virtual DOM calculate changes before applying them to the real DOM.