This project is archived and is in readonly mode.

#360 ✓wontfix
Daniel Steigerwald

Fx.Elements enhancement to accept css classes and arrays.

Reported by Daniel Steigerwald | September 3rd, 2008 @ 07:06 PM | in 2.0 (closed)

Morph accepts also css classes, so there is no reason, why Fx.Elements should not accept them it to. Time to time is useful if methods Fx.Elements methods set and start also accept arrays.


set: function(now) {
	    if ($type(now) == 'array') {
	        now = now.associate(now.map(function(foo,i) { return i }));
	    }
	    for (var i in now) {
	        var iNow = $type(now[i]) == 'string' && this.search(now[i]) || now[i];
	        for (var p in iNow) this.render(this.elements[i], p, iNow[p], this.options.unit);
	    }
	    return this;
	},

	start: function(obj) {
	    if (!this.check(arguments.callee/*, obj - why?*/)) return this;
	    if ($type(obj) == 'array') {
	        obj = obj.associate(obj.map(function(foo,i) { return i }));
	    }
	    var from = {}, to = {};
	    for (var i in obj) {
	        var iProps = $type(obj[i]) == 'string' && this.search(obj[i]) || obj[i], iFrom = from[i] = {}, iTo = to[i] = {};
	        for (var p in iProps) {
	            var parsed = this.prepare(this.elements[i], p, iProps[p]);
	            iFrom[p] = parsed.from;
	            iTo[p] = parsed.to;
	        }
	    }
	    return this.parent(from, to);
	}

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