[Pkg-javascript-commits] [less.js] 259/285: test support for IE11

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:24:00 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag v2.0.0
in repository less.js.

commit 7c4745bb7d37ddb86f952ecf5ab16f43f7f189e2
Author: Luke Page <luke.a.page at gmail.com>
Date:   Sun Nov 2 12:19:05 2014 +0000

    test support for IE11
---
 test/browser/common.js | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/test/browser/common.js b/test/browser/common.js
index f97b665..27f6c3e 100644
--- a/test/browser/common.js
+++ b/test/browser/common.js
@@ -49,11 +49,15 @@ var ieFormat = function(text) {
     var headNode = document.getElementsByTagName('head')[0];
     headNode.appendChild(styleNode);
     try {
-        styleNode.styleSheet.cssText = text;
+        if (styleNode.styleSheet) {
+            styleNode.styleSheet.cssText = text;
+        } else {
+            styleNode.innerText = text;
+        }
     } catch (e) {
         throw new Error("Couldn't reassign styleSheet.cssText.");
     }
-    var transformedText = styleNode.styleSheet.cssText;
+    var transformedText = styleNode.styleSheet ? styleNode.styleSheet.cssText : styleNode.innerText;
     headNode.removeChild(styleNode);
     return transformedText;
 };
@@ -71,13 +75,13 @@ var testSheet = function (sheet) {
         less.pageLoadFinished
             .then(function () {
                 lessOutputObj = document.getElementById(lessOutputId);
-                var isIE = Boolean(lessOutputObj.styleSheet);
-                lessOutput = isIE ? lessOutputObj.styleSheet.cssText :
+                lessOutput = lessOutputObj.styleSheet ? lessOutputObj.styleSheet.cssText :
                     (lessOutputObj.innerText || lessOutputObj.innerHTML);
 
                 expectedOutput
                     .then(function (text) {
-                        if (isIE) {
+                        if (window.navigator.userAgent.indexOf("MSIE") >= 0 ||
+                            window.navigator.userAgent.indexOf("Trident/") >= 0) {
                             text = ieFormat(text);
                         }
                         expect(lessOutput).toEqual(text);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git



More information about the Pkg-javascript-commits mailing list