[whatwg] Proposal: Adding methods like getElementById and getElementsByTagName to DocumentFragments

Anne van Kesteren annevk at annevk.nl
Thu Sep 5 03:02:38 PDT 2013


On Fri, Jun 28, 2013 at 9:19 PM, Zirak A <zirak at mail.com> wrote:
> Currently, a DocumentFragment only inherits from Node, and thus loses methods like getElementById. However, the Selector API (http://www.w3.org/TR/selectors-api/) defines querySelector and querySelectorAll on document fragments.
> My proposal is to add getElementById (which makes sense, as the document fragment is a root node), getElementsByTagName (and its namespace-sensitive version), getElementsByClassName and getElementsByName - in short, all of the general selection methods available on the Document.

Per http://dom.spec.whatwg.org/ this is the wrong forum for DOM.

Having said that, our current plan is to rely on the Selectors API (2)
and slowly move away from getElement* friends over time, as their
return values are less than optimal. getElementById is an exception to
this, but the hope is that .querySelector("#test") will be fast
enough. If it turns out to be a problem, we should re-evaluate at that
point. Concrete suggestions for new traversal APIs should be discussed
on www-dom at w3.org or the DOM bug database until we decide the more
appropriate forum is here, it'd be unfair to the existing community
otherwise.

If you think I should reply to any of the remainder of this thread
please let me know, but I hope this general answer is sufficient.


-- 
http://annevankesteren.nl/


More information about the whatwg mailing list