- From: Anne van Kesteren <annevk@annevk.nl>
- Date: Tue, 22 Oct 2013 12:00:00 +0100
- To: Boris Zbarsky <bzbarsky@mit.edu>
- Cc: Glenn Maynard <glenn@zewt.org>, "Tab Atkins Jr." <jackalmage@gmail.com>, Ryosuke Niwa <rniwa@apple.com>, whatwg <whatwg@lists.whatwg.org>, Tim Streater <tim@clothears.org.uk>, Ian Hickson <ian@hixie.ch>
On Fri, Oct 18, 2013 at 10:56 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote: > So it looks to me like in practice Element.getElementById could be quite a > bit faster than the equivalent querySelector call, for both the in-tree case > (where both can avoid walking the tree) and the out-of-tree case (where both > need to walk the tree). > > Food for thought. So do you think we should add getElementById() to ParentNode in DOM? It seems the advantages are that we can optimize it better than querySelector() because there is no selector parsing. And because there is no selector parsing, you can simply pass the value of an element's id attribute rather than escaping said value using CSS escape rules. What it seems we lack is a clear need for either, but if the cost of implementing it is low, maybe it's worth it? -- http://annevankesteren.nl/
Received on Tuesday, 22 October 2013 11:00:30 UTC