W3C home > Mailing lists > Public > public-html-comments@w3.org > September 2009

Re: Where is processing of binary attributes covered?

From: Philip Taylor <pjt47@cam.ac.uk>
Date: Wed, 23 Sep 2009 21:15:19 +0100
Message-ID: <4ABA81D7.3080405@cam.ac.uk>
To: "Henry S. Thompson" <ht@inf.ed.ac.uk>
CC: public-html-comments@w3.org
Henry S. Thompson wrote:
> Document conformance of binary attributes is clearly specified, in
> section 2.4.2, and means that conforming documents must include
> boolean attributes in only one of three forms, e.g. "disabled",
> "disabled=''" or "disabled='disabled'", and conformance checkers have
> to detect and signal failures to observe this constraint.
> 
> What I can't find clearly stated is how this get into the DOM in the
> right way, and where, if at all, error recovery happens.  So, to make
> this precise, What DOM is built for <input disabled=banana>, and why?
> That is, which sections in the spec. give a user agent the necessary
> information?

http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html 
and subsequent pages define how the DOM is constructed. (It's stated 
'clearly' in the sense that it's precise and unambiguous, though it's 
not exceedingly easy to read...)

In particular, the tokenizer state machine will result in a start tag 
token with name "input" and with one attribute, which has name 
"disabled" and value "banana". That feeds into the tree construction 
algorithm, which will http://whatwg.org/html5#insert-an-html-element 
which will http://whatwg.org/html5#create-an-element-for-the-token which 
requires "the attributes on the node being those given in the given 
token". No error recovery occurs while parsing this case. The attributes 
in the DOM are (very nearly) always exactly what was in the input document.

The only kind of error recovery in this case is that 
http://whatwg.org/html5#concept-fe-disabled defines the element to be 
disabled if the 'disabled' attribute exists on the element in the DOM, 
regardless of the attribute's value.

-- 
Philip Taylor
pjt47@cam.ac.uk
Received on Wednesday, 23 September 2009 20:15:55 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 1 June 2011 00:14:00 GMT