W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2008

[whatwg] Thoughts on HTML 5

From: Giovanni Campagna <scampa.giovanni@gmail.com>
Date: Tue, 16 Dec 2008 14:14:16 +0100
Message-ID: <65307430812160514i44c008b7sd4dfd475c18887d2@mail.gmail.com>
Maybe so-called "invalid" HTML attributes are not the only solution, but in
my opinion it is a simple way to embed metadata within any element.

Imagine that such markup is then passed to a web application through XHR. In
that case scripts aren't parsed and executed. In this case you have three
ways to attach a behaviour:

2) on-event standard attributes (but they not performant since they're
parsed every time the event fires and the cannot include chars like > or ",
they need to be escaped)
3) assigning a "class" and some metadata using "data-", then
getElementsByClassName and addEventListener

The same with CSS: you can use "style" for each element or "data-"
attributes queried by attr()

For what concerns browser support, these attributes are at all part of the
DOM tree, so I can pass their names to getAttribute and setAttribute, but
they don't get any special interface.

It's the same in the XML serialization with different application-specific
namespaces: they use only DOMAttr interface defined in DOM3Core and they're
not part of any infoset (not part of ID list or NAME list)

Personally I prefer the latter (XML) solution, but there are context where
using XML serialization is not possibile (for example in user generated
content) so there is a definite need for a SGML way to add custom attributes
without conflicting with standards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20081216/22a589be/attachment.htm>
Received on Tuesday, 16 December 2008 05:14:16 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:46 UTC