PDA

View Full Version : [3.2.1][DEFER] Ext.util.CSS.updateRule won't work if using @media CSS rule



mankz
24 May 2010, 11:41 PM
If using a @media rule to mix targeted medias in a css file such as:



@media print
{
.myGrid
{
font-size:18px;
}
}

.someOtherClass
{
font-size:12px;
}


Problem: updateRule will not work if an attempt is made to update the .myGrid rule:
since cacheStyleSheet assumes a flat structure:



cacheStyleSheet : function(ss){
if(!rules){
rules = {};
}
try{
var ssRules = ss.cssRules || ss.rules;
for(var j = ssRules.length-1; j >= 0; --j){
// when it breaks, ssRules[j] will be a CSSMediaRule object, not a CSSStyleRule and CSSMediaRule doesn't have a selectorText property.
rules[ssRules[j].selectorText.toLowerCase()] = ssRules[j];
}
}catch(e){}
},


Definitely not a common use case but might still be worth noting :)