Re: Placing elements in the HTML namespace

Simon Pieters wrote:
>> 1)  frames/iframes.  For XHTML we use the id attribute value as the
>>      window name, for HTML we use the name attribute value.  Should this
>>      be based on the document type instead?  Or something else?
> 
> You should always use name='', per HTML5, I think.

Could be.  As I said, the last time I looked at this predates HTML5.

>> 2)  Serializing XML -- for XHTML we set shorthand attrs to be
>>      |foo="foo"| while for HTML we set them to just be |foo|.
>>      This only affects people calling the XML serializer on a DOM coming
>>      from text/html, but that sounds like something HTML5 wants to
>>      support.
> 
> Not sure what you mean here. Are you saying that the XML serializer 
> isn't serializing as XML for HTML elements?

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.

-Boris

Received on Thursday, 15 January 2009 16:21:53 UTC