Skip to content

Instantly share code, notes, and snippets.

@cpojer
Created October 6, 2011 21:49
Show Gist options
  • Save cpojer/1268778 to your computer and use it in GitHub Desktop.
Save cpojer/1268778 to your computer and use it in GitHub Desktop.
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