fix for #3546. css now works with other windows than just the one it was loaded in.

This commit is contained in:
Brandon Aaron 2009-04-22 04:39:44 +00:00
parent f5690995dd
commit 8be5792975

View file

@ -1,7 +1,7 @@
// exclude the following css properties to add px // exclude the following css properties to add px
var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
// cache defaultView // cache check for defaultView.getComputedStyle
defaultView = document.defaultView || {}, getComputedStyle = document.defaultView && document.defaultView.getComputedStyle,
// normalize float css property // normalize float css property
styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat"; styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";
@ -140,7 +140,7 @@ jQuery.extend({
if ( !force && style && style[ name ] ) { if ( !force && style && style[ name ] ) {
ret = style[ name ]; ret = style[ name ];
} else if ( defaultView.getComputedStyle ) { } else if ( getComputedStyle ) {
// Only "float" is needed here // Only "float" is needed here
if ( /float/i.test( name ) ) if ( /float/i.test( name ) )
@ -148,7 +148,7 @@ jQuery.extend({
name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
var computedStyle = defaultView.getComputedStyle( elem, null ); var computedStyle = elem.ownerDocument.defaultView.getComputedStyle( elem, null );
if ( computedStyle ) if ( computedStyle )
ret = computedStyle.getPropertyValue( name ); ret = computedStyle.getPropertyValue( name );