stevesouders / controljs

Automatically exported from code.google.com/p/controljs
Apache License 2.0
26 stars 9 forks source link

use data-cjssrc and data-cjsexec #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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-wit
h-the-data-attributes

Original issue reported on code.google.com by stevesou...@gmail.com on 16 Dec 2010 at 9:34

GoogleCodeExporter commented 9 years ago

Original comment by stevesou...@gmail.com on 26 Dec 2010 at 4:28

GoogleCodeExporter commented 9 years ago
Now data-cjssrc and data-cjsexec are the script attributes. For backward 
compatibility, cjssrc and cjsexec are also supported.

Original comment by stevesou...@gmail.com on 26 Dec 2010 at 4:45