Improve canonicalizeHTML to support empty attribute on IE8

This commit is contained in:
Avital Oliver
2014-02-21 17:17:00 -08:00
parent 6c835722b6
commit 43858de596
2 changed files with 11 additions and 7 deletions

View File

@@ -39,8 +39,12 @@ canonicalizeHtml = function(html) {
if (! attrList[i])
continue;
var a = attrList[i].split('=');
if (a.length < 2)
a.push(a[0]); // things like checked=checked, in theory
// In IE8, attributes whose value is "" appear
// without the '=' sign altogether.
if (a.length < 2)
a.push("");
var key = a[0];
// Drop another expando property used by Sizzle.
if (key === 'sizset')

View File

@@ -83,11 +83,11 @@ Tinytest.add("ui - render - basic", function (test) {
'<br a="">',
'HTML.BR({a: [[""]]})');
run(BR({
x: function () { return function () { return []; }; },
a: function () { return function () { return ''; }; }}),
'<br a="">',
'<br a="">');
run(BR({
x: function () { return function () { return []; }; },
a: function () { return function () { return ''; }; }}),
'<br a="">',
'<br a="">');
});
// test that we correctly update the 'value' property on input fields