Nope. The DOM (Document Object Model) has a tree structure, just like
HTML, with elements owning children. And as HTML is a "static"
document (you can't mess with it any other way except via DOM), you
can't traverse it, you can only traverse the DOM that represents it :)

On Sep 3, 10:15 am, "Rick Faircloth" <r...@whitestonemedia.com> wrote:
> > It is impossible to know the OP was just a bit lazy or
> > doesn't fully understand the concepts.
>
> The latter...I'm the OP and I can promise you that I don't fully
> understand all the concepts. :o)
>
> Anyway, back to the DOM & HTML...
>
> If, as you state, "there is no HTML in the DOM," from a "technical"
> standpoint, then I suppose it's technically inaccurate to speak
> of "traversing the DOM", since what is really being done is
> "traversing of the HTML elements."  Would that be a fair statement?
>
> Rick
>
> -----Original Message-----
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
>
> Behalf Of RobG
> Sent: Thursday, September 03, 2009 1:43 AM
> To: jQuery (English)
> Subject: [jQuery] Re: Is this "quirk" of jQuery still true?
>
> On Sep 3, 1:25 pm, "Rick Faircloth" <r...@whitestonemedia.com> wrote:
> > Thanks for the explanation, Rob.
>
> > I'll have to check into setAttribute...am I correct in assuming
> > that "setAttribute" is a Javascript function, but not jQuery?
>
> setAttribute is a DOM Core method of the Element interface[1]. jQuery
> wraps a great many such methods, but not this one. There is rarely any
> need to use it for HTML documents, particularly as it is broken in
> parts in IE. There is also little use for it as setting the DOM
> property directly is simpler (and likely much faster as it doesn't
> require a method call). setAttribute may handy for XML documents
> though.
>
> > Also, your statement, "There is no 'HTML in the DOM'.  HTML is used
> > to create a DOM." seems like semantics.
>
> Yes, it is, but in a technical group I think it is important. It is
> impossible to know the OP was just a bit lazy or doesn't fully
> understand the concepts. Better to be sure than make a wrong
> assumption.
>
> > So is it correct to say that a DOM contains no HTML?
>
> Yes. HTML is a markup language, it is interpreted by browsers to
> generate a DOM. Javascript interacts with the DOM, not the markup.
>
> An analogy is that a plan is used to build a house. Instructions to
> tradesmen to change the design might be reflected in the house, but
> aren't automatically reflected in the plans unless you also tell the
> draughtsman to change them.  innerHTML and other DOM inspection tools
> are like an "as built" plan of part of the house.
>
> 1. <URL:http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-F68F082>
>
> --
> Rob

Reply via email to