Export to GitHub

controljs - issue #3

use data-cjssrc and data-cjsexec


Posted on Dec 16, 2010 by Quick Giraffe

Per Malcolm Tredinnick's great comment ( http://www.stevesouders.com/blog/2010/12/15/controljs-part-1/#comment-2846 ) it helps with validation if we preface custom attributes with "data-". So let's change cjssrc to data-cjssrc and cjsexec to data-cjsexec.

It'd be good to fix this sooner than later! We'll probably have to support the old syntax for awhile.

Here's the full comment: The thing with the data-cjssrc is to find a projected valid way of introducing a new attribute. In HTML 4 or XHTML 1.x, “cjssrc” will lead to the page being invalid and a lot of us still like/insist on validity as a way of detecting errors ahead of sending out content.

In HTML 5, the proposal (i.e. it’s in the spec, but HTML 5 is still a WIP) is that any attribute which starts with “data-” is considered private in the sense that the browser won’t use it for rendering or otherwise act on it, but it will be available in the DOM for scripts to use. So it’s the recommended way of adding new stuff like this. As browsers roll out support for HTML 5, it’s probably worthwhile adopting that convention straight away to be forwards compatible.

The relevant proposal is at http://dev.w3.org/html5/spec/Overview.html#embedding-custom-non-visible-data-with-the-data-attributes

Comment #1

Posted on Dec 26, 2010 by Quick Giraffe

(No comment was entered for this change.)

Comment #2

Posted on Dec 26, 2010 by Quick Giraffe

Now data-cjssrc and data-cjsexec are the script attributes. For backward compatibility, cjssrc and cjsexec are also supported.

Status: Fixed

Labels:
Type-Defect Priority-High