Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
last failing ie test remaining
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery committed Apr 20, 2010
1 parent 47ec218 commit 259c2bb
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
9 changes: 7 additions & 2 deletions src/Compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 4 additions & 1 deletion src/jqLite.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/markups.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
12 changes: 7 additions & 5 deletions test/BinderTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
};


Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 0 additions & 6 deletions test/testabilityPatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 259c2bb

Please sign in to comment.