Hi,

Adding CSS rules is pretty easy, try something like this:

  // inspired by http://yuiblog.com/blog/2007/06/07/style/
 function addCSS(css) {
    var style = new Element('style', { type: 'text/css', media:
'screen' });
    document.getElementByTagName('head')[0].insert(style);
    if (style.styleSheets) style.styleSheet.cssText = css;
    else style.appendChild(document.createTextNode(css));
  }

On the other hand, removing CSS rules is just nightmarish, as no
browser treats selectors the same way.

Regarding class morphing, script.aculo.us already supports that:

For example, try:
<style>
  .my-class {
    color: #fff;
    background-color: #000;
  }
</style>

$('foo').morph('my-class');

Best,

Tobie

On Jan 5, 5:40 pm, "Ignacio Coloma" <[EMAIL PROTECTED]> wrote:
> As in subject, CSS manipulation is different per browser. Is there any
> plan of including CSS manipulation routines in prototype?
>
> This could help my concrete case (I want to remove a CSS style instead
> of using a selector to remove from each element, which would yield
> less performance) but it has obvious possibilities for script.aculo.us
> (morphing between CSS classes instead of style attributes).
>
> Maybe there is something already there, but I swear I searched the
> source before posting :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to