Re: Where is processing of binary attributes covered?

On 23 Sep 2009, at 21:48, Henry S. Thompson wrote:

> Philip Taylor writes:
>
>> 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.
>
> Hmm.  OK, I misunderstood.  I thought that in general the DOM which
> resulted from parsing was 'conformant', i.e., would if serialized by a
> conformant document, but it appears I was mistaken.

This would make it impossible to degrade new stuff nicely. E.g.,  
<input type=date>. I can in JS do something like:

var type = input.getAttribute("type") ?  
input.getAttribute("type").toLowerCase() : "text";
if (input.type != type)
{
	if (type == "date")
		applyMagicJSDatePicker(input);
	else if (type == "color")
		applyMagicJSColourPicker(input);
	[etc…]
}

If the DOM was always conformant, it would be impossible to do that,  
and would make degrading gracefully in older UAs a lot harder.


--
Geoffrey Sneddon
<http://gsnedders.com/>

Received on Thursday, 24 September 2009 11:01:31 UTC