W3C home > Mailing lists > Public > www-style@w3.org > July 2010

Re: Property Selector

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Mon, 19 Jul 2010 03:50:46 -0400
Message-ID: <4C4403D6.9000007@mit.edu>
To: Garrett Smith <dhtmlkitchen@gmail.com>
CC: www-style <www-style@w3.org>
On 7/19/10 3:24 AM, Garrett Smith wrote:
> Standard attribute selectors are more flexible than property
> selectors. They also fail silently if the attribute is missing.
>
> document.querySelectorAll("[noexist=blah]"); // 0
> document.querySelectorAll(":noexist"); // Error.
>
> Why no generic property selector?
>
> :property(name);
> :property(name=value)
>
> - where `value` is required to be an identifier or string [CSS2].
> Anyway, I thought it would be useful for the selectors API.
>
> Just wondering if this has occurred to anyone else.

By "property", do you just mean "get the JS reflection of the element 
and call the getter for the given property name"?

If so, that would significantly complicate selector matching (and make 
some very desirable selector-matching optimizations well-nigh 
impossible), due the fact that getters can modify state (unlike existing 
selectors, which can't change the state of the DOM while the selector is 
being matched against an element).

-Boris
Received on Monday, 19 July 2010 07:51:21 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:29 GMT