CSSStyleDeclaration getPropertyPriority() 方法
定义和用法
getPropertyPriority()
方法返回指定的 CSS 属性是否具有 "important!" 优先设置。
如果此方法返回 "important!",则设置了重要限定符。
如果此方法返回空字符串,则不设置重要限定符。
实例
返回颜色属性是否具有 "important!" 优先设置:
var declaration = document.styleSheets[0].cssRules[0].style; var priority = declaration.getPropertyPriority("color"); alert(priority);
语法
object.getPropertyPriority(propertyname)
Parameters
Parameters | Description |
---|---|
propertyname | Required. String, representing the name of the property to check. |
Technical Details
DOM Version: | CSS Object Model |
---|---|
Return value: | String representing priority, if not present, it is an empty string. |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 9.0 | Support | Support | Support |