Skip to content

Commit 97891d8

Browse files
committed
Fix parsing list-style shorthand
list-style-type should be parsed last since it allows custom keywords. Fixes #867
1 parent d45cf88 commit 97891d8

File tree

2 files changed

+36
-9
lines changed

2 files changed

+36
-9
lines changed

src/lib.rs

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16380,7 +16380,7 @@ mod tests {
1638016380
);
1638116381
minify_test(
1638216382
".foo { list-style: \"★\" url(ellipse.png) outside; }",
16383-
".foo{list-style:\"★\" url(ellipse.png)}",
16383+
".foo{list-style:url(ellipse.png) \"★\"}",
1638416384
);
1638516385

1638616386
test(
@@ -16421,7 +16421,7 @@ mod tests {
1642116421
"#,
1642216422
indoc! {r#"
1642316423
.foo {
16424-
list-style: \"★\" url("ellipse.png");
16424+
list-style: url("ellipse.png") \"★\";
1642516425
list-style-image: var(--img);
1642616426
}
1642716427
"#},
@@ -16447,8 +16447,8 @@ mod tests {
1644716447
".foo { list-style: \"★\" linear-gradient(lch(56.208% 136.76 46.312), lch(51% 135.366 301.364)) }",
1644816448
indoc! { r#"
1644916449
.foo {
16450-
list-style: "★" linear-gradient(#ff0f0e, #7773ff);
16451-
list-style: "★" linear-gradient(lch(56.208% 136.76 46.312), lch(51% 135.366 301.364));
16450+
list-style: linear-gradient(#ff0f0e, #7773ff) "★";
16451+
list-style: linear-gradient(lch(56.208% 136.76 46.312), lch(51% 135.366 301.364)) "★";
1645216452
}
1645316453
"#},
1645416454
Browsers {
@@ -16475,6 +16475,33 @@ mod tests {
1647516475
..Browsers::default()
1647616476
},
1647716477
);
16478+
16479+
test(
16480+
r#"
16481+
.foo {
16482+
list-style: inside;
16483+
list-style-type: disc;
16484+
}
16485+
"#,
16486+
indoc! {r#"
16487+
.foo {
16488+
list-style: inside;
16489+
}
16490+
"#},
16491+
);
16492+
test(
16493+
r#"
16494+
.foo {
16495+
list-style: inside;
16496+
list-style-type: decimal;
16497+
}
16498+
"#,
16499+
indoc! {r#"
16500+
.foo {
16501+
list-style: inside decimal;
16502+
}
16503+
"#},
16504+
);
1647816505
}
1647916506

1648016507
#[test]

src/properties/list.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,13 +332,13 @@ enum_property! {
332332
shorthand_property! {
333333
/// A value for the [list-style](https://www.w3.org/TR/2020/WD-css-lists-3-20201117/#list-style-property) shorthand property.
334334
pub struct ListStyle<'i> {
335-
/// The list style type.
336-
#[cfg_attr(feature = "serde", serde(borrow))]
337-
list_style_type: ListStyleType(ListStyleType<'i>),
338-
/// The list marker image.
339-
image: ListStyleImage(Image<'i>),
340335
/// The position of the list marker.
341336
position: ListStylePosition(ListStylePosition),
337+
/// The list marker image.
338+
#[cfg_attr(feature = "serde", serde(borrow))]
339+
image: ListStyleImage(Image<'i>),
340+
/// The list style type.
341+
list_style_type: ListStyleType(ListStyleType<'i>),
342342
}
343343
}
344344

0 commit comments

Comments
 (0)