[prev in list] [next in list] [prev in thread] [next in thread] 

List:       whatwg
Subject:    Re: [whatwg] Proposal: Adding methods like getElementById and getElementsByTagName to DocumentFragme
From:       Boris Zbarsky <bzbarsky () MIT ! EDU>
Date:       2013-06-29 2:01:22
Message-ID: 51CE3FF2.6080105 () mit ! edu
[Download RAW message or body]

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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic