Re: Placing elements in the HTML namespace

On Thu, 15 Jan 2009 17:20:51 +0100, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> Sorry for being unclear (and worse yet, not quite correct).  If the XML  
> serializer in Gecko is serializing an element in the XHTML namespace,  
> and the element has an attribute which is in a list of "shorthand"  
> attributes, and the value of the attribute is "" in the DOM, then the  
> value will be serialized as equal to the name.  For example, if you take  
> an <xhtml:option selected=""> and round-trip it through the parser and  
> serializer you will get out <xhtml:option selected="selected">.
>
> The behavior is limited to the XHTML namespace, so if you were to take  
> <option selected>, parse it with the HTML parser (creating an attribute  
> with an empty value in Gecko) and then serialize it with the XML  
> serializer, you would get <option selected="">.
>
> In both cases, valid XML is produced, but the "same" (in terms of all  
> being HTML elements) DOM is serialized differently depending on the  
> actual namespace of the node.

Ah. I see. FWIW, both selected="" and selected="selected" are valid XHTML5 so you could remove some code here if you want. :-)

-- 
Simon Pieters
Opera Software

Received on Friday, 16 January 2009 08:43:55 UTC