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

Re: Property Selector

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Mon, 19 Jul 2010 11:50:32 -0700
Message-ID: <AANLkTimOrgP8SOX77rIk8-127XiKAfTj11TT6BGAmBdo@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: www-style <www-style@w3.org>
On 7/19/10, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> 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).

So the problem is where the property is a getter and that getter has
side effects and the side effects include modifying the DOM.

Is there a DOM property where that would happen or is this only a
possibility for expandos (user-defined setters)?

Received on Monday, 19 July 2010 18:51:00 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:48 UTC