]> source.dussan.org Git - jquery.git/commitdiff
CSS: fix for disconnected elems on doc fragments in Opera 12
authorTimmy Willison <timmywillisn@gmail.com>
Mon, 22 Feb 2016 16:24:52 +0000 (11:24 -0500)
committerTimmy Willison <timmywillisn@gmail.com>
Mon, 22 Feb 2016 16:30:18 +0000 (11:30 -0500)
src/css/curCSS.js

index be643ab547c49a286c422b2b18bdf0455249e0c9..084f8c7bde35862034eb252bc02014840c0aaacd 100644 (file)
@@ -12,15 +12,18 @@ function curCSS( elem, name, computed ) {
                style = elem.style;
 
        computed = computed || getStyles( elem );
+       ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
+
+       // Support: Opera 12.1x only
+       // Fall back to style even without computed
+       // computed is undefined for elems on document fragments
+       if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) {
+               ret = jQuery.style( elem, name );
+       }
 
        // Support: IE9
        // getPropertyValue is only needed for .css('filter') (#12537)
        if ( computed ) {
-               ret = computed.getPropertyValue( name ) || computed[ name ];
-
-               if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
-                       ret = jQuery.style( elem, name );
-               }
 
                // A tribute to the "awesome hack by Dean Edwards"
                // Android Browser returns percentage for some values,