Home > Web Front-end > JS Tutorial > body text

Firefox cannot obtain cssRules solution_javascript tips

WBOY
Release: 2016-05-16 19:25:26
Original
1199 people have browsed it

Firefox is too BT, and always adds some boring security permission settings to us. I have been discovering the FF compatibility of Qzone these days. After setting the domain, the cssRules of styleSheets cannot be obtained under FF.
Although the cssRules cannot be obtained, But I was surprised to find that I can actually insert and delete the styles in styleSheets. This is what kind of permissions, it’s boring.

It’s enough to give me insert and delete. Use these two methods You can also update the style. In order to make Firefox compatible with IE. I modified the prototype method of CSSStyleSheet

Copy the code The code is as follows:

CSSStyleSheet.prototype.addRule = function(selectorText,cssText,index){
return this.insertRule(selectorText cssText,index);
}
CSSStyleSheet.prototype.removeRule = CSSStyleSheet.prototype.deleteRule

In this way, firefox can also use IE’s addRule and removeRule.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template