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 13
13
- Update ` selectors ` to ` 0.30 ` .
14
14
- Update ` html5ever ` to ` 0.35 ` .
15
15
16
+ ### Fixed
17
+
18
+ - Ignored ` !important ` that has insignificant whitespace after it.
19
+
16
20
### Performance
17
21
18
22
- Use interned string to compare ` style ` element name.
23
+ - Only check the value suffix for ` !important ` .
19
24
20
25
## [ 0.15.0] - 2025-06-17
21
26
Original file line number Diff line number Diff line change 8
8
- Update ` selectors ` to ` 0.30 ` .
9
9
- Update ` html5ever ` to ` 0.35 ` .
10
10
11
+ ### Fixed
12
+
13
+ - Ignored ` !important ` that has insignificant whitespace after it.
14
+
11
15
### Performance
12
16
13
17
- Use interned string to compare ` style ` element name.
18
+ - Only check the value suffix for ` !important ` .
14
19
15
20
## [ 0.15.0] - 2025-06-21
16
21
Original file line number Diff line number Diff line change 8
8
- Update ` selectors ` to ` 0.30 ` .
9
9
- Update ` html5ever ` to ` 0.35 ` .
10
10
11
+ ### Fixed
12
+
13
+ - Ignored ` !important ` that has insignificant whitespace after it.
14
+
11
15
### Performance
12
16
13
17
- Use interned string to compare ` style ` element name.
18
+ - Only check the value suffix for ` !important ` .
14
19
15
20
## 0.15.0 - 2025-06-29
16
21
Original file line number Diff line number Diff line change 11
11
### Fixed
12
12
13
13
- Expose ` StylesheetCache ` interface, ` cache ` config option, and ` version ` function.
14
+ - Ignored ` !important ` that has insignificant whitespace after it.
14
15
15
16
### Performance
16
17
17
18
- Use interned string to compare ` style ` element name.
19
+ - Only check the value suffix for ` !important ` .
18
20
19
21
## [ 0.15.0] - 2025-06-24
20
22
Original file line number Diff line number Diff line change 11
11
### Fixed
12
12
13
13
- Set ` 3.9 ` in ` requires-python ` key in ` pyproject.toml ` .
14
+ - Ignored ` !important ` that has insignificant whitespace after it.
14
15
15
16
### Performance
16
17
17
18
- Use interned string to compare ` style ` element name.
19
+ - Only check the value suffix for ` !important ` .
18
20
19
21
## [ 0.15.0] - 2025-06-17
20
22
Original file line number Diff line number Diff line change 7
7
- Update ` selectors ` to ` 0.30 ` .
8
8
- Update ` html5ever ` to ` 0.35 ` .
9
9
10
+ ### Fixed
11
+
12
+ - Ignored ` !important ` that has insignificant whitespace after it.
13
+
10
14
### Performance
11
15
12
16
- Use interned string to compare ` style ` element name.
17
+ - Only check the value suffix for ` !important ` .
13
18
14
19
## [ 0.15.2] - 2025-06-24
15
20
Original file line number Diff line number Diff line change @@ -495,7 +495,7 @@ fn merge_styles<Wr: Write>(
495
495
// New rules will not override old ones unless they are marked as `!important`
496
496
for ( property, ( _, value) ) in new_styles {
497
497
match (
498
- value. strip_suffix ( "!important" ) ,
498
+ value. trim_end ( ) . strip_suffix ( "!important" ) ,
499
499
declarations_buffer
500
500
. iter_mut ( )
501
501
. take ( parsed_declarations_count)
Original file line number Diff line number Diff line change @@ -462,8 +462,8 @@ impl<'a> CSSInliner<'a> {
462
462
match element_styles. entry ( name. as_ref ( ) ) {
463
463
indexmap:: map:: Entry :: Occupied ( mut entry) => {
464
464
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" ) ,
467
467
) {
468
468
// Equal importance; the higher specificity wins.
469
469
( false , false ) | ( true , true ) => {
Original file line number Diff line number Diff line change @@ -246,6 +246,15 @@ fn important() {
246
246
)
247
247
}
248
248
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
+
249
258
#[ test]
250
259
fn important_no_rule_exists ( ) {
251
260
// `!important` rules should override existing inline styles
You can’t perform that action at this time.
0 commit comments