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

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

From: Glenn Maynard <glenn@zewt.org>
Date: Thu, 10 Oct 2013 09:15:13 -0500
Message-ID: <CABirCh9p-CpX_kxg3sqhG6aHXmMX0yWPn0-ELkEGv9wJZwA-nw@mail.gmail.com>
To: Simon Pieters <simonp@opera.com>
Cc: whatwg <whatwg@lists.whatwg.org>, Boris Zbarsky <bzbarsky@mit.edu>
On Thu, Oct 10, 2013 at 6:06 AM, Simon Pieters <simonp@opera.com> wrote:

> $('li[id = ' + textId + ']', $slideshow3485780.context)
> $('[n_id='+allN_id+'] .notificationContainer a span')
> $('.recommend > .bd.b_con ul[city="'+city1+'"]')
> (The above is just a small subset of some interesting cases.)
> I didn't see a single case that actually used an escaping utility.

When I'm doing this I just make sure that the strings don't need escaping
in the first place.  Many of these look like they do that (probably most
"ID" cases are things like random numbers or alphanumerics).

FWIW, I rarely use IDs at all: I use classes, even if there will probably
only be one of something.  (Once templates enter the picture, IDs don't
make sense, so I generally just avoid them.)

On Thu, Oct 10, 2013 at 8:41 AM, Glenn Adams <glenn@skynav.com> wrote:

> Given the existence of Window.escape(), i.e., the JS escape(string)
> function property of the Global object, I wonder if choosing a longer,
> different name would be better to avoid confusion.

I think the "CSS" scope makes it perfectly clear and unambiguous.

Glenn Maynard
Received on Thursday, 10 October 2013 14:15:40 UTC

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