This is in some sense reasonable to require, since "class" is for some
reason a keyword in JavaScript even though it's not used by the
language which doesn't even have classes. Douglas Crockford's book
"JavaScript: The Good Parts" lists 59 reserved words of which maybe
half are actually used in the language. The others include such
tantalising morsels as "interface" and "implements", "package",
"protected" and even "debugger".
In the absence of this quoting, our JavaScript minifier yui-compressor
responds with
Exception in thread "main" java.lang.reflect.InvocationTargetException
then forty levels of completely uninformative stack-trace before
giving up and rather lamely saying "... 5 more".
Is it really too much to ask that a JavaScript parser should respond
to a syntax error with "syntax error: unquoted keyword 'class'"?
Sheesh.
function widget($, team, type, node) {
// Static register of attributes that do not contribute to config
var ignoreAttrs = {
- id:1, class:1, style:1, name:1, action:1, type:1, size:1,
+ id:1, 'class':1, style:1, name:1, action:1, type:1, size:1,
value:1, width:1, valign:1
};