From 8b29156a2ddcc738f9b0cf8dfc48a8648474884d Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Wed, 21 Apr 2010 14:29:05 -0700 Subject: ie6 now passes --- scenario/widgets.html | 1 - src/Browser.js | 2 +- src/jqLite.js | 2 +- src/widgets.js | 5 +++-- test/FiltersTest.js | 18 +++++++++--------- test/directivesSpec.js | 4 ++-- test/markupSpec.js | 26 +++++++++++++++----------- 7 files changed, 31 insertions(+), 27 deletions(-) diff --git a/scenario/widgets.html b/scenario/widgets.html index 5449b218..43b1ddbb 100644 --- a/scenario/widgets.html +++ b/scenario/widgets.html @@ -93,6 +93,5 @@ ---> diff --git a/src/Browser.js b/src/Browser.js index e00f73a5..11b079f0 100644 --- a/src/Browser.js +++ b/src/Browser.js @@ -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) {} diff --git a/src/jqLite.js b/src/jqLite.js index 0867f9c9..36248e71 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -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; } }, diff --git a/src/widgets.js b/src/widgets.js index 2c084e29..239f12f8 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -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; } diff --git a/test/FiltersTest.js b/test/FiltersTest.js index 0fd80056..a71d30e2 100644 --- a/test/FiltersTest.js +++ b/test/FiltersTest.js @@ -80,13 +80,13 @@ FiltersTest.prototype.testImage = function(){ assertEquals(null, angular.filter.image()); assertEquals(null, angular.filter.image({})); assertEquals(null, angular.filter.image("")); - assertEquals('', sortedHtml(angular.filter.image({url:"abc"}))); + assertEquals('', sortedHtml(angular.filter.image({url:"http://localhost/abc"}))); assertEquals( - '', - sortedHtml(angular.filter.image({url:"abc"}, 10))); + '', + sortedHtml(angular.filter.image({url:"http://localhost/abc"}, 10))); assertEquals( - '', - sortedHtml(angular.filter.image({url:"abc"}, 10, 20))); + '', + 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( - 'http://ab ' + - '(http://a) ' + - '<http://a> ' + + 'http://ab/ ' + + '(http://a/) ' + + '<http://a/> ' + 'http://1.2/v:~-123. c', - sortedHtml(linky("http://ab (http://a) http://1.2/v:~-123. c"))); + sortedHtml(linky("http://ab/ (http://a/) http://1.2/v:~-123. c"))); assertEquals(undefined, linky(undefined)); }; diff --git a/test/directivesSpec.js b/test/directivesSpec.js index d012fdd0..71402af7 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -52,8 +52,8 @@ describe("directives", function(){ }); it('should ng-bind-attr', function(){ - var scope = compile(''); - expect(element.attr('src')).toEqual('mysrc'); + var scope = compile(''); + expect(element.attr('src')).toEqual('http://localhost/mysrc'); expect(element.attr('alt')).toEqual('myalt'); }); diff --git a/test/markupSpec.js b/test/markupSpec.js index cfc0f899..5e3b829a 100644 --- a/test/markupSpec.js +++ b/test/markupSpec.js @@ -27,11 +27,11 @@ describe("markups", function(){ }); it('should translate {{}} in terminal nodes', function(){ - compile(''); - expect(sortedHtml(element)).toEqual(''); + compile(''); + expect(sortedHtml(element)).toEqual(''); scope.$set('name', 'Misko'); scope.$eval(); - expect(sortedHtml(element)).toEqual(''); + expect(sortedHtml(element)).toEqual(''); }); it('should translate {{}} in attributes', function(){ @@ -43,14 +43,18 @@ describe("markups", function(){ }); it('should populate value attribute on OPTION', function(){ - compile(''); - expect(sortedHtml(element)).toEqual(''); + compile(''); + expect(sortedHtml(element)).toEqual(''); }); it('should process all bindings when we have leading space', function(){ - compile(' {{a}}
{{b}}
'); - var space = msie ? '' + NBSP + '': ' '; - expect(sortedHtml(scope.$element)).toEqual('' + space + '

'); + var e = jqLite(' {{a}}
{{b}}
'); + if (sortedHtml(e).indexOf('{{') != 0) { + // can only run this test if browser respects leading spaces + compile(e); + var space = msie ? '' + NBSP + '': ' '; + expect(sortedHtml(scope.$element)).toEqual('' + space + '

'); + } }); }); @@ -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}}"))); }; -- cgit v1.2.3