Looks like I have the magic touch today.
http://github.com/client9/env-js/commit/4cd9fa12fd7d1ea868429be605f...
The following:
somenode.setAttribute('foo', 0);
somenode.setAttribute('foo', null);
are valid constructs, and set the attribute to the string-value
of the argument. However they semi-silently get ignored right now.
I found this since numeric values are used in the Image constructor
and get passed to setAttribute.
in src/dom/element.js around line 49, we have:
// test for exceptions
if (__ownerDocument__(this).implementation.errorChecking) {
// throw Exception if Attribute is readonly
if (attr._readonly) {
throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));
}
// throw Exception if the value string contains an illegal character
if (!__isValidString__(value)) {
throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));
}
}
// assign values to properties (and aliases)
attr.value = value + '';
So at the end, we make sure value is a string. But
right above, we do a isValidString check on the
raw value, not the string value. If a non-string is passed in, this
explodes.
setting value = value + '' uptop will solve this
(committed).
This one is a blocker for me. Unit tests will be in forthcoming
commit for Image.