- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Thu, 05 Sep 2013 21:50:33 -0400
- To: whatwg@lists.whatwg.org
On 9/5/13 6:02 AM, Anne van Kesteren wrote:
> Having said that, our current plan is to rely on the Selectors API (2)
In that case I think we need to add a function to the platform that
CSS-escapes a string. Because right now, writing
querySelector("#" + id)
is a total footgun unless you control the id. In particular, if you're
a library you're in trouble...
> but the hope is that .querySelector("#test") will be fast
> enough.
As I explained in the thread, they have quite different behavior:
getElementById takes the ID, but querySelector needs a CSS-escaped form
of the ID.
I'm happy to raise this point on www-dom if you want. Just let me know.
-Boris
Received on Friday, 6 September 2013 01:51:02 UTC