have found fragments to be very useful in constructing dynamic html – like using a bag of html elements and the bag itself dissolving when put into place – very nice.
I had assumed the methods for html elements and fragments were the same, but I think this is incorrect.
it seems that fragments have node methods – appendChild() etc – but do not have more sophisticated html element methods, for example, getElementsByTagName().
is this assessment correct? or am I shooting myself in the foot in a new way?
A
DocumentFragmentextends theNodeinterface and is defined as,An
HTMLElementextends fromElement, and its interface is defined as,Elementin-turn extends theNodeinterface. It contains the methodgetElementsByTagNameamong several others,So to answer your question in short, a document fragment and an html element both share the node interface.