From 618a2b423d826ab8366a6907e71a4af0e76d6211 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Mon, 19 Apr 2010 14:36:41 -0700 Subject: ie fixes --- src/Angular.js | 6 ++++-- src/jqLite.js | 22 +++++++++++++++++++--- test.sh | 2 +- test/testabilityPatch.js | 5 +++-- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/Angular.js b/src/Angular.js index ec1fa49b..94853004 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -118,8 +118,10 @@ function isElement(node) { } function isVisible(element) { - var rect = element[0].getBoundingClientRect(); - return rect.width && rect.height; + var rect = element[0].getBoundingClientRect(), + width = rect.width || (rect.right||0 - rect.left||0), + height = rect.height || (rect.bottom||0 - rect.top||0); + return width>0 && height>0; } function map(obj, iterator, context) { diff --git a/src/jqLite.js b/src/jqLite.js index 67e1717c..4dcd9349 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -100,7 +100,6 @@ JQLite.prototype = { }); }, - //TODO: remove trigger: function(type) { var evnt = document.createEvent('MouseEvent'); evnt.initMouseEvent(type, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); @@ -191,9 +190,9 @@ JQLite.prototype = { text: function(value) { if (isDefined(value)) { - this[0].nodeValue = value; + this[0].textContent = value; } - return this[0].nodeValue; + return this[0].textContent; }, val: function(value) { @@ -216,3 +215,20 @@ JQLite.prototype = { parent: function() { return jqLite(this[0].parentNode);}, clone: function() { return jqLite(this[0].cloneNode(true)); } }; + +if (msie) { + extend(JQLite.prototype, { + text: function(value) { + var e = this[0]; + if (isDefined(value)) { + e.innerText = value; + } + // NodeType == 3 is text node + return e.nodeType == 3 ? e.nodeValue : e.innerText; + }, + + trigger: function(type) { + this[0].fireEvent('on' + type); + } + }); +}; diff --git a/test.sh b/test.sh index e4ec7f68..fd12cdff 100755 --- a/test.sh +++ b/test.sh @@ -1 +1 @@ -java -jar lib/jstestdriver/JsTestDriver.jar --tests BinderTest.testChangingSelectNonSelectedUpdatesModel +java -jar lib/jstestdriver/JsTestDriver.jar --tests BinderTest diff --git a/test/testabilityPatch.js b/test/testabilityPatch.js index 89e7d9ea..055c2f77 100644 --- a/test/testabilityPatch.js +++ b/test/testabilityPatch.js @@ -77,8 +77,9 @@ function sortedHtml(element) { for(var css in node.style){ var value = node.style[css]; if (isString(value) && isString(css) && css != 'cssText' && value && (1*css != css)) { - var text = css + ': ' + node.style[css]; - if (indexOf(style, text) == -1) { + var value = node.style[css]; + var text = css + ': ' + value; + if (value != 'false' && indexOf(style, text) == -1) { style.push(text); } } -- cgit v1.2.3