W3C home > Mailing lists > Public > www-style@w3.org > October 2008

Re: pseudo-attributes

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 29 Oct 2008 12:17:33 -0500
Message-ID: <dd0fbad0810291017v5ad2e407p57ac383f5a7610b@mail.gmail.com>
To: "Boris Zbarsky" <bzbarsky@mit.edu>
Cc: www-style@w3.org
On Wed, Oct 29, 2008 at 11:57 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> Tab Atkins Jr. wrote:
>> Really?  At least in terms of scripting, value *does* update
>> interactively.  I can ask for the value of an input initially and after
>> typing things in, and they're different.
> The DOM value property updates.  The value attribute does not.  Except in
> IE, they're not the same thing.

Ah, indeed.  I see that now.  I usually use jQuery, which reported the value
property, and when I dropped into vanilla js to see exactly how it worked, I
was just using elem.value rather than elem.getAttribute("value").

As for breaking sites, do you mean that sites are currently relying on the
> [value] selector only keying off of the written @value attribute in the
> code?
> No, there are sites relying on the value attribute not changing when the
> user types.

That's what I suspected you meant, but I wanted to make sure.

Consider my earlier words as imprecise, then.  I am proposing that attribute
selectors use the DOM property values, rather than the written attribute
values, at least in html.  We already have :checked relying on a DOM value
rather than an attribute value, and presumably :valid and :invalid will do
the same.  Making it a general rule would solve the OP's case, and possibly
others.  Frex, you could change styles on a sibling based on a <select>'s

Would this be unacceptable?  If so, what about an explicit property-value
syntax for a selector?  David's syntax in the OP could even be used, where
an attribute name starting with a : instead refers to the DOM property of
that name.

Received on Wednesday, 29 October 2008 17:18:15 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:40 UTC