Merge branch 'bug7141' of http://github.com/csnover/jquery into csnover-bug7141
authorJohn Resig <jeresig@gmail.com>
Mon, 11 Oct 2010 20:40:10 +0000 (16:40 -0400)
committerJohn Resig <jeresig@gmail.com>
Mon, 11 Oct 2010 20:40:10 +0000 (16:40 -0400)
src/css.js
test/unit/css.js

index d0e55db..933d2b4 100644 (file)
@@ -230,6 +230,9 @@ if ( getComputedStyle ) {
 
                if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
                        ret = computedStyle.getPropertyValue( name );
+                       if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
+                               ret = jQuery.style( elem, name );
+                       }
                }
 
                return ret;
index 8a49096..632464b 100644 (file)
@@ -1,7 +1,7 @@
 module("css");
 
 test("css(String|Hash)", function() {
-       expect(33);
+       expect(34);
 
        equals( jQuery('#main').css("display"), 'block', 'Check for css property "display"');
 
@@ -19,6 +19,8 @@ test("css(String|Hash)", function() {
        equals( parseFloat(jQuery('#nothiddendiv').css('width')), width, 'Test negative width ignored')
        equals( parseFloat(jQuery('#nothiddendiv').css('height')), height, 'Test negative height ignored')
 
+       equals( jQuery('<div style="display: none;">').css('display'), 'none', 'Styles on disconnected nodes');
+
        jQuery('#floatTest').css({'float': 'right'});
        equals( jQuery('#floatTest').css('float'), 'right', 'Modified CSS float using "float": Assert float is right');
        jQuery('#floatTest').css({'font-size': '30px'});