]> source.dussan.org Git - jquery.git/commitdiff
Support: Skip style-based tests when element.style is undefined
authorRichard Gibson <richard.gibson@gmail.com>
Thu, 13 Feb 2014 22:51:57 +0000 (14:51 -0800)
committerRichard Gibson <richard.gibson@gmail.com>
Thu, 13 Feb 2014 22:57:20 +0000 (14:57 -0800)
Fixes #14785
Ref #13754
Ref badcd1b6f301e6253405f17759c1270549a34e12

src/css/support.js
src/effects/support.js

index da9ee34f113941598c073a5217f8047cca8a948a..2b525ebf6aa36ea11e415bcaf9cbf6e6cdbc6d5f 100644 (file)
@@ -17,12 +17,16 @@ define([
        div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
        a = div.getElementsByTagName( "a" )[ 0 ];
 
+       // Finish early in limited (non-browser) environments
+       if ( !a || !a.style ) {
+               return;
+       }
+
        a.style.cssText = "float:left;opacity:.5";
 
-       // Make sure that element opacity exists
-       // (IE uses filter instead)
-       // Use a regex to work around a WebKit issue. See #5145
-       support.opacity = /^0.5/.test( a.style.opacity );
+       // Support: IE<9
+       // Make sure that element opacity exists (as opposed to filter)
+       support.opacity = a.style.opacity === "0.5";
 
        // Verify style float existence
        // (IE uses styleFloat instead of cssFloat)
index 85b77c9ccadb5499b6451fd4fc366046a07ddc3a..1faf1110f269df29bff08aec437a2499be933a2e 100644 (file)
@@ -15,12 +15,16 @@ define([
        div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
        a = div.getElementsByTagName( "a" )[ 0 ];
 
+       // Finish early in limited (non-browser) environments
+       if ( !a || !a.style ) {
+               return;
+       }
+
        a.style.cssText = "float:left;opacity:.5";
 
-       // Make sure that element opacity exists
-       // (IE uses filter instead)
-       // Use a regex to work around a WebKit issue. See #5145
-       support.opacity = /^0.5/.test( a.style.opacity );
+       // Support: IE<9
+       // Make sure that element opacity exists (as opposed to filter)
+       support.opacity = a.style.opacity === "0.5";
 
        // Verify style float existence
        // (IE uses styleFloat instead of cssFloat)