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