mediaText
特性为
MediaList
interface is a stringifier that returns a
DOMString
表示
MediaList
as text, and also allows you to set a new
MediaList
.
mediaListInstance.mediaText; mediaListInstance.mediaText = string;
A
DOMString
representing the media queries of a stylesheet. Each one is separated by a comma, for example
.
If you wish to set new media queries on the document, the string value must have the different queries separated by commas, e.g.
The following would log to the console a textual representation of the
MediaList
of the first stylesheet applied to the current document.
const stylesheets = document.styleSheets; let stylesheet = stylesheets[0]; console.log(stylesheet.media.mediaText);
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Object Model (CSSOM)
The definition of 'mediaText' in that specification. |
工作草案 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
mediaText
|
Chrome Yes | Edge ≤18 | Firefox Yes | IE ? | Opera Yes | Safari Yes | WebView Android Yes | Chrome Android Yes | Firefox Android Yes | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
完整支持
兼容性未知
MediaList
mediaText
AnimationEvent
CSS
CSSConditionRule
CSSGroupingRule
CSSKeyframeRule
CSSKeyframesRule
CSSMediaRule
CSSNamespaceRule
CSSPageRule
CSSRule
CSSRuleList
CSSStyleDeclaration
CSSStyleRule
CSSStyleSheet
CSSSupportsRule
CaretPosition
LinkStyle
MediaQueryList
MediaQueryListListener
Screen
StyleSheet
StyleSheetList
TransitionEvent