Created
October 6, 2011 21:49
-
-
Save cpojer/1268778 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Element.implement('alter', function(properties){ | |
var parsed = Slick.parse(properties).expressions[0][0], | |
attributes = parsed.attributes, | |
classList = parsed.classList, | |
i, attr, value; | |
if (attributes) for (i = 0; i < attributes.length; i++){ | |
attr = attributes[i]; | |
value = null; | |
if (attr.value != null && attr.operator == '=') value = attr.value; | |
else if (!attr.value && !attr.operator) value = true; | |
this.set(attr.key, value); | |
} | |
if (classList) for (i = 0; i < classList.length; i++) { | |
this.addClass(classList[i]); | |
} | |
return this; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment