Support element attributes as intended

This commit is contained in:
Tony Garnock-Jones 2014-03-07 09:35:41 -05:00
parent f04fb92ea4
commit 0273f2557e
2 changed files with 7 additions and 1 deletions

View File

@ -61,7 +61,13 @@ DOMFragment.prototype.interpretSpec = function (spec) {
var attrs = hasAttrs ? spec[1] : {};
var kidIndex = hasAttrs ? 2 : 1;
// Wow! Such XSS! Many hacks! So vulnerability! Amaze!
var n = document.createElement(tagName);
for (var attr in attrs) {
if (attrs.hasOwnProperty(attr)) {
n.setAttribute(attr, attrs[attr]);
}
}
for (var i = kidIndex; i < spec.length; i++) {
n.appendChild(this.interpretSpec(spec[i]));
}

View File

@ -12,7 +12,7 @@ $(document).ready(function () {
}
}
}, [pub(["DOM", "#clicker-holder", "clicker",
["button", "Click me!"]]),
["button", ["span", {"style": "font-style: italic"}, "Click me!"]]]),
pub("bump_count"),
sub(["jQuery", "button.clicker", "click", __])]);