Talk:Document Object Model: Difference between revisions

Content deleted Content added
Line 111:
--[[User:Qwerty0|Qwerty0]] ([[User talk:Qwerty0|talk]]) 09:54, 8 December 2011 (UTC)
:That looks like a very good idea to me. Your explanation is good, but I thought of a few things that I would change as I read it. rather than mess with your original, I'll copy it below and mark my suggested changes in bold. Lastly, of course, references would make this much better. are there any books or authoritative webpages that give this level of explanation that you know of? [[WP:V]] says that "any material challenged or likely to be challenged must be attributed to a reliable, published source using an inline citation". I don't have any challenge, and I doubt that anyone else would, but good references are much better than none. Also, I find that comparing article text with a good reference often improves it by suggesting better words or phrases in crucial places.
 
 
<blockquote>The DOM is a representation of the tree of elements in a page. These elements are what '''the''' [[HTML tags]] '''represent''' in an HTML document. When a [[web browser]] reads the markup (HTML, XHTML, etc) in a [[webpage]] it builds '''an [[Object (computer science)|object]] [[Domain model|model]] of the document, 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 '''may be''' due to irregularities such as [[Tag soup|invalid HTML]] and omitted [[Tag omission|optional tags]]. In the former case, web browsers attempt to build a DOM out of ambiguous markup. In the latter case, a browser '''may''' 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.</blockquote>
<blockquote>'''The DOM of a webpage needs to be distinguished''' from its markup because 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 '''can be manipulated''' by JavaScript. 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.</blockquote>