过时
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
过时
CSSStyleSheet
方法
removeRule()
removes a rule from the stylesheet object.
It is functionally identical to the standard, preferred method
deleteRule()
.
注意:
这是
legacy method
which has been replaced by the standard method
deleteRule()
. You should use that instead.
cssStyleSheet.removeRule(index)
index
CSSRuleList
indicating the rule to be removed.
undefined
This example removes the first rule from the stylesheet
myStyles
.
myStyles.removeRule(0);
You can rewrite this to use the standard
deleteRule()
method very easily:
myStyles.deleteRule(0);
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Object Model (CSSOM)
The definition of 'CSSStyleSheet.removeRule()' in that specification. |
工作草案 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
removeRule()
弃用
|
Chrome Yes | Edge 12 | Firefox 68 | IE 9 | Opera Yes | Safari Yes | WebView Android Yes | Chrome Android Yes | Firefox Android 68 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
完整支持
弃用。不要用于新网站。
CSSStyleSheet
addRule()
deleteRule()
insertRule()
removeRule()
AnimationEvent
CSS
CSSConditionRule
CSSGroupingRule
CSSKeyframeRule
CSSKeyframesRule
CSSMediaRule
CSSNamespaceRule
CSSPageRule
CSSRule
CSSRuleList
CSSStyleDeclaration
CSSStyleRule
CSSSupportsRule
CaretPosition
LinkStyle
MediaQueryList
MediaQueryListListener
Screen
StyleSheet
StyleSheetList
TransitionEvent