Here are the rules applied to this page:
  .importantTest { color: red !important }
  .test { color: red; background: white ! important }
  .test2 { color: red; }

Here is the script that runs onload:
  var rules = document.styleSheets.item(0).cssRules;
  rules.item(1).style.setProperty("color", "green", "important");
  rules.item(2).style.setProperty("color", "green", "important");

Everything below here should be green:
<span class="test importantTest">
<span class="test2 importantTest">