[whatwg] Attribute for holding private data for scripting

Maciej Stachowiak mjs at apple.com
Tue Apr 10 19:49:32 PDT 2007


On Apr 10, 2007, at 2:14 PM, Sam Ruby wrote:

> Anne van Kesteren wrote:
>> On Tue, 10 Apr 2007 22:41:12 +0200, Sam Ruby  
>> <rubys at intertwingly.net> wrote:
>>> How so?
>> I missed the part where you wanted to change existing HTML  
>> parsers. I thought Hixie pointed out earlier (by means of  
>> examples) why we can't have namespace parsing in HTML. I suppose  
>> we can discuss it again...
>
> It is a recurring pattern.  The first instance was "we can't allow  
> trailing slashes in tags", which was followed up by a carefully  
> crafted and narrow set of exceptions, which was met with "that  
> works" and was adopted.
>
> So... while it is clearly true the full extent of XML namespames  
> will never be supported in HTML5 (and for good reason), namespace  
> qualified attributes allow extensibility in ways that prevent  
> collisions.
>
> One of the first questions that would need to be answered: are  
> there any existing documents on the web which would be broken if  
> the name placed into the DOM for attributes with names containing a  
> colon, with an apparent prefix, and one that matched an enclosing  
> xmlns: declaration were to be changed?

I think the problem here isn't compatibility with existing content,  
but rather ability to use the feature in new web content while still  
gracefully handling existing user agents. We wrote up some design  
principles for the HTML WG based on the WHATWG's working assumptions  
which might make this point more clear: <http://esw.w3.org/topic/HTML/ 
ProposedDesignPrinciples>. While "Don't Break The Web" is a goal, so  
is "Degrade Gracefully".

To give a specific example: say I make my own "mjsml" prefix with  
namespace "http://example.org/mjsml". In HTML4 UAs, to look up an  
"mjsml:extension" attribute using getAttribute("mjsml:extension"). In  
HTML5 UAs, I'd have to use getAttributeNS("http://example.org/mjsml",  
"extension"). And neither technique would work on both (at least as I  
understand your proposal).

Now, we could extend getAttribute in HTML to do namespace lookup when  
given a name containing a colon and when namespace declarations are  
present, but then we would want to do it in XHTML as well. And using  
the short getAttribute call instead of a longer getAttributeNS with a  
namespace prefix might be unacceptable to XML fans.

Regards,
Maciej





More information about the whatwg mailing list