Skip to content
Permalink
Browse files

Fixed getting styles from disconnected nodes. Fixes #7148.

  • Loading branch information...
scottgonzalez committed Oct 11, 2010
1 parent 2866f16 commit 22ccbf82c8badd1d46f5ea52a0a7d5f3935a9fca
Showing with 6 additions and 1 deletion.
  1. +3 −0 src/css.js
  2. +3 −1 test/unit/css.js
@@ -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;
@@ -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'});

0 comments on commit 22ccbf8

Please sign in to comment.
You can’t perform that action at this time.