last failing ie test remaining

This commit is contained in:
Misko Hevery 2010-04-19 17:02:46 -07:00
parent 47ec218777
commit 259c2bba4b
5 changed files with 24 additions and 14 deletions

View file

@ -182,10 +182,15 @@ function eachNode(element, fn){
}
function eachAttribute(element, fn){
var i, attrs = element[0].attributes || [], chld, attr, attrValue = {};
var i, attrs = element[0].attributes || [], chld, attr, name, value, attrValue = {};
for (i = 0; i < attrs.length; i++) {
attr = attrs[i];
attrValue[attr.name] = attr.value;
name = attr.name;
value = attr.value;
if (msie && name == 'href') {
value = decodeURIComponent(element[0].getAttribute(name, 2));
}
attrValue[name] = value;
}
foreachSorted(attrValue, fn);
}

View file

@ -29,7 +29,10 @@ function jqClearData(element) {
removeEventListener(element, type, fn);
});
delete jqCache[cacheId];
delete element[jqName];
if (msie)
element[jqName] = ''; // ie does not allow deletion of attributes on elements.
else
delete element[jqName];
}
}

View file

@ -43,6 +43,12 @@ angularTextMarkup('{{}}', function(text, textNode, parentElement) {
} else {
newElement = self.text(text);
}
if (msie && text.charAt(0) == ' ') {
newElement = jqLite('<span>&nbsp;</span>');
var nbsp = newElement.html();
newElement.text(text.substr(1));
newElement.html(nbsp + newElement.html());
}
cursor.after(newElement);
cursor = newElement;
});

View file

@ -16,7 +16,9 @@ BinderTest.prototype.setUp = function(){
};
BinderTest.prototype.tearDown = function(){
if (this.element && this.element.dealoc) this.element.dealoc();
if (this.element && this.element.dealoc) {
this.element.dealoc();
}
};
@ -100,8 +102,8 @@ BinderTest.prototype.testBindingSpaceConfusesIE = function() {
'<b><span ng-bind="a"></span><span>'+nbsp+'</span><span ng-bind="b"></span></b>',
this.compileToHtml("<b>{{a}} {{b}}</b>"));
assertEquals(
'<span ng-bind="A"></span><span>'+nbsp+'x </span><span ng-bind="B"></span><span>'+nbsp+'(</span><span ng-bind="C"></span>',
this.compileToHtml("{{A}} x {{B}} ({{C}})"));
'<b><span ng-bind="A"></span><span>'+nbsp+'x </span><span ng-bind="B"></span><span>'+nbsp+'(</span><span ng-bind="C"></span>)</b>',
this.compileToHtml("<b>{{A}} x {{B}} ({{C}})</b>"));
};
BinderTest.prototype.testBindingOfAttributes = function() {
@ -586,13 +588,13 @@ BinderTest.prototype.testItShouldSelectTheCorrectRadioBox = function() {
var female = jqLite(c.node[0].childNodes[0]);
var male = jqLite(c.node[0].childNodes[1]);
trigger(female, 'click');
female.trigger('click');
assertEquals("female", c.scope.sex);
assertEquals(true, female[0].checked);
assertEquals(false, male[0].checked);
assertEquals("female", female.val());
trigger(male, 'click');
male.trigger('click');
assertEquals("male", c.scope.sex);
assertEquals(false, female[0].checked);
assertEquals(true, male[0].checked);

View file

@ -27,12 +27,6 @@ extend(angular, {
});
function trigger(element, type) {
var evnt = document.createEvent('MouseEvent');
evnt.initMouseEvent(type, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
(element[0] || element).dispatchEvent(evnt);
}
function sortedHtml(element) {
var html = "";
foreach(element, function toString(node) {