I am working heavily in jQuery UI widgets and theming is becoming hard because of an oversight that I need to work around.
Consider this problem:
<div id="node" class="ui-widget">
<div class="ui-widget-content">
</div>
</div>
Then this jQuery code:
<script>
$(function() {
$('#node').hover(function (){
$(this).toggleClass("ui-state-error");
});
});
</script>
I would like the ui-state-error to be !important to the nested div. This is pseudocode, but I find large examples of this happening where containers have CSS swaps and children (basically) ignore it.
What is even worse is this: if I would like to be able to overwrite in jQuery, say, "backgroundcolor=ui-state-error:background-color knowing 100% it all won't go to pieces, because I don't "know" necessarily that that background is the important one for the element in question.
Here is a fiddle of a case in point: http://jsfiddle.net/WCuYH/1/
!important
is to add the!important
declaration after each property setting in the CSS. What was the oversight? – Hembreea:hover
beforea
, the properties ina:hover
that are also specified ina
will not apply, because the rules ina
overrides the rules ina:hover
. – Crushclass
level of specificity just the style therin (so I would consider that a oversight feature) since specificity is not fully mature yet (i.e no negation, no exposing of the applied style in situ, no specificity cascade opt-out or controls etc etc) – Piezoelectricity!important
has absolutely nothing to do with specificity anyway. – Osorio