This project is archived and is in readonly mode.

#17 ✓invalid
Thomas Aylott

Fx.Elements with array support

Reported by Thomas Aylott | May 28th, 2008 @ 10:00 AM

Originally posted on Trac by JanK

Original Trac Ticket

Description

In many cases you want to change all elements of Fx.Elements and its ugly to pass an object like {'0': {}, '1': {}} because an Array like [{}, {}] fits better in this case. This diff adds the array support:

Index: /Users/jan/webdev/moodev/mootools/trunk/Effects/Fx.Elements.js
===================================================================
--- /Users/jan/webdev/moodev/mootools/trunk/Effects/Fx.Elements.js	(revision 855)
+++ /Users/jan/webdev/moodev/mootools/trunk/Effects/Fx.Elements.js	(working copy)
@@ -33,12 +33,12 @@
 	},
 
 	set: function(to){
+		this.css = {};
 		var parsed = {};
-		this.css = {};
-		for (var i in to){
+		$each(to, function(prop, i){
 			var iTo = to[i], iParsed = parsed[i] = {};
 			for (var p in iTo) iParsed[p] = Fx.CSS.set(iTo[p]);
-		}
+		});
 		return this.parent(parsed);
 	},
 
@@ -67,14 +67,14 @@
 		this.now = {};
 		this.css = {};
 		var from = {}, to = {};
-		for (var i in obj){
-			var iProps = obj[i], iFrom = from[i] = {}, iTo = to[i] = {};
-			for (var p in iProps){
-				var parsed = Fx.CSS.prepare(this.elements[i], p, iProps[p]);
-				iFrom[p] = parsed.from;
-				iTo[p] = parsed.to;
+		$each(obj, function(props, i){
+			var curFrom = from[i] = {}, curTo = to[i] = {};
+			for (var p in props){
+				var parsed = Fx.CSS.prepare(this.elements[i], p, props[p]);
+				curFrom[p] = parsed.from;
+				curTo[p] = parsed.to;
 			}
-		}
+		}, this);
 		return this.parent(from, to);
 	},

Trac Attachments

Trac Comments

Changed 9 months ago by ibolmo


        
Will be considered for 1.3's Effects enhancements. 

                  Changed 9 months ago by ibolmo

          milestone
              changed from Mootools version 1.2 to Mootools version 1.3

Will be considered for 1.3's Effects enhancements. 

          milestone
              changed from Mootools version 1.2 to Mootools version 1.3
        
      

Changed 2 weeks ago by tomocchino



                  Changed 2 weeks ago by tomocchino

          owner
            deleted
        
          component
              set to Core
        
          milestone
              set to Mootools version 1.3

          owner
            deleted
        
          component
              set to Core
        
          milestone
              set to Mootools version 1.3
        
      

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Referenced by

Pages