User:Qwerty0/sandbox

WikiMarkup
- more tests Qwerty0 (talk) 20:23, 28 May 2010 (UTC)
 * test: ok is this the definition
 * testing: or is this
 * word: definition
 * 4th level: what bout this

DOM draft
The DOM is a representation of the tree of elements in a page. These elements are what HTML tags are marking in an HTML document. When a web browser reads the markup (HTML, XHTML, etc) in a webpage, it builds a DOM for the page, usually in memory, from its tag structure. As an example of how the DOM is distinct from the HTML it is based on, the elements of a DOM may not correspond one-to-one to the tags in a page. This is due to irregularities such as invalid HTML and omitted optional tags. In the former case, web browsers attempt to build a DOM out of ambiguous markup. In the latter case, a browser will still add elements to the DOM which were not represented by tags. The DOM that the browser constructs is what it then uses to render the page for display to the user.

Another factor distinguishing the DOM of a webpage from its markup is the effect of client-side scripting (usually JavaScript). The initial DOM constructed from the markup can serve as the target of scripts. The elements of the DOM are what JavaScript manipulates. After each manipulation, the DOM has been further altered from its initial representation of the markup. At each step, the page is re-rendered to the user.

Another language that targets the DOM is Cascading Style Sheets or CSS. CSS can change the display of a webpage by naming elements in its DOM and specifying how they are rendered.