跳至主要內容

declaration-property-value-disallowed-list

在宣告中指定不允許的屬性和值配對清單。

a { text-transform: uppercase; }
/** ↑ ↑
* These properties and these values */

message 次要選項可以接受此規則的參數。

選項

object{ "未加前綴的屬性名稱": ["陣列", "of", "值", "/regex/", /regex/]|"值"|"/regex/"|/regex/ }

如果屬性名稱以 "/" 圍繞(例如 "/^animation/"),它會被解釋為正規表示式。這允許輕鬆地鎖定速記,例如:/^animation/ 會比對 animationanimation-durationanimation-timing-function 等。

值也是如此。請記住,正規表示式值會與宣告的整個值比對,而不是特定部分。例如,像 "10px solid rgba( 255 , 0 , 0 , 0.5 )" 這樣的值不會比對 "/^solid/"(注意行開頭邊界),但比對 "/\\s+solid\\s+/""/\\bsolid\\b/"

小心使用正規表示式比對,以免意外考慮引號字串值和 url() 參數。例如,"/red/" 會比對 "1px dotted red" 以及 "\"foo\"""white url(/mysite.com/red.png)" 等值。

已提供

{
"transform": ["/scale3d/", "/rotate3d/", "/translate3d/"],
"position": "fixed",
"color": ["/^green/"],
"/^animation/": ["/ease/"]
}

下列模式被視為問題

a { position: fixed; }
a { transform: scale3d(1, 2, 3); }
a { -webkit-transform: scale3d(1, 2, 3); }
a { color: green; }
a { animation: foo 2s ease-in-out; }
a { animation-timing-function: ease-in-out; }
a { -webkit-animation-timing-function: ease-in-out; }

下列模式不會被視為問題

a { position: relative; }
a { transform: scale(2); }
a { -webkit-transform: scale(2); }
a { color: lightgreen; }
a { animation: foo 2s linear; }
a { animation-timing-function: linear; }
a { -webkit-animation-timing-function: linear; }