Skip to content
Permalink
Browse files

Streamline getComputedStyle per @JustinDrake's observation.

  • Loading branch information...
dmethvin committed Nov 6, 2011
1 parent f35ba5e commit 262c32a70e1f14e5addd263af2f868525aab03c8
Showing with 2 additions and 5 deletions.
  1. +2 −5 src/css.js
@@ -268,11 +268,8 @@ if ( document.defaultView && document.defaultView.getComputedStyle ) {

name = name.replace( rupper, "-$1" ).toLowerCase();

if ( !(defaultView = elem.ownerDocument.defaultView) ) {
return undefined;
}

if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
if ( (defaultView = elem.ownerDocument.defaultView) &&
(computedStyle = defaultView.getComputedStyle( elem, null )) ) {
ret = computedStyle.getPropertyValue( name );
if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
ret = jQuery.style( elem, name );

2 comments on commit 262c32a

@mikesherov

This comment has been minimized.

Copy link
Member

mikesherov replied Nov 6, 2011

Actually, instead of inlining it, couldn't you move it above the name = line to avoid unnecessary calcs? Or is the inlining byte saving more important?

@dmethvin

This comment has been minimized.

Copy link
Member Author

dmethvin replied Nov 6, 2011

My guess was that we'll have those two in most situations, so the code to decamelize name will be needed in most cases. Plus the bytes thing.

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.