mirror of
https://github.com/swc-project/swc.git
synced 2024-12-24 14:16:12 +03:00
feat(css/parser): Normalize URL functions (#6675)
This commit is contained in:
parent
bbeb7c9dbb
commit
c01464e452
@ -300,12 +300,6 @@ impl VisitMut for NormalizeTest {
|
|||||||
n.name.value = n.name.value.to_lowercase().into();
|
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) {
|
fn visit_mut_pseudo_class_selector(&mut self, n: &mut PseudoClassSelector) {
|
||||||
n.visit_mut_children_with(self);
|
n.visit_mut_children_with(self);
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ use super::Compressor;
|
|||||||
|
|
||||||
impl Compressor {
|
impl Compressor {
|
||||||
pub(super) fn compress_url(&self, url: &mut Url) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)}
|
||||||
|
@ -2576,7 +2576,7 @@ where
|
|||||||
|
|
||||||
let name = Ident {
|
let name = Ident {
|
||||||
span: Span::new(span.lo, span.hi - BytePos(1), Default::default()),
|
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),
|
raw: Some(raw_function_name),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -412,7 +412,7 @@
|
|||||||
"end": 194,
|
"end": 194,
|
||||||
"ctxt": 0
|
"ctxt": 0
|
||||||
},
|
},
|
||||||
"value": "URL",
|
"value": "url",
|
||||||
"raw": "URL"
|
"raw": "URL"
|
||||||
},
|
},
|
||||||
"value": {
|
"value": {
|
||||||
|
@ -269,7 +269,7 @@
|
|||||||
"end": 229,
|
"end": 229,
|
||||||
"ctxt": 0
|
"ctxt": 0
|
||||||
},
|
},
|
||||||
"value": "URL",
|
"value": "url",
|
||||||
"raw": "URL"
|
"raw": "URL"
|
||||||
},
|
},
|
||||||
"value": {
|
"value": {
|
||||||
|
@ -369,7 +369,7 @@
|
|||||||
"end": 291,
|
"end": 291,
|
||||||
"ctxt": 0
|
"ctxt": 0
|
||||||
},
|
},
|
||||||
"value": "URL",
|
"value": "url",
|
||||||
"raw": "URL"
|
"raw": "URL"
|
||||||
},
|
},
|
||||||
"value": {
|
"value": {
|
||||||
@ -419,7 +419,7 @@
|
|||||||
"end": 346,
|
"end": 346,
|
||||||
"ctxt": 0
|
"ctxt": 0
|
||||||
},
|
},
|
||||||
"value": "URL",
|
"value": "url",
|
||||||
"raw": "\\URL"
|
"raw": "\\URL"
|
||||||
},
|
},
|
||||||
"value": {
|
"value": {
|
||||||
@ -1087,7 +1087,7 @@
|
|||||||
"end": 948,
|
"end": 948,
|
||||||
"ctxt": 0
|
"ctxt": 0
|
||||||
},
|
},
|
||||||
"value": "SRC",
|
"value": "src",
|
||||||
"raw": "SRC"
|
"raw": "SRC"
|
||||||
},
|
},
|
||||||
"value": {
|
"value": {
|
||||||
|
Loading…
Reference in New Issue
Block a user