Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 1e56fb4ec0
Fetching contributors…

Cannot retrieve contributors at this time

35 lines (23 sloc) 1.426 kb
category
about

You don't need to use JavaScript to take advantage of CleanSlate. However, if you do want to manipulate a CleanSlated element with JavaScript, then you will find that you cannot change its styles by manipulating the elem.style object, as you might normally. Instead, you will need to edit its elem.style.cssText property, or change its style attribute.

E.g. elem.style.border = "red"; // won't work elem.style.border = "red !important"; // won't work elem.style.cssText = "border: red !important"; // WILL work elem.setAttribute("style", "border: red !important"); // WILL work // jQuery(elem).css("border", "red"); // won't work jQuery(elem).css("border", "red !important"); // won't work jQuery(elem).attr("style", "border: red !important"); // WILL work

If you are using jQuery, you can use the "'Important' plugin":https://github.com/premasagar/important to make this process much more easy. With this, you can add true as a third argument to the css() method:

jQuery(elem).css("border", "red", true);

or turn on !important handling by default:

jQuery.important();
jQuery(elem).css("border", "red");

or make an element's styles use !important:

jQuery(elem).important();

or not:

jQuery(elem).important(false);

...amongst other useful features.

Jump to Line
Something went wrong with that request. Please try again.