feat(css/parser): Normalize URL functions (#6675)

This commit is contained in:
Alexander Akait 2022-12-19 10:53:29 +03:00 committed by GitHub
parent bbeb7c9dbb
commit c01464e452
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 8 additions and 14 deletions

View File

@ -300,12 +300,6 @@ impl VisitMut for NormalizeTest {
n.name.value = n.name.value.to_lowercase().into();
}
fn visit_mut_url(&mut self, n: &mut Url) {
n.visit_mut_children_with(self);
n.name.value = n.name.value.to_lowercase().into();
}
fn visit_mut_pseudo_class_selector(&mut self, n: &mut PseudoClassSelector) {
n.visit_mut_children_with(self);

View File

@ -5,7 +5,7 @@ use super::Compressor;
impl Compressor {
pub(super) fn compress_url(&self, url: &mut Url) {
if !url.name.value.eq_ignore_ascii_case(&js_word!("url")) {
if url.name.value != js_word!("url") {
return;
}

View File

@ -1 +1 @@
@namespace islands url(http://bar.yandex.ru/ui/islands);@namespace islands url(http://bar.yandex.ru/ui/islands);.class1{background:url(https://example.com/image.png)}.class2{background:url(image.png)}.class3{background:url(image.png)}.class4{background:url(image.png)}.class5{background:src("image.png")}.class6,.class7{background:url()}.class8{background:url()}.class9{background:url(image\(.png)}.class10{background:url(image\).png)}.class11{background:url(image\ image.png)}.class12{background:url(image\'image.png)}.class13{background:url(image\"image.png)}.class14{background:url(image.png)}.class16{background:url("image.png"param(var(--foo)))}.class17{background:url("http://website.com/assets_(test).png")}.class18{background:url(test.svg#icon)}.class19{background:url("image.png"param(var(--url,url(image.png))))}.class20{background:src(var(--url))}.class21{background:url(image.png)}
@namespace islands url(http://bar.yandex.ru/ui/islands);@namespace islands url(http://bar.yandex.ru/ui/islands);.class1{background:url(https://example.com/image.png)}.class2,.class3{background:url(image.png)}.class4{background:url(image.png)}.class5{background:src("image.png")}.class6,.class7{background:url()}.class8{background:url()}.class9{background:url(image\(.png)}.class10{background:url(image\).png)}.class11{background:url(image\ image.png)}.class12{background:url(image\'image.png)}.class13{background:url(image\"image.png)}.class14{background:url(image.png)}.class16{background:url("image.png"param(var(--foo)))}.class17{background:url("http://website.com/assets_(test).png")}.class18{background:url(test.svg#icon)}.class19{background:url("image.png"param(var(--url,url(image.png))))}.class20{background:src(var(--url))}.class21{background:url(image.png)}

View File

@ -2576,7 +2576,7 @@ where
let name = Ident {
span: Span::new(span.lo, span.hi - BytePos(1), Default::default()),
value: function_name,
value: function_name.to_ascii_lowercase(),
raw: Some(raw_function_name),
};

View File

@ -412,7 +412,7 @@
"end": 194,
"ctxt": 0
},
"value": "URL",
"value": "url",
"raw": "URL"
},
"value": {

View File

@ -269,7 +269,7 @@
"end": 229,
"ctxt": 0
},
"value": "URL",
"value": "url",
"raw": "URL"
},
"value": {

View File

@ -369,7 +369,7 @@
"end": 291,
"ctxt": 0
},
"value": "URL",
"value": "url",
"raw": "URL"
},
"value": {
@ -419,7 +419,7 @@
"end": 346,
"ctxt": 0
},
"value": "URL",
"value": "url",
"raw": "\\URL"
},
"value": {
@ -1087,7 +1087,7 @@
"end": 948,
"ctxt": 0
},
"value": "SRC",
"value": "src",
"raw": "SRC"
},
"value": {