[whatwg] Serialization of boolean content attributes

Alexey Proskuryakov ap at webkit.org
Fri Jun 18 10:56:18 PDT 2010


18.06.2010, в 10:25, Jonas Sicking написал(а):

> Serializing boolean attributes as <option selected="selected"> seems
> like a very bad idea since that means that you're changing the value
> as you serialize. I.e. if you roundtrip by for example setting:
>
> myDivElement.innerHTML = myDivElement.innerHTML
>
> you've change the value of all boolean attribute.


That's what Firefox is doing now, and has presumably been doing for a  
long time, so maybe it isn't such a bad idea. It's compatible with the  
Web and with HTML4.

Note that per HTML 4, parsing <option selected> actually produces  
<option selected="selected">, see <http://www.w3.org/TR/REC-html40/intro/sgmltut.html#h-3.3.4.2 
 >. I do not really suggest following this aspect of it, although it's  
the most pure logically. Firefox behavior seems the most practical to  
me.

- WBR, Alexey Proskuryakov




More information about the whatwg mailing list