- From: Philip Taylor <pjt47@cam.ac.uk>
- Date: Wed, 23 Sep 2009 21:15:19 +0100
- 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 UTC