Where is processing of binary attributes covered?

View: New views
4 Messages — Rating Filter:   Alert me  

Where is processing of binary attributes covered?

by Henry S. Thompson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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?

Thanks,

ht
- --
       Henry S. Thompson, School of Informatics, University of Edinburgh
                         Half-time member of W3C Team
      10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44) 131 650-4440
                Fax: (44) 131 651-1426, e-mail: ht@...
                       URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFKunVKkjnJixAXWBoRAmbqAJwIMFZHgrz8MWv4UzIXj6TPF9kqVgCfawC1
y6TljE8iyZZa/FWkf55FEwA=
=Iug0
-----END PGP SIGNATURE-----


Re: Where is processing of binary attributes covered?

by Philip Taylor-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...


Re: Where is processing of binary attributes covered?

by Henry S. Thompson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.

ht
- --
       Henry S. Thompson, School of Informatics, University of Edinburgh
                         Half-time member of W3C Team
      10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44) 131 650-4440
                Fax: (44) 131 651-1426, e-mail: ht@...
                       URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFKuomokjnJixAXWBoRApniAJ4lCVIjJ2j+F7hwlIteaVNiuIZNxQCfbYeA
p12WtG+aLX8+13zLnewYBv0=
=awfk
-----END PGP SIGNATURE-----


Re: Where is processing of binary attributes covered?

by Geoffrey Sneddon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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/>