CSSStyleDeclaration getPropertyPriority ()メソッド
例
colorプロパティに「重要」があるかどうかを返します。優先順位セット:
var declaration = document.styleSheets[0].cssRules[0].style;
var
priority = declaration.getPropertyPriority("color");
alert(priority);
定義と使用法
getPropertyPriority()メソッドは、指定されたCSSプロパティに「important!」があるかどうかを返します。優先順位を設定します。
このメソッドが「important」を返す場合、重要な修飾子が設定されます。
このメソッドが空の文字列を返す場合、重要な修飾子は設定されていません。
ブラウザのサポート
Method | |||||
---|---|---|---|---|---|
getPropertyPriority() | Yes | 9.0 | Yes | Yes | Yes |
構文
object.getPropertyPriority(propertyname)
パラメータ値
Parameter | Description |
---|---|
propertyname | Required. A String representing the name of the property to check |
技術的な詳細
DOMバージョン: | CSSオブジェクトモデル |
---|---|
戻り値: | 優先度を表す文字列、または存在しない場合は空の文字列 |
❮CSSStyleDeclarationオブジェクト