Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Effects: Cleaned up getElementStyles().

  • Loading branch information...
commit dbaecf0ede6e8dcd6e80adfb2bd8826ddd648136 1 parent f587071
Scott González authored November 09, 2012

Showing 1 changed file with 13 additions and 14 deletions. Show diff stats Hide diff stats

  1. 27  ui/jquery.ui.effect.js
27  ui/jquery.ui.effect.js
@@ -700,32 +700,31 @@ $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopS
700 700
 	};
701 701
 });
702 702
 
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
+
712 710
 	if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
713 711
 		len = style.length;
714 712
 		while ( len-- ) {
715 713
 			key = style[ len ];
716 714
 			if ( typeof style[ key ] === "string" ) {
717  
-				newStyle[ $.camelCase( key ) ] = style[ key ];
  715
+				styles[ $.camelCase( key ) ] = style[ key ];
718 716
 			}
719 717
 		}
  718
+	// support: Opera, IE <9
720 719
 	} else {
721 720
 		for ( key in style ) {
722 721
 			if ( typeof style[ key ] === "string" ) {
723  
-				newStyle[ key ] = style[ key ];
  722
+				styles[ key ] = style[ key ];
724 723
 			}
725 724
 		}
726 725
 	}
727 726
 
728  
-	return newStyle;
  727
+	return styles;
729 728
 }
730 729
 
731 730
 
@@ -761,7 +760,7 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
761 760
 			var el = $( this );
762 761
 			return {
763 762
 				el: el,
764  
-				start: getElementStyles.call( this )
  763
+				start: getElementStyles( this )
765 764
 			};
766 765
 		});
767 766
 
@@ -777,7 +776,7 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
777 776
 
778 777
 		// map all animated objects again - calculate new styles and diff
779 778
 		allAnimations = allAnimations.map(function() {
780  
-			this.end = getElementStyles.call( this.el[ 0 ] );
  779
+			this.end = getElementStyles( this.el[ 0 ] );
781 780
 			this.diff = styleDifference( this.start, this.end );
782 781
 			return this;
783 782
 		});

0 notes on commit dbaecf0

Please sign in to comment.
Something went wrong with that request. Please try again.