Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6150169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:34:42+00:00 2026-05-23T19:34:42+00:00

The Question Which JavaScript framework (prototype, script.aculo.us, Mootools, MochiKit…) has decent CSS rule editing

  • 0

The Question

Which JavaScript framework (prototype, script.aculo.us, Mootools, MochiKit…) has decent CSS rule editing support?

This is about changing a style rule. I want to have dynamic CSS classes which change. Example:

<style>
#answer, .reveal { display: none; color: blue; }
#answer { /* additional stuff */ }
</style>

Now, via JavaScript, I want to change the rule that has the “display: none” in it. – I’m convinced that sometimes this is the right way to go; I’m not looking for alternatives, when it is not the right way to do.

Which framework out there makes the following easy:

  1. select a rule from all rules (e.g. “#answer, .reveal”)
  2. what value does the selected rule(s) have for “display”?
  3. delete the “display” property from the rule(s)

(2. and 3. are easy with DOM alone, as long as I get a handle to the CSS rule back from the framework)

The Frameworks which are not good enough:

YUI’s StyleSheet for example can only search for rules in one sheet at a time (limited, but enough for me), but it can’t show, edit or retrieve multi-selector rules like my first example (too limited for my taste).

YUI has also no way to get individual properties (the underlying DOM can, but you can’t get that structure through YUI). You could delete the “display” property alone, though, if you get hold of the rule by YUI means.

Dojo has some badly documented and incomplete stuff under dojox.html.styles

Ext JS has Ext.util.CSS. I checked the code and found a bug in getRule()… It is otherwise pretty sloppy with selector-matching (bad IE influence), which makes it bad for multi-selector rules. It also can’t delete properties through the API, but can give you the CSSRule so you can do it yourself. – The CSS tree walking is as primitive as it could be: no descending on media rules or imports.

PD:

$(‘.reveal’).css(…whatever…) is not the answer, because it does not touch the CSS rules at all (it touches the CSS attributes of some element(s) instead)!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:34:45+00:00Added an answer on May 23, 2026 at 7:34 pm

    None, but please prove me wrong…

    A decent implementation would have to discuss/document the following first:

    • how it walks the CSS tree (including @imports and @media)
    • how the walk can be configured (which @media and which sheets are considered)
    • how cross domain access restrictions are handled/circumvented
    • as CSS has no IDs for the rules itself: only the selector can act as a decent rule identifiers
      • as IE8 and below split up multi-selectors, how smart is the framework to handle this?
      • IE9 is worse (see quirksmode.org)
    • as multiple rules could be selected by one selector, how are they ordered?
    • how can the rule in charge be found from a rule-set knowing the property we want to edit?

    Until the frameworks catch up, consider:

    • get the style/link node where the rule you look for is in
    • use the node.sheet to go to the CSSStyleSheet directly
    • check quirksmode.org for quirks and f… IE
    • loop over the rules to find your rule(s) via known selector
    • DOM CSSStyleRule gives you all the power you need over any style rule
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

General javascript question here, which would also be good to know how(if possible) to
I have a question on javascript window management. My application opens an iframe which
My question is if a developer only knows either Html5/Javascript frameworks/server side JS Framework
I'm using twitter's bootstrap CSS framework (which is fantastic). For some messages to users
I have another question which i think is most easily solved by using javascript
This question is related to another question which I asked yesterday! List all links
I know about this question: Which (third-party) debug visualizers for Visual Studio 2005/2008 do
This question relates to this question which I asked earlier this week. The answer
I was reading this question (which you do not have to read because I
I have a question which is described below: What problems would arise for testing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.