Closed GoogleCodeExporter closed 9 years ago
That's an interesting idea. I will look into it.
Original comment by dean.edw...@gmail.com
on 21 Jun 2009 at 3:59
I've thought about this a little. I don't really want to change the code to
allow non-
behaviors in the rule engine.
How about building a map like this:
var classMap = {
"div.class1": Class1,
"div.class2": Class2,
"div.class3": Class3,
"div.class4": Class4
};
forEach (classMap, function(Class, selector) {
new jsb.Rule(selector, {
onattach: function(element) {
extend(element, Class.prototype);
}
});
});
BTW, did you know that you can use base2 constructors to cast objects?
extend(element, MyClass.prototype);
Is equivalent to:
MyClass(element);
That means that the loop above can be simplified to:
forEach (classMap, function(Class, selector) {
new jsb.Rule(selector, {onattach: Class});
});
Original comment by dean.edw...@gmail.com
on 19 Nov 2009 at 1:21
Original issue reported on code.google.com by
mesco...@gmail.com
on 14 Jun 2009 at 6:29