Content deleted Content added
→Examples needed: new section - poss update |
Gnomingstuff (talk | contribs) rv 2009 nonsenes |
||
(43 intermediate revisions by 22 users not shown) | |||
Line 1:
{{WikiProject banner shell|class=C|
{{WikiProject Computing |importance=Mid}}
}}
== VTD-XML is not spam ==
VTD-XML is an emerging XML processing model that combines the best of both DOM and SAX. Putting it in the description gives people more choices to meet their development needs. <small>—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:Jzhang2007|Jzhang2007]] ([[User talk:Jzhang2007|talk]] • [[Special:Contributions/Jzhang2007|contribs]]) 07:52, 31 October
== Information Not Current ==
Line 70 ⟶ 73:
== Examples needed ==
This article could use a textual example of how a sample document (such as the one shown in graphical form) would be represented by the model. Some code or pseudocode showing how the model might be accessed would also be helpful to give a flavor of what the DOM actually is for someone who knows nothing about it. These examples would help improve accessibility of this article to a wider audience. -- [[User:Beland|Beland]] ([[User talk:Beland|talk]]) 20:20, 2 January 2008 (UTC)
Need some simple examples, like "here is a nutcracker, see how it cracks a nut", etc. [[User:Jidanni|Jidanni]] ([[User talk:Jidanni|talk]]) 20:43, 20 January 2009 (UTC)
:that would define original interpretation of what u searching and would help users to d copies. you cand do that in foirums but i order to read it u must do screen captures.
[[♥...tEiNkZ..xAh uuLyTiN pOh...♥]] <small><span class="autosigned">—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:Yamdahc|Yamdahc]] ([[User talk:Yamdahc|talk]] • [[Special:Contributions/Yamdahc|contribs]]) 05:42, 8 October 2009 (UTC)</span></small><!-- Template:Unsigned --> <!--Autosigned by SineBot-->▼
can someone guide next an wp editor proceed & upload printscreens?paul80
== Google Patent: Enhanced document browsing with automatically generated links to relevant information ==
Hi all, this is miles outside of my own subject knowledge area, but apparantly google have filed a patent to automatically place links on a webpage specific to each user, using the DOM.... thought it might be relevant (but may not be).
* Patent: http://appft1.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&p=1&u=%2Fnetahtml%2FPTO%2Fsearch-bool.html&r=1&f=G&l=50&co1=AND&d=PG01&s1=20100153422.PGNR.&OS=DN/20100153422RS=DN/20100153422
*Article: http://www.free-seo-news.com/newsletter432.htm#facts (I know, the link looks a bit sale-sy, but I think their content is normally pretty good
== EMCAScript Confusion ==
I may be wrong, but ECMA International created ECMAScript; W3C simply described an API for interacting with the DOM via ECMAScript along with ECMAScript "types" associated with the DOM.
[[Special:Contributions/108.28.51.60|108.28.51.60]] ([[User talk:108.28.51.60|talk]]) 06:15, 12 November 2010 (UTC)
:I agree, and the article begins, "The Document Object Model (DOM) is a cross-platform and language-independent convention ...". Where in the article are you seeing this confusion? --[[User:Nigelj|Nigelj]] ([[User talk:Nigelj|talk]]) 17:50, 12 November 2010 (UTC)
::Here: "The World Wide Web Consortium (W3C), founded in 1994 to promote open standards for the World Wide Web, brought Netscape Communications and Microsoft together with other companies to develop a standard for browser scripting languages, called "ECMAScript"." The way it's worded it sounds to me like the article is suggesting that W3C created ECMAScript the language. [[Special:Contributions/108.28.51.60|108.28.51.60]] ([[User talk:108.28.51.60|talk]]) 02:35, 18 November 2010 (UTC)
:::Ah, I see. Are you saying that that sentence should end, "...a standard for browser scripting languages, which is now called "ECMAScript""? Or should the surgery go deeper, to completely separate the development of the DOM from that of the language? What do others think? --[[User:Nigelj|Nigelj]] ([[User talk:Nigelj|talk]]) 08:58, 18 November 2010 (UTC)
::::I think it's even worse than that. This section implies the W3C was invested in the ECMAScript standard, which (according to Doug Crockford - yuiblog.com/crockford/ - Lecture 1), is entirely untrue. In fact, Crockford claims that the W3C did not standardization of JavaScript by Netscape at all, which led to Netscape's odd choice of ECMA for the JavaScript standardization body. The idea the the W3C (a standards body itself) would coordinate with other entities to have a third party standardize a web technology is absurd on its face. It would be like Toyota bringing together a group of companies to design a car for Honda. -[[User:plamoni|plamoni]] ([[User talk:plamoni|talk]]) 21:14, 21 August 2012 (UTC) <span style="font-size: smaller;" class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/167.80.246.204|167.80.246.204]] ([[User talk:167.80.246.204|talk]]) </span><!-- Template:Unsigned IP --> <!--Autosigned by SineBot-->
== Layout Engines ==
"Web browsers rely on layout engines to parse HTML into a DOM" - this sounds incorrect (or possibly incorrect, depending on browser). Most modern browsers rely on a specific HTML parser to parse HTML into a DOM; the "layout engine" then creates the render tree from the DOM (to style/position elements for on-screen painting), but it doesn't parse the HTML into the DOM (or may not, depending on the browser). <small><span class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:Spxdcz|Spxdcz]] ([[User talk:Spxdcz|talk]] • [[Special:Contributions/Spxdcz|contribs]]) 03:28, 24 February 2011 (UTC)</span></small><!-- Template:Unsigned --> <!--Autosigned by SineBot-->
== Dom means Stupid in norwegian. ==
▲
== Explaining what the DOM is without being vague ==
Hello, I thought I'd come here to ask permission to add a clarifying section before "History" explaining what "the DOM" usually refers to. I literally spent years not knowing what people were talking about when they kept referring to "the DOM," mainly because every time I came here I found plenty more talk about this "DOM" but no explanation of what it is.
So I'd like to add a straightforward explanation, but I'd also like feedback about what it should say. I now have a good conception of what the DOM is, but I'd rather be corrected here, now, than on the actual article, later. Please let me know if you think it needs to be more accurate or precise, but hopefully we can keep it simple and straightforward:
<blockquote>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 [[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 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.</blockquote>
<blockquote>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.</blockquote>
<blockquote>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.</blockquote>
--[[User:Qwerty0|Qwerty0]] ([[User talk:Qwerty0|talk]]) 09:31, 8 December 2011 (UTC)
Oh, forgot to mention: There's a good explanation of the intricacies of HTML, browser parsing, DOM's, tags, and elements in [http://www.youtube.com/watch?v=WxmcDoAxdoY this video] (the real DOM talk starts at [http://www.youtube.com/watch?v=WxmcDoAxdoY&t=8m39s 8:39]). It includes great things like [http://www.youtube.com/watch?v=WxmcDoAxdoY&t=25m13s this explanation] of the difference between HTML tags and DOM elements. I'm aiming to have something in this article equally clarifying.
--[[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>
<blockquote>'''The DOM is also accessed by''' [[Cascading Style Sheets]] or CSS. CSS can change the display of a webpage by '''addressing''' elements in its DOM and '''altering''' how they are rendered.</blockquote>
--[[User:Nigelj|Nigelj]] ([[User talk:Nigelj|talk]]) 12:39, 8 December 2011 (UTC)
::Awesome, thanks for the feedback! Yeah, sorry, I should've mentioned that I was intentionally leaving out the citations; just trying to get the wording right. I'm still working on that part. I don't have extremely official sources yet, but most of what I said is contained in [http://www.youtube.com/watch?v=WxmcDoAxdoY the talk] I mentioned above (by a member of Google Developer Relations), and [http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/#DOM this article] (on a Google-produced site about HTML5).
::As for the edits, they mostly sound good, though there are a few places where I'd ask for rewording:
::*"..elements are what '''the HTML tags represent'''.." I'd actually prefer the original phrasing of "..elements are what HTML tags are marking..". To me, at least, it's a little more straightforward. Plus, I think the former is a bit less accurate. I know you didn't mean this, but I think your version is too easy to mistake for "the tags are the elements" rather than "the tags mark where to make a DOM element and what information to add to it." Of course, according to the [http://www.youtube.com/watch?v=WxmcDoAxdoY&t=25m13s very explanation] I'm taking this from, I should get punched in the face for correcting someone on this minutiae.
::*"..in a [[webpage]] it builds '''an object model of the document, a''' DOM for the page, usually in memory from its tag structure." Could I rearrange this to keep it less unwieldy? Perhaps "..in a [[webpage]] it builds a DOM for the page in memory from its tag structure: an object model of the document." in fact, I didn't know about the idea of generic object models. I think this could be worth expanding in a later section.
::*"'''The DOM of a webpage needs to be distinguished''' from its markup because of [[client-side scripting]].." What I was trying to get at was that the effect of Javascript altering the DOM is another reason the DOM ends up usually being different from the plain HTML. But I don't think I phrased it well. How about "The DOM of a webpage is often distanced further from its markup by the effect of [[client-side scripting]].."?
::--[[User:Qwerty0|Qwerty0]] ([[User talk:Qwerty0|talk]]) 08:06, 11 December 2011 (UTC)
:::Woh. This is going to be hard. Especially if there's just the two of us. I've just had a read through the talk sections above, and a look at the article. There's a lot to be done here, and I can't find any decent references for the level of detail that's needed. I found this, http://www.w3.org/TR/DOM-Level-2-Core/introduction.html, and some other less useful stuff.
:::I think there are many levels to get in order.
:::*The DOM defines an [[Interface (computing)]], through which [[Client-side scripting]] can access and manipulate HTML and XML documents
:::*In an HTML DOM, the document is represented as a [[Tree (data structure)]] comprising the [[HTML element]]s, [[HTML attribute]]s, text and other aspects of the HTML text document
:::*Although the DOM defines an [[Object (computer science)|object]] [[Domain model|model]] of the document, there is no requirement that the DOM implementation (in the web browser or wherever) uses this object model to represent the document, just that it fulfils the interface ''as if it did''.
:::*If scripts alter or manipulate the DOM 'objects' via the provided interface, then a web browser should alter the displayed representation appropriately.
:::*DOM Level 3 provides for XML DOM structures to be serialised back into markup text. There are many reasons and ways that the output document may differ from original markup:[http://www.w3.org/TR/2004/NOTE-DOM-Requirements-20040226/]
:::**The DOM may have been manipulated by scripting since it was loaded
:::**The serialisation mode may have been set to alter [[XML entity]]s
:::**the serialisation mode may alter whitespace, namespaces, etc
:::I had some of that wrong in my version above, but I think it's better here. I left most of the links un-piped for now. Once we (and whoever else may show up to help) agree what the points are, we can re-write the prose, I hope. --[[User:Nigelj|Nigelj]] ([[User talk:Nigelj|talk]]) 17:47, 30 December 2011 (UTC)
::::Yeah, it seems like a somewhat neglected article. But I do agree, it's a quite important and often-referenced concept. Which is what got me interested in at least an introductory explanation. Unfortunately I don't have time to devote to a full fix-up. I think the details you outlined are very good to note lower down in the article. At the moment it doesn't even have a section on those topics.
::::But if you're alright with my latest revision of the introductory section, I'll go ahead and add it once I've found some references? The w3c document you linked might be useful for some of it, but unfortunately until HTML5 the specification didn't even address the inner workings I refer to.
::::--[[User:Qwerty0|Qwerty0]] ([[User talk:Qwerty0|talk]]) 06:01, 31 December 2011 (UTC)
I've just found this again, having forgotten it for a few months. I see neither of us actually did much in the end at the time. I've just reverted an edit by {{user|TheBoothy}}. I'll explain why in steps as it's all pretty relevant to what we were saying above.
*'Web browsers '''usually''' use an internal model similar to the DOM' - there is no reason why they have to, internally, as long as they fulfil the DOM's interface when scripts make calls on it.
*'...and to inspect or modify a Web page using JavaScript code' Browsers don't 'inspect or modify' a Web page using JavaScript. The JavaScript is external to the browser, written by a web developer as part of some webpage, and ''it'' may (depending on the developer's intentions) inspect (or query, or read, or search) or modify (or alter, or add to, or delete part of) the page's DOM.
*When we say 'JavaScript sees...', that isn't sloppy English for 'JavaScript inspects...'. The script 'sees' the page via its [[interface (computing)]]; that is good technical grammar, whether it is querying the page structure, or altering it. It is not, ''per se'' an inspector of things.
I hope this will be clearer when somebody has a good go at writing a proper clear explanation. --[[User:Nigelj|Nigelj]] ([[User talk:Nigelj|talk]]) 00:15, 18 March 2012 (UTC)
I just watched [http://www.youtube.com/watch?v=WxmcDoAxdoY this video], linked by {{user|Qwerty0}} above. In that the speaker is pretty definite that the DOM ''is'' the data structure produced by the browser's parser. He's talking about HTML5, and there are now reference implementations of the perfect parser getting released, open source. These are written in Python, Java etc and are pretty certainly object oriented in their implementations. So what is the point in me trying to maintain some subtle distinction in my first bullet point just above, and the third bullet in my list above that one. So, I re-read [http://www.w3.org/TR/DOM-Level-2-Core/introduction.html this DOM Level 2] spec. In that the authors are pretty clear that the parser may not even be written in an OO language (guess, e.g. C), and so there is no way it can create the ''objects'' specified by the DOM spec: "The structure of SGML documents has traditionally been represented by an abstract data model, not by an object model." Therefore there is no necessary link between the internal data structure and the DOM, only a requirement to behave properly to incoming, valid, DOM-based, OO, script code: "The Document Object Model is not a set of data structures; it is an object model that specifies interfaces." Now, this article is about DOMs in general, not just the HTML5 DOM, so we need to maintain the distinctions required by other DOM specs, I think, at least until they are deprecated, or have really fallen out of use just about everywhere. That said, with free open-source, perfect, HTML5 parsers available, no one but an idiot would write their own - especially in a non-OO language - these days (and have to simulate all that OO DOM stuff from some other data structure). So, maybe there is no need to harp on about the older distinctions. Comments welcome. --[[User:Nigelj|Nigelj]] ([[User talk:Nigelj|talk]]) 01:28, 18 March 2012 (UTC)
Right now, the opening paragraph of the article is pretty much junk. One should never, ever load up an introduction with technical jiberish and word after word of linked explanations. That just turns off the reader. Please put something like Qwerty0's simple explanation in place of it. It just makes more sense. - [[User:KitchM|KitchM]] ([[User talk:KitchM|talk]]) 18:51, 15 April 2014 (UTC)
== Shadow DOM? ==
Should there be a section of the article on the Shadow DOM (and related topics such as the "twilight DOM")?
See http://glazkov.com/2011/01/14/what-the-heck-is-shadow-dom/
[[User:Strugee|Strugee]] ([[User talk:Strugee|talk]]) 01:50, 22 April 2012 (UTC)
== DOM is API itself according to W3C specification ==
<ref></ref>So the sentence "The public interface of a DOM is specified in its application programming interface (API)" assumes that there is also a non-public one. Since DOM is an API and and any API is a "public interface" by definition the wording "public interface of a DOM" is misleading. --[[User:Smbat.petrosyan|Smbat.petrosyan]] ([[User talk:Smbat.petrosyan|talk]]) 03:45, 26 June 2012 (UTC)
you could say '''DOM Level 0 coprises part of html4''' that way users would use _full html_ in version4, and even more programmers would migrate tro hyml4 and html5 <span style="font-size: smaller;" class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/188.25.110.232|188.25.110.232]] ([[User talk:188.25.110.232|talk]]) 02:42, 30 October 2012 (UTC)</span><!-- Template:Unsigned IP --> <!--Autosigned by SineBot-->
== this article can use LEVEL-1, LEVEL-2, LEVEL-3 as sections ==
why not?
== DOM for SGML? ==
The article mentions that the Document Object Model (DOM) "treats an [[HTML]], [[XHTML]], or [[XML]] document as a tree structure." What about [[SGML]]? Doesn't the DOM treats SGML documents? Since both HTML and XML are extended from SGML, and XHTML is extended from XML and HTML, perhaps we should mention SGML in the article and – if it isn't treated by the DOM – explain why it isn't. —[[User:Kri|Kri]] ([[User talk:Kri|talk]]) 07:18, 2 July 2018 (UTC)
|