#16 ✓not_for_core

[Dup Trac #11497] Stylesheet helper $S(n).addCss(expression, cssText)

Reported by poste9 | April 15th, 2008 @ 10:40 PM

This function I used to manipulate my CSS with JavaScript. Of course u can do it better than me, its just a suggestion.


$S(0).addCSS('div#mydivid ul li ',

$S(0) indicates document.styleSheets[0]

function $S(index) {
	index = document.styleSheets[index];
	Object.extend(index, {addCSS : function(seletor,rule) {
			if ( this.insertRule)
			this.insertRule(seletor + '{'+rule+'}', this.cssRules.length);
			else if ( this.addRule )
			this.addRule(seletor, rule, this.rules.length)
	return Element.extend(index);

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins