[whatwg] Thoughts on HTML 5

> You're not Nicholas. We don't know if that is what Nicholas expects
> his HTML to do or if he is expecting something else. In absence of an
> example, I can't do much more than guess. I cannot expect your
> assumptions to be correct.

Well, of course, but you sent the message to the entire group, so you
should be ready for answers from the whole group.  ^_^

> You've not stated how creating invalid HTML can "control scripts".
> Having an interest in scripting, I would like to know how this works.

Dude, come on.  You're trying to poison the dialogue here.  The point
isn't to create invalid HTML.  It's to put metadata on elements, which
is most easily accomplished through custom attributes.  This does
(currently, in HTML4) happen to be invalid, but it's hardly on the
level of your standard invalid html produced by a novice author.

As to how custom attributes can help control scripts, look into any
decent javascript plugin.  Many of them utilize some form of metadata
when interacting with the DOM.  This can be passed into the plugin via
a function call, or embedded into a nearby <script>, but it's often
much easier to simply embed it directly on the element that's being
affected by the plugin.  This way you don't have to put in any extra
work to scope the metadata to the appropriate element.

Sometimes you can do this by adding classes onto the element, but
sometimes you can't (well, at least not without quite a bit of
hackery).  Just adding a new attribute can be much simpler and more
appropriate.

As noted, this is why Ian added the data-* attribute family.  This
discussion we're having has already been settled - custom attributes
are a useful thing to script authors, and so HTML5 has an officially
blessed version of them.

~TJ

Received on Monday, 15 December 2008 08:02:24 UTC