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

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

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 28 Jun 2013 22:01:22 -0400
Message-ID: <51CE3FF2.6080105@mit.edu>
To: whatwg@lists.whatwg.org
On 6/28/13 5:06 PM, Tab Atkins Jr. wrote:
> getElementById("foo") is just querySelector("#foo")

This is actually false.  For example, getElementById("foo:bar") is just 
querySelector("#foo\\:bar"), which is ... nonobvious.

It gets worse if you don't control the id that's passed in, because 
getElementById(arg) becomes querySelector("#"+cssEscape(arg)) where 
cssEscape is a not entirely trivial-to-write function, if you want it to 
work reliably.

Received on Saturday, 29 June 2013 02:01:50 UTC

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