Fix failing unit tests in IE7 (Binder, select widget)

The fix does not change any production code, we only need to ignore couple of attributes that IE7 should not display:
* value attribute for LI
* selected attribut for SELECT

Simplified condition in compiler test, this should have been part of f9f0905f4a
This commit is contained in:
Vojta Jina 2011-06-17 22:48:22 +02:00
parent f9f0905f4a
commit d0edc11704
2 changed files with 7 additions and 2 deletions

View file

@ -40,7 +40,7 @@ describe('compiler', function(){
compiler.compile('<div>A</div><span></span>');
}).toThrow("Cannot compile multiple element roots: " + ie("<div>A</div><span></span>"));
function ie(text) {
return msie && msie < 9 ? uppercase(text) : text;
return msie < 9 ? uppercase(text) : text;
}
});

View file

@ -223,7 +223,12 @@ function sortedHtml(element, showNgClass) {
attr.name !='style' &&
attr.name.substr(0, 6) != 'jQuery') {
// in IE we need to check for all of these.
if (!/ng-\d+/.exec(attr.name) && attr.name != 'getElementById')
if (!/ng-\d+/.exec(attr.name) &&
attr.name != 'getElementById' &&
// IE7 has `selected` in attributes
attr.name !='selected' &&
// IE7 adds `value` attribute to all LI tags
(node.nodeName != 'LI' || attr.name != 'value'))
attrs.push(' ' + attr.name + '="' + attr.value + '"');
}
}