aboutsummaryrefslogtreecommitdiffstats
path: root/src/css.js
diff options
context:
space:
mode:
authorRick Waldron <waldron.rick@gmail.com>2012-06-18 13:26:46 -0400
committerRick Waldron <waldron.rick@gmail.com>2012-06-18 13:27:04 -0400
commitf7ee1f6e59f0b465f5f64bf6ac52108e445efaac (patch)
treec5d0eb3ea5b9ba11fa8d8e0e9bfe97f34fca9cdf /src/css.js
parentab542c11cafd494e15bd84df3958a5e8876f02fe (diff)
downloadjquery-f7ee1f6e59f0b465f5f64bf6ac52108e445efaac.tar.gz
jquery-f7ee1f6e59f0b465f5f64bf6ac52108e445efaac.zip
Update document.defaultView.getComputedStyle. Fixes #10373
Diffstat (limited to 'src/css.js')
-rw-r--r--src/css.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/css.js b/src/css.js
index d23284a1c..ac70a98d0 100644
--- a/src/css.js
+++ b/src/css.js
@@ -274,15 +274,17 @@ jQuery.extend({
}
});
-if ( document.defaultView && document.defaultView.getComputedStyle ) {
+// NOTE: To any future maintainer, we've used both window.getComputedStyle
+// and window.getComputedStyle here to produce a better gzip size
+if ( window.getComputedStyle ) {
curCSS = function( elem, name ) {
- var ret, defaultView, computedStyle, width,
+ var ret, width,
+ computed = getComputedStyle( elem, null ),
style = elem.style;
- if ( (defaultView = elem.ownerDocument.defaultView) &&
- (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
+ if ( computed ) {
- ret = computedStyle[ name ];
+ ret = computed[ name ];
if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
ret = jQuery.style( elem, name );
}
@@ -293,7 +295,7 @@ if ( document.defaultView && document.defaultView.getComputedStyle ) {
if ( !jQuery.support.pixelMargin && rmargin.test( name ) && rnumnonpx.test( ret ) ) {
width = style.width;
style.width = ret;
- ret = computedStyle.width;
+ ret = computed.width;
style.width = width;
}
}