function-url-scheme-disallowed-list
指定不允许的 URL 方案的列表。
¥Specify a list of disallowed URL schemes.
a { background-image: url('http://www.example.com/file.jpg'); }
/** ↑
* This URL scheme */
网址方案 由字母数字、+、- 和 . 字符组成。它可以出现在 URL 的开头,后跟 :。
¥A URL scheme consists of alphanumeric, +, -, and . characters. It can appear at the start of a URL and is followed by :.
该规则忽略了:
¥This rule ignores:
-
没有现有 URL 方案的 URL 参数
¥URL arguments without an existing URL scheme
-
带有变量或变量插值的 URL 参数(
$sass、@less、--custom-property、#{$var}、@{var}、$(var))¥URL arguments with variables or variable interpolation (
$sass,@less,--custom-property,#{$var},@{var},$(var))
选项
¥Options
Array<string>
["array", "of", "schemes", "/regex/"]
鉴于:
¥Given:
{
"function-url-scheme-disallowed-list": ["ftp", "/^http/"]
}
以下模式被视为问题:
¥The following patterns are considered problems:
a { background-image: url('ftp://www.example.com/file.jpg'); }
a { background-image: url('http://www.example.com/file.jpg'); }
a { background-image: url('https://www.example.com/file.jpg'); }
以下模式不被视为问题:
¥The following patterns are not considered problems:
a { background-image: url('data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs='); }
a { background-image: url('example.com/file.jpg'); }
a { background-image: url('/example.com/file.jpg'); }
a { background-image: url('//example.com/file.jpg'); }
a { background-image: url('./path/to/file.jpg'); }