aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrandon Aaron <brandon.aaron@gmail.com>2009-04-22 04:39:44 +0000
committerBrandon Aaron <brandon.aaron@gmail.com>2009-04-22 04:39:44 +0000
commit8be57929750eac38b0eb331cd99def3d88302cc1 (patch)
treed55dc7cc5afec62561e1f2ae241ccf1053255ab0 /src
parentf5690995dd0d3b3b30410b781e060c5ce55e465f (diff)
downloadjquery-8be57929750eac38b0eb331cd99def3d88302cc1.tar.gz
jquery-8be57929750eac38b0eb331cd99def3d88302cc1.zip
fix for #3546. css now works with other windows than just the one it was loaded in.
Diffstat (limited to 'src')
-rw-r--r--src/css.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/css.js b/src/css.js
index 9551bc949..b8a135005 100644
--- a/src/css.js
+++ b/src/css.js
@@ -1,7 +1,7 @@
// exclude the following css properties to add px
var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
- // cache defaultView
- defaultView = document.defaultView || {},
+ // cache check for defaultView.getComputedStyle
+ getComputedStyle = document.defaultView && document.defaultView.getComputedStyle,
// normalize float css property
styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";
@@ -140,7 +140,7 @@ jQuery.extend({
if ( !force && style && style[ name ] ) {
ret = style[ name ];
- } else if ( defaultView.getComputedStyle ) {
+ } else if ( getComputedStyle ) {
// Only "float" is needed here
if ( /float/i.test( name ) )
@@ -148,7 +148,7 @@ jQuery.extend({
name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
- var computedStyle = defaultView.getComputedStyle( elem, null );
+ var computedStyle = elem.ownerDocument.defaultView.getComputedStyle( elem, null );
if ( computedStyle )
ret = computedStyle.getPropertyValue( name );