W3C home > Mailing lists > Public > public-html@w3.org > June 2008

Re: Empty attribute syntax and the DOM and CSS

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Sun, 22 Jun 2008 14:04:30 +0200
Message-ID: <485E3FCE.6020804@lachy.id.au>
To: Daniel Schattenkirchner <schattenkirchner.daniel@gmx.de>
Cc: public-html@w3.org

Daniel Schattenkirchner wrote:
> 
> I wonder how empty attributes are represented in the DOM and how they 
> should work with CSS. Take a look at the example code:
> 
> <!doctype html>
> <html>
> <body>
> <p><input type="submit" disabled></p>
> </body>
> </html>
> ...
> 
> It's an unimportant edge case, but if I didn't miss the relevant parts 
> in the draft, it is undefined how <element disabled /> should be 
> represented.

It is defined.  In the tokenisation section of the parsing algorithm, 
the spec states this about creating a new attribute:

| Start a new attribute in the current tag token. Set that attribute's
| name to the lowercase version of the current input character (add
| 0x0020 to the character's code point), and its value to the empty
| string. Switch to the attribute name state.

http://www.whatwg.org/specs/web-apps/current-work/#before

Since the value never gets changed from the empty string if there it 
never reaches either of the attribute value states, the value remains as 
the empty string.  Therefore, <input disabled> is identical in meaning 
to <input disabled="">.  The implementations that treat those 
differently are broken.

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/
Received on Sunday, 22 June 2008 12:05:13 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:18 GMT