W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2013

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

From: Mikko Rantalainen <mikko.rantalainen@peda.net>
Date: Fri, 12 Jul 2013 09:28:48 +0300
Message-ID: <51DFA220.6020106@peda.net>
To: whatwg@lists.whatwg.org
Boris Zbarsky, 2013-07-03 17:50 (Europe/Helsinki):
> On 7/3/13 3:58 AM, Mikko Rantalainen wrote:
>> Boris Zbarsky, 2013-06-29 05:02 (Europe/Helsinki):
>>> On 6/28/13 6:51 PM, Tab Atkins Jr. wrote:
>>>> querySelector is simply a more powerful querying function than the old
>>>> DOM methods,
>>>
>>> And somewhat slower as a result, note.
>>
>> I'd *guess* that that difference is meaningless compared to
>> walking the element tree or even doing hash lookup for the id
>
> You'd guess wrong, and I've got profiles to prove it.  ;)

OK. I stand corrected.

With the real world performance difference, I'd prefer that 
getElementsByTagName() and getElementById() were supported for 
fragments, too.

Pros:

- Better optimized performance
- Making API more similar to Document

Cons:

- Two extra methods in the namespace (however, nobody sane will
   use neither of the old method names for anything else so this
   can be ignored)

-- 
Mikko
Received on Friday, 12 July 2013 06:29:22 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:03 UTC