ie6 now passes

This commit is contained in:
Misko Hevery 2010-04-21 14:29:05 -07:00
parent 4aaec251df
commit 8b29156a2d
7 changed files with 31 additions and 27 deletions

View file

@ -93,6 +93,5 @@
<td></td>
</tr>
</table>
-->
</body>
</html>

View file

@ -9,7 +9,7 @@ function Browser(location, document) {
this.urlListeners = [];
this.hoverListener = noop;
this.XHR = XMLHttpRequest || function () {
this.XHR = window.XMLHttpRequest || function () {
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e1) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (e2) {}
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e3) {}

View file

@ -187,7 +187,7 @@ JQLite.prototype = {
} else {
var attributes = e.attributes,
item = attributes ? attributes.getNamedItem(name) : undefined;
return item ? item.value : undefined;
return item && item.specified ? item.value : undefined;
}
},

View file

@ -45,10 +45,11 @@ function valueAccessor(scope, element) {
if (error !== lastError || force) {
elementError(element, NG_VALIDATION_ERROR, error);
lastError = error;
if (error)
if (error) {
invalidWidgets.markInvalid(element);
else
} else {
invalidWidgets.markValid(element);
}
}
return value;
}

View file

@ -80,13 +80,13 @@ FiltersTest.prototype.testImage = function(){
assertEquals(null, angular.filter.image());
assertEquals(null, angular.filter.image({}));
assertEquals(null, angular.filter.image(""));
assertEquals('<img src="abc"></img>', sortedHtml(angular.filter.image({url:"abc"})));
assertEquals('<img src="http://localhost/abc"></img>', sortedHtml(angular.filter.image({url:"http://localhost/abc"})));
assertEquals(
'<img src="abc" style="max-height: 10px; max-width: 10px;"></img>',
sortedHtml(angular.filter.image({url:"abc"}, 10)));
'<img src="http://localhost/abc" style="max-height: 10px; max-width: 10px;"></img>',
sortedHtml(angular.filter.image({url:"http://localhost/abc"}, 10)));
assertEquals(
'<img src="abc" style="max-height: 20px; max-width: 10px;"></img>',
sortedHtml(angular.filter.image({url:"abc"}, 10, 20)));
'<img src="http://localhost/abc" style="max-height: 20px; max-width: 10px;"></img>',
sortedHtml(angular.filter.image({url:"http://localhost/abc"}, 10, 20)));
};
FiltersTest.prototype.testQRcode = function() {
@ -141,11 +141,11 @@ FiltersTest.prototype.testHtml = function() {
FiltersTest.prototype.testLinky = function() {
var linky = angular.filter.linky;
assertEquals(
'<a href="http://ab">http://ab</a> ' +
'(<a href="http://a">http://a</a>) ' +
'&lt;<a href="http://a">http://a</a>&gt; ' +
'<a href="http://ab/">http://ab/</a> ' +
'(<a href="http://a/">http://a/</a>) ' +
'&lt;<a href="http://a/">http://a/</a>&gt; ' +
'<a href="http://1.2/v:~-123">http://1.2/v:~-123</a>. c',
sortedHtml(linky("http://ab (http://a) <http://a> http://1.2/v:~-123. c")));
sortedHtml(linky("http://ab/ (http://a/) <http://a/> http://1.2/v:~-123. c")));
assertEquals(undefined, linky(undefined));
};

View file

@ -52,8 +52,8 @@ describe("directives", function(){
});
it('should ng-bind-attr', function(){
var scope = compile('<img ng-bind-attr="{src:\'mysrc\', alt:\'myalt\'}"/>');
expect(element.attr('src')).toEqual('mysrc');
var scope = compile('<img ng-bind-attr="{src:\'http://localhost/mysrc\', alt:\'myalt\'}"/>');
expect(element.attr('src')).toEqual('http://localhost/mysrc');
expect(element.attr('alt')).toEqual('myalt');
});

View file

@ -27,11 +27,11 @@ describe("markups", function(){
});
it('should translate {{}} in terminal nodes', function(){
compile('<select name="x"><option value="">Greet {{name}}!</option></select>');
expect(sortedHtml(element)).toEqual('<select name="x"><option ng-bind-template="Greet {{name}}!">Greet !</option></select>');
compile('<select name="x"><option selected="true" value="">Greet {{name}}!</option></select>');
expect(sortedHtml(element)).toEqual('<select name="x"><option ng-bind-template="Greet {{name}}!" selected="true">Greet !</option></select>');
scope.$set('name', 'Misko');
scope.$eval();
expect(sortedHtml(element)).toEqual('<select name="x"><option ng-bind-template="Greet {{name}}!">Greet Misko!</option></select>');
expect(sortedHtml(element)).toEqual('<select name="x"><option ng-bind-template="Greet {{name}}!" selected="true">Greet Misko!</option></select>');
});
it('should translate {{}} in attributes', function(){
@ -43,14 +43,18 @@ describe("markups", function(){
});
it('should populate value attribute on OPTION', function(){
compile('<select name="x"><option>a</option></select>');
expect(sortedHtml(element)).toEqual('<select name="x"><option value="a">a</option></select>');
compile('<select name="x"><option selected="true">a</option></select>');
expect(sortedHtml(element)).toEqual('<select name="x"><option selected="true" value="a">a</option></select>');
});
it('should process all bindings when we have leading space', function(){
compile('<a> {{a}}<br/>{{b}}</a>');
var space = msie ? '<span>' + NBSP + '</span>': ' ';
expect(sortedHtml(scope.$element)).toEqual('<a>' + space + '<span ng-bind="a"></span><br></br><span ng-bind="b"></span></a>');
var e = jqLite('<a> {{a}}<br/>{{b}}</a>');
if (sortedHtml(e).indexOf('<a>{{') != 0) {
// can only run this test if browser respects leading spaces
compile(e);
var space = msie ? '<span>' + NBSP + '</span>': ' ';
expect(sortedHtml(scope.$element)).toEqual('<a>' + space + '<span ng-bind="a"></span><br></br><span ng-bind="b"></span></a>');
}
});
});
@ -138,7 +142,7 @@ BindingMarkupTest.prototype.testParseMultiline = function(){
};
BindingMarkupTest.prototype.testHasBinding = function(){
assertTrue(hasBindings("{{a}}"));
assertTrue(!hasBindings("a"));
assertTrue(hasBindings("{{b}}x{{c}}"));
assertTrue(hasBindings(parseBindings("{{a}}")));
assertTrue(!hasBindings(parseBindings("a")));
assertTrue(hasBindings(parseBindings("{{b}}x{{c}}")));
};