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

  • SEARCH
  • Home
  • 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 9066261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:41:47+00:00 2026-06-16T16:41:47+00:00

According to MDN ( https://developer.mozilla.org/en-US/docs/DOM/CSSStyleRule ) The CSSStyleRule object’s style property is read-only. Is

  • 0

According to MDN (https://developer.mozilla.org/en-US/docs/DOM/CSSStyleRule) The CSSStyleRule object’s style property is read-only. Is there a way to be able to reliably modify its style attributes in modern browsers (mainly chrome/safari and firefox, but IE9 would be nice too)?

Semi-related question but is there any way to access comments that are inside of the style rule (edit: and know which rule/selector the comment “belongs” to)? i.e. for this rule:

.my-rule {
    /* A Comment */
    color: blue;
}

I want to be able to retrieve the /* A Comment */ via javascript.

  • 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-06-16T16:41:48+00:00Added an answer on June 16, 2026 at 4:41 pm

    Here is the UPDATED DEMO

    JavaScript :

    var styles = document.getElementsByTagName('style')[0].textContent;
    var comments =  styles.match(/\/\*.*\*\//g);
    console.log(comments);
    

    UPDATE

    Since the OP wanted relations with comments, use this code instead :

    var styles = document.getElementsByTagName('style')[0].textContent;
    var objItems = {};
    var arrItems = styles.split('}');
    arrItems.pop();
    
    for (var i = 0; i < arrItems.length; i++) {
        var grp = arrItems[i].split('{');
        objItems[$.trim(grp[0])] = arrItems[i].match(/\/\*.*\*\//g);
    }
    
    for(var i in objItems) {
          console.log(i + ': [ ' + objItems[i] + ' ]');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to https://issues.sonatype.org/browse/OSSRH-3293 Maven m2e Code-Style and Save-Actions connector This plugin is executed inside
According to this MDN page , the delete keyword Returns false only if the
According to (my reading of) the official dox here: https://docs.djangoproject.com/en/dev/ref/models/querysets/#when-querysets-are-evaluated a Django QuerySet should
according to mdn documentation the method removeChild removes a node from the DOM but
According to the MDN wiki, DOMContentLoaded will fire when page's DOM is ready, [although]
According to https://developers.google.com/fusiontables/docs/developers_reference OR operations are not allowed as part of filter conditions. So
According this article , generic JPA DAO(Data Access Object) is a pretty nice pattern.
According to docs at http://code.google.com/p/minify/wiki/UriRewriting $min_serveOptions['rewriteCssUris'] = false; I should be able to add
According to the MDN JS Doc , the charAt method takes in an integer
According to the App Engine docs, you wrap a datstore event in a transaction

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.