[whatwg] Proposal: Adding methods like getElementById and getElementsByTagName to DocumentFragments
Tim Streater
tim at clothears.org.uk
Fri Jun 28 14:17:00 PDT 2013
On 28 Jun 2013 at 21:19, 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.
I'd like to support this. I typically have an array of pointers to table bodies, and I want to search those looking for a particular row by id. Only one of the table bodies is in the DOM at any given time, and at present for a table body that is not in the DOM I have to hook it to a fragment and then do something like:
rowPtr = fragPtr.querySelector ("#" + id);
I'd rather be able to use getElementById.
--
Cheers -- Tim
More information about the whatwg
mailing list