scratch – Diff between revs 58 and 125

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 58 Rev 125
Line 1... Line 1...
1 define( [ 1 define([
2 "../core", 2 "../core",
3 "../css" 3 "../css"
4 ], function( jQuery ) { 4 ], function( jQuery ) {
Line 5... Line -...
5   -  
6 "use strict"; -  
7   5  
8 function Tween( elem, options, prop, end, easing ) { 6 function Tween( elem, options, prop, end, easing ) {
9 return new Tween.prototype.init( elem, options, prop, end, easing ); 7 return new Tween.prototype.init( elem, options, prop, end, easing );
10 } 8 }
Line 11... Line 9...
11 jQuery.Tween = Tween; 9 jQuery.Tween = Tween;
12   10  
13 Tween.prototype = { 11 Tween.prototype = {
14 constructor: Tween, 12 constructor: Tween,
15 init: function( elem, options, prop, end, easing, unit ) { 13 init: function( elem, options, prop, end, easing, unit ) {
16 this.elem = elem; 14 this.elem = elem;
17 this.prop = prop; 15 this.prop = prop;
18 this.easing = easing || jQuery.easing._default; 16 this.easing = easing || "swing";
19 this.options = options; 17 this.options = options;
20 this.start = this.now = this.cur(); 18 this.start = this.now = this.cur();
21 this.end = end; 19 this.end = end;
Line 59... Line 57...
59 Tween.propHooks = { 57 Tween.propHooks = {
60 _default: { 58 _default: {
61 get: function( tween ) { 59 get: function( tween ) {
62 var result; 60 var result;
Line 63... Line -...
63   -  
64 // Use a property on the element directly when it is not a DOM element, -  
65 // or when there is no matching style property that exists. 61  
66 if ( tween.elem.nodeType !== 1 || 62 if ( tween.elem[ tween.prop ] != null &&
67 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 63 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
68 return tween.elem[ tween.prop ]; 64 return tween.elem[ tween.prop ];
Line 69... Line 65...
69 } 65 }
70   66  
71 // Passing an empty string as a 3rd parameter to .css will automatically 67 // Passing an empty string as a 3rd parameter to .css will automatically
72 // attempt a parseFloat and fallback to a string if the parse fails. 68 // attempt a parseFloat and fallback to a string if the parse fails.
73 // Simple values such as "10px" are parsed to Float; 69 // Simple values such as "10px" are parsed to Float;
74 // complex values such as "rotate(1rad)" are returned as-is. -  
75 result = jQuery.css( tween.elem, tween.prop, "" ); 70 // complex values such as "rotate(1rad)" are returned as-is.
76   71 result = jQuery.css( tween.elem, tween.prop, "" );
77 // Empty strings, null, undefined and "auto" are converted to 0. 72 // Empty strings, null, undefined and "auto" are converted to 0.
78 return !result || result === "auto" ? 0 : result; 73 return !result || result === "auto" ? 0 : result;
79 }, -  
80 set: function( tween ) { 74 },
81   75 set: function( tween ) {
82 // Use step hook for back compat. 76 // Use step hook for back compat.
83 // Use cssHook if its there. 77 // Use cssHook if its there.
84 // Use .style if available and use plain properties where available. 78 // Use .style if available and use plain properties where available.
85 if ( jQuery.fx.step[ tween.prop ] ) { -  
86 jQuery.fx.step[ tween.prop ]( tween ); 79 if ( jQuery.fx.step[ tween.prop ] ) {
87 } else if ( tween.elem.nodeType === 1 && -  
88 ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || 80 jQuery.fx.step[ tween.prop ]( tween );
89 jQuery.cssHooks[ tween.prop ] ) ) { 81 } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
90 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 82 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
91 } else { 83 } else {
92 tween.elem[ tween.prop ] = tween.now; 84 tween.elem[ tween.prop ] = tween.now;
93 } 85 }
94 } 86 }
Line 95... Line 87...
95 } 87 }
96 }; 88 };
97   89  
98 // Support: IE <=9 only 90 // Support: IE9
99 // Panic based approach to setting things on disconnected nodes 91 // Panic based approach to setting things on disconnected nodes
100 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 92 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
Line 109... Line 101...
109 linear: function( p ) { 101 linear: function( p ) {
110 return p; 102 return p;
111 }, 103 },
112 swing: function( p ) { 104 swing: function( p ) {
113 return 0.5 - Math.cos( p * Math.PI ) / 2; 105 return 0.5 - Math.cos( p * Math.PI ) / 2;
114 }, 106 }
115 _default: "swing" -  
116 }; 107 };
Line 117... Line 108...
117   108  
Line 118... Line 109...
118 jQuery.fx = Tween.prototype.init; 109 jQuery.fx = Tween.prototype.init;
119   110  
Line 120... Line 111...
120 // Back compat <1.8 extension point 111 // Back Compat <1.8 extension point