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

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