Skip to content

Commit dbaecf0

Browse files
committed
Effects: Cleaned up getElementStyles().
1 parent f587071 commit dbaecf0

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

ui/jquery.ui.effect.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -700,32 +700,31 @@ $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopS
700700
};
701701
});
702702

703-
function getElementStyles() {
704-
var style = this.ownerDocument.defaultView ?
705-
this.ownerDocument.defaultView.getComputedStyle( this, null ) :
706-
this.currentStyle,
707-
newStyle = {},
708-
key,
709-
len;
710-
711-
// webkit enumerates style porperties
703+
function getElementStyles( elem ) {
704+
var key, len,
705+
style = elem.ownerDocument.defaultView ?
706+
elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
707+
elem.currentStyle,
708+
styles = {};
709+
712710
if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
713711
len = style.length;
714712
while ( len-- ) {
715713
key = style[ len ];
716714
if ( typeof style[ key ] === "string" ) {
717-
newStyle[ $.camelCase( key ) ] = style[ key ];
715+
styles[ $.camelCase( key ) ] = style[ key ];
718716
}
719717
}
718+
// support: Opera, IE <9
720719
} else {
721720
for ( key in style ) {
722721
if ( typeof style[ key ] === "string" ) {
723-
newStyle[ key ] = style[ key ];
722+
styles[ key ] = style[ key ];
724723
}
725724
}
726725
}
727726

728-
return newStyle;
727+
return styles;
729728
}
730729

731730

@@ -761,7 +760,7 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
761760
var el = $( this );
762761
return {
763762
el: el,
764-
start: getElementStyles.call( this )
763+
start: getElementStyles( this )
765764
};
766765
});
767766

@@ -777,7 +776,7 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
777776

778777
// map all animated objects again - calculate new styles and diff
779778
allAnimations = allAnimations.map(function() {
780-
this.end = getElementStyles.call( this.el[ 0 ] );
779+
this.end = getElementStyles( this.el[ 0 ] );
781780
this.diff = styleDifference( this.start, this.end );
782781
return this;
783782
});

0 commit comments

Comments
 (0)