过时
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.
rules
是
弃用
legacy property
的
CSSStyleSheet
interface. Functionally identical to the preferred
cssRules
property, it provides access to a live-updating list of the CSS rules comprising the stylesheet.
注意:
As a legacy property, you not use
rules
and should instead use the preferred
cssRules
. While
rules
is unlikely to be removed soon, its availability is not as widespread and using it will result in compatibility problems for your site or app.
var rules = cssStyleSheet.rules;
A live-updating
CSSRuleList
containing each of the CSS rules making up the stylesheet. Each entry in the rule list is a
CSSRule
object describing one rule making up the stylesheet.
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Object Model (CSSOM)
The definition of 'CSSStyleSheet.rules' in that specification. |
工作草案 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
rules
弃用
|
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
AnimationEvent
CSS
CSSConditionRule
CSSGroupingRule
CSSKeyframeRule
CSSKeyframesRule
CSSMediaRule
CSSNamespaceRule
CSSPageRule
CSSRule
CSSRuleList
CSSStyleDeclaration
CSSStyleRule
CSSSupportsRule
CaretPosition
LinkStyle
MediaQueryList
MediaQueryListListener
Screen
StyleSheet
StyleSheetList
TransitionEvent