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

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.

-Boris

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