After a brief chat, we're thinking:
HTML:
%input{:selected => true} => <input selected>
%input{:selected => false} => <input>
XHTML:
%input{:selected => true} => <input selected="selected">
%input{:selected => false} => <input>
Thoughts?
- Nathan
Nathan Weizenbaum wrote:
> I read that as saying that the value of the attribute doesn't matter.
> In fact, the document says that "Boolean attributes may legally take a
> single value: the name of the attribute itself (e.g.,
> selected="selected")." I believe this is the same in XHTML - so a
> literal value of "false" is invalid, and doesn't mean anything.
> However, it looks like browsers treat it as a true value. So <input
> selected="false"> and <input> are equivalent in neither spec nor
> practice :-/.
>
> However, I'm somewhat less reluctant to break code that's invalid in
> the first place, and I would like the inverse of => true to work
> intuitively. I'll talk to Hampton about this.
>
> - Nathan
>
> Mislav Marohnić wrote:
>> Re: "Allow rendering of <input checked>-style attributes in HTML mode."
>> http://github.com/nex3/haml/commit/ae3c44f574f6ef842850ede446e48e4f7bac0191
>>
>>
>> %input{:selected => false}
>>
>> will render as:
>>
>> <input selected="false">
>>
>> The docs say that this is not equivalent to not rendering an
>> attribute. But, in fact, it is:
>> http://www.w3.org/TR/REC-html40/intro/sgmltut.html#didx-boolean_attribute
>>
>>
>> Some attributes play the role of boolean variables (e.g., the
>> selected attribute for the OPTION element). Their appearance in
>> the start tag of an element implies that the value of the
>> attribute is "true". Their absence implies a value of "false".
>>
>>
>> This is HTML4. It has not changed in XHTML, except that the minimized
>> form is not allowed anymore.
>>
>> Because <input selected="false"> and <input> are equivalent, I
>> propose that %input{:selected => false} does not render the attribute
>> at all. We save space on complex forms and the semantics are
>> unchanged anyway.
>>
>>
>>
>>
>> >>
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---