File tree Expand file tree Collapse file tree 9 files changed +36
-3
lines changed Expand file tree Collapse file tree 9 files changed +36
-3
lines changed Original file line number Diff line number Diff line change 1313- Update ` selectors ` to ` 0.30 ` .
1414- Update ` html5ever ` to ` 0.35 ` .
1515
16+ ### Fixed
17+
18+ - Ignored ` !important ` that has insignificant whitespace after it.
19+
1620### Performance
1721
1822- Use interned string to compare ` style ` element name.
23+ - Only check the value suffix for ` !important ` .
1924
2025## [ 0.15.0] - 2025-06-17
2126
Original file line number Diff line number Diff line change 88- Update ` selectors ` to ` 0.30 ` .
99- Update ` html5ever ` to ` 0.35 ` .
1010
11+ ### Fixed
12+
13+ - Ignored ` !important ` that has insignificant whitespace after it.
14+
1115### Performance
1216
1317- Use interned string to compare ` style ` element name.
18+ - Only check the value suffix for ` !important ` .
1419
1520## [ 0.15.0] - 2025-06-21
1621
Original file line number Diff line number Diff line change 88- Update ` selectors ` to ` 0.30 ` .
99- Update ` html5ever ` to ` 0.35 ` .
1010
11+ ### Fixed
12+
13+ - Ignored ` !important ` that has insignificant whitespace after it.
14+
1115### Performance
1216
1317- Use interned string to compare ` style ` element name.
18+ - Only check the value suffix for ` !important ` .
1419
1520## 0.15.0 - 2025-06-29
1621
Original file line number Diff line number Diff line change 1111### Fixed
1212
1313- Expose ` StylesheetCache ` interface, ` cache ` config option, and ` version ` function.
14+ - Ignored ` !important ` that has insignificant whitespace after it.
1415
1516### Performance
1617
1718- Use interned string to compare ` style ` element name.
19+ - Only check the value suffix for ` !important ` .
1820
1921## [ 0.15.0] - 2025-06-24
2022
Original file line number Diff line number Diff line change 1111### Fixed
1212
1313- Set ` 3.9 ` in ` requires-python ` key in ` pyproject.toml ` .
14+ - Ignored ` !important ` that has insignificant whitespace after it.
1415
1516### Performance
1617
1718- Use interned string to compare ` style ` element name.
19+ - Only check the value suffix for ` !important ` .
1820
1921## [ 0.15.0] - 2025-06-17
2022
Original file line number Diff line number Diff line change 77- Update ` selectors ` to ` 0.30 ` .
88- Update ` html5ever ` to ` 0.35 ` .
99
10+ ### Fixed
11+
12+ - Ignored ` !important ` that has insignificant whitespace after it.
13+
1014### Performance
1115
1216- Use interned string to compare ` style ` element name.
17+ - Only check the value suffix for ` !important ` .
1318
1419## [ 0.15.2] - 2025-06-24
1520
Original file line number Diff line number Diff line change @@ -495,7 +495,7 @@ fn merge_styles<Wr: Write>(
495495 // New rules will not override old ones unless they are marked as `!important`
496496 for ( property, ( _, value) ) in new_styles {
497497 match (
498- value. strip_suffix ( "!important" ) ,
498+ value. trim_end ( ) . strip_suffix ( "!important" ) ,
499499 declarations_buffer
500500 . iter_mut ( )
501501 . take ( parsed_declarations_count)
Original file line number Diff line number Diff line change @@ -462,8 +462,8 @@ impl<'a> CSSInliner<'a> {
462462 match element_styles. entry ( name. as_ref ( ) ) {
463463 indexmap:: map:: Entry :: Occupied ( mut entry) => {
464464 match (
465- value. ends_with ( "!important" ) ,
466- entry. get ( ) . 1 . ends_with ( "!important" ) ,
465+ value. trim_end ( ) . ends_with ( "!important" ) ,
466+ entry. get ( ) . 1 . trim_end ( ) . ends_with ( "!important" ) ,
467467 ) {
468468 // Equal importance; the higher specificity wins.
469469 ( false , false ) | ( true , true ) => {
Original file line number Diff line number Diff line change @@ -246,6 +246,15 @@ fn important() {
246246 )
247247}
248248
249+ #[ test]
250+ fn important_with_space_at_the_end ( ) {
251+ assert_inlined ! (
252+ style = "h1 { color: blue !important ; }" ,
253+ body = r#"<h1 style="color: red;">Big Text</h1>"# ,
254+ expected = r#"<h1 style="color: blue">Big Text</h1>"#
255+ )
256+ }
257+
249258#[ test]
250259fn important_no_rule_exists ( ) {
251260 // `!important` rules should override existing inline styles
You can’t perform that action at this time.
0 commit comments