Advertisement
Guest User

Thomas Rutten

a guest
Dec 23rd, 2010
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {css: function(property, value){
  2.       if (value === undefined && typeof property == 'string') return this.dom[0].style[camelize(property)];
  3.       css = "";
  4.             var remove = [];
  5.       for (key in property)
  6.             {
  7.                 if (!property[key])
  8.                 {
  9.                     remove.push(key);
  10.                 }
  11.                 else
  12.                     css += key + ':' + property[key] + ';';
  13.             }
  14.       if (typeof property == 'string') css = property + ":" + value;
  15.       if (remove.length){
  16.                 var regExpr = new RegExp('(('+remove.join('|') + ')[^;]*)', "g");
  17.             }
  18.             return this.each(function(element) {
  19.                 cssText = element.style.cssText + ';';
  20.                 if (remove) {
  21.                     cssText = cssText.replace(regExpr,''); //remove unchecked css nodes
  22.                 }
  23.                 cssText += css;
  24.                 element.style.cssText = cssText;
  25.             });
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement