Can I add a custom attribute to an HTML tag like the following?
I can think of a handy use for the custom tag "init"
. Include a JavaScript expression that gets evaluated at document.onLoad()
time and provides a value for the tag, e.g.
<p>The UTC date is <span init="new Date().toUTCString()">?</span>.<p>
Some boilerplate JavaScript code would scan all the tags in the DOM at document.onload()
time looking for the init attributes, evaluating the expressions that they contain, and assigning them to the containing tag's innerHTML. This would give HTML some of the power of JSP, PHP etc. Currently we have to split the HTML markup and the JavaScript code that illuminates it. Bugs love split code.