css-inline 0.20.2__tar.gz → 0.21.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. {css_inline-0.20.2 → css_inline-0.21.0}/PKG-INFO +3 -4
  2. {css_inline-0.20.2/bindings/python → css_inline-0.21.0}/README.md +1 -1
  3. {css_inline-0.20.2 → css_inline-0.21.0}/bindings/python/CHANGELOG.md +18 -1
  4. {css_inline-0.20.2 → css_inline-0.21.0}/bindings/python/Cargo.lock +111 -124
  5. {css_inline-0.20.2 → css_inline-0.21.0}/bindings/python/Cargo.toml +2 -2
  6. {css_inline-0.20.2 → css_inline-0.21.0/bindings/python}/README.md +1 -1
  7. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/Cargo.toml +9 -5
  8. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/README.md +1 -1
  9. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/html/document.rs +5 -7
  10. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/html/serializer.rs +44 -9
  11. {css_inline-0.20.2 → css_inline-0.21.0}/pyproject.toml +2 -3
  12. {css_inline-0.20.2 → css_inline-0.21.0}/LICENSE +0 -0
  13. {css_inline-0.20.2 → css_inline-0.21.0}/bindings/python/build.rs +0 -0
  14. {css_inline-0.20.2 → css_inline-0.21.0}/bindings/python/src/lib.rs +0 -0
  15. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/benches/inliner.rs +0 -0
  16. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/rustfmt.toml +0 -0
  17. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/error.rs +0 -0
  18. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/html/attributes.rs +0 -0
  19. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/html/element.rs +0 -0
  20. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/html/iter.rs +0 -0
  21. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/html/mod.rs +0 -0
  22. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/html/node.rs +0 -0
  23. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/html/parser.rs +0 -0
  24. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/html/selectors/attr_value.rs +0 -0
  25. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/html/selectors/local_name.rs +0 -0
  26. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/html/selectors/mod.rs +0 -0
  27. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/html/selectors/parser.rs +0 -0
  28. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/html/selectors/pseudo_classes.rs +0 -0
  29. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/html/selectors/pseudo_elements.rs +0 -0
  30. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/html/selectors/selector_impl.rs +0 -0
  31. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/lib.rs +0 -0
  32. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/main.rs +0 -0
  33. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/parser.rs +0 -0
  34. {css_inline-0.20.2 → css_inline-0.21.0}/css-inline/src/resolver.rs +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: css-inline
3
- Version: 0.20.2
3
+ Version: 0.21.0
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -8,7 +8,6 @@ Classifier: Operating System :: MacOS :: MacOS X
8
8
  Classifier: Operating System :: Microsoft :: Windows
9
9
  Classifier: Operating System :: POSIX
10
10
  Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.9
12
11
  Classifier: Programming Language :: Python :: 3.10
13
12
  Classifier: Programming Language :: Python :: 3.11
14
13
  Classifier: Programming Language :: Python :: 3.12
@@ -21,7 +20,7 @@ License-File: LICENSE
21
20
  Summary: High-performance library for inlining CSS into HTML 'style' attributes
22
21
  Keywords: css,html,email,stylesheet,inlining
23
22
  Author-email: Dmitry Dygalo <dmitry@dygalo.dev>
24
- Requires-Python: >=3.9
23
+ Requires-Python: >=3.10
25
24
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
26
25
  Project-URL: homepage, https://github.com/Stranger6667/css-inline/tree/master/bindings/python
27
26
  Project-URL: repository, https://github.com/Stranger6667/css-inline
@@ -72,7 +71,7 @@ into:
72
71
  - Can process multiple documents in parallel
73
72
  - Works on Linux, Windows, macOS and in the browser via PyOdide
74
73
  - Supports HTML5 & CSS3
75
- - Tested on CPython 3.9, 3.10, 3.11, 3.12, 3.13, 3.14 and PyPy 3.11.
74
+ - Tested on CPython 3.10, 3.11, 3.12, 3.13, 3.14 and PyPy 3.11.
76
75
 
77
76
  ## Playground
78
77
 
@@ -44,7 +44,7 @@ into:
44
44
  - Can process multiple documents in parallel
45
45
  - Works on Linux, Windows, macOS and in the browser via PyOdide
46
46
  - Supports HTML5 & CSS3
47
- - Tested on CPython 3.9, 3.10, 3.11, 3.12, 3.13, 3.14 and PyPy 3.11.
47
+ - Tested on CPython 3.10, 3.11, 3.12, 3.13, 3.14 and PyPy 3.11.
48
48
 
49
49
  ## Playground
50
50
 
@@ -2,6 +2,22 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.21.0] - 2026-06-16
6
+
7
+ ### Removed
8
+
9
+ - Support for Python 3.9.
10
+
11
+ ### Changed
12
+
13
+ - Update `selectors` to `0.38`.
14
+ - Update `cssparser` to `0.37`.
15
+ - Update `PyO3` to `0.29.0`.
16
+
17
+ ### Fixed
18
+
19
+ - `width`/`height` HTML attributes not derived from an element's own inline `style` attribute. [#725](https://github.com/Stranger6667/css-inline/issues/725)
20
+
5
21
  ## [0.20.2] - 2026-04-02
6
22
 
7
23
  ### Fixed
@@ -569,7 +585,8 @@
569
585
 
570
586
  - Initial public release
571
587
 
572
- [Unreleased]: https://github.com/Stranger6667/css-inline/compare/python-v0.20.2...HEAD
588
+ [Unreleased]: https://github.com/Stranger6667/css-inline/compare/python-v0.21.0...HEAD
589
+ [0.21.0]: https://github.com/Stranger6667/css-inline/compare/python-v0.20.2...python-v0.21.0
573
590
  [0.20.2]: https://github.com/Stranger6667/css-inline/compare/python-v0.20.1...python-v0.20.2
574
591
  [0.20.1]: https://github.com/Stranger6667/css-inline/compare/python-v0.20.0...python-v0.20.1
575
592
  [0.20.0]: https://github.com/Stranger6667/css-inline/compare/python-v0.19.1...python-v0.20.0
@@ -25,9 +25,9 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
25
25
 
26
26
  [[package]]
27
27
  name = "autocfg"
28
- version = "1.5.0"
28
+ version = "1.5.1"
29
29
  source = "registry+https://github.com/rust-lang/crates.io-index"
30
- checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
30
+ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
31
31
 
32
32
  [[package]]
33
33
  name = "base64"
@@ -37,9 +37,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
37
37
 
38
38
  [[package]]
39
39
  name = "bitflags"
40
- version = "2.11.0"
40
+ version = "2.13.0"
41
41
  source = "registry+https://github.com/rust-lang/crates.io-index"
42
- checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af"
42
+ checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
43
43
 
44
44
  [[package]]
45
45
  name = "built"
@@ -53,9 +53,9 @@ dependencies = [
53
53
 
54
54
  [[package]]
55
55
  name = "bumpalo"
56
- version = "3.20.2"
56
+ version = "3.20.3"
57
57
  source = "registry+https://github.com/rust-lang/crates.io-index"
58
- checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb"
58
+ checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
59
59
 
60
60
  [[package]]
61
61
  name = "bytes"
@@ -77,9 +77,9 @@ dependencies = [
77
77
 
78
78
  [[package]]
79
79
  name = "cc"
80
- version = "1.2.58"
80
+ version = "1.2.64"
81
81
  source = "registry+https://github.com/rust-lang/crates.io-index"
82
- checksum = "e1e928d4b69e3077709075a938a05ffbedfa53a84c8f766efbf8220bb1ff60e1"
82
+ checksum = "dad887fd958be91b5098c0248def011f4523ab786cd411be668777e55063501f"
83
83
  dependencies = [
84
84
  "find-msvc-tools",
85
85
  "shlex",
@@ -99,9 +99,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
99
99
 
100
100
  [[package]]
101
101
  name = "chrono"
102
- version = "0.4.44"
102
+ version = "0.4.45"
103
103
  source = "registry+https://github.com/rust-lang/crates.io-index"
104
- checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0"
104
+ checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327"
105
105
  dependencies = [
106
106
  "iana-time-zone",
107
107
  "num-traits",
@@ -141,7 +141,7 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
141
141
 
142
142
  [[package]]
143
143
  name = "css-inline"
144
- version = "0.20.2"
144
+ version = "0.21.0"
145
145
  dependencies = [
146
146
  "cssparser",
147
147
  "html5ever",
@@ -157,7 +157,7 @@ dependencies = [
157
157
 
158
158
  [[package]]
159
159
  name = "css-inline-python"
160
- version = "0.20.2"
160
+ version = "0.21.0"
161
161
  dependencies = [
162
162
  "built",
163
163
  "css-inline",
@@ -169,9 +169,9 @@ dependencies = [
169
169
 
170
170
  [[package]]
171
171
  name = "cssparser"
172
- version = "0.36.0"
172
+ version = "0.37.0"
173
173
  source = "registry+https://github.com/rust-lang/crates.io-index"
174
- checksum = "dae61cf9c0abb83bd659dab65b7e4e38d8236824c85f0f804f173567bda257d2"
174
+ checksum = "8c9cdaae01d5ed7882b04d795e7f752f46ff52d2fa3b50a20d28c464510bba98"
175
175
  dependencies = [
176
176
  "cssparser-macros",
177
177
  "dtoa-short",
@@ -182,9 +182,9 @@ dependencies = [
182
182
 
183
183
  [[package]]
184
184
  name = "cssparser-macros"
185
- version = "0.6.1"
185
+ version = "0.7.0"
186
186
  source = "registry+https://github.com/rust-lang/crates.io-index"
187
- checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331"
187
+ checksum = "10a2a99df6e410a8ff4245aa2006499ea662245f967cc7c0a38c83ef8eb44dbf"
188
188
  dependencies = [
189
189
  "quote",
190
190
  "syn",
@@ -213,9 +213,9 @@ dependencies = [
213
213
 
214
214
  [[package]]
215
215
  name = "displaydoc"
216
- version = "0.2.5"
216
+ version = "0.2.6"
217
217
  source = "registry+https://github.com/rust-lang/crates.io-index"
218
- checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
218
+ checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f"
219
219
  dependencies = [
220
220
  "proc-macro2",
221
221
  "quote",
@@ -239,9 +239,9 @@ dependencies = [
239
239
 
240
240
  [[package]]
241
241
  name = "either"
242
- version = "1.15.0"
242
+ version = "1.16.0"
243
243
  source = "registry+https://github.com/rust-lang/crates.io-index"
244
- checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
244
+ checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"
245
245
 
246
246
  [[package]]
247
247
  name = "equivalent"
@@ -251,9 +251,9 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
251
251
 
252
252
  [[package]]
253
253
  name = "fastrand"
254
- version = "2.3.0"
254
+ version = "2.4.1"
255
255
  source = "registry+https://github.com/rust-lang/crates.io-index"
256
- checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
256
+ checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6"
257
257
 
258
258
  [[package]]
259
259
  name = "find-msvc-tools"
@@ -354,9 +354,9 @@ dependencies = [
354
354
 
355
355
  [[package]]
356
356
  name = "hashbrown"
357
- version = "0.16.1"
357
+ version = "0.17.1"
358
358
  source = "registry+https://github.com/rust-lang/crates.io-index"
359
- checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
359
+ checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
360
360
  dependencies = [
361
361
  "allocator-api2",
362
362
  "equivalent",
@@ -381,9 +381,9 @@ dependencies = [
381
381
 
382
382
  [[package]]
383
383
  name = "http"
384
- version = "1.4.0"
384
+ version = "1.4.2"
385
385
  source = "registry+https://github.com/rust-lang/crates.io-index"
386
- checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a"
386
+ checksum = "6970f50e31d6fc17d3fa27329444bfa74e196cf62e95052a3f6fee181dba6425"
387
387
  dependencies = [
388
388
  "bytes",
389
389
  "itoa",
@@ -420,9 +420,9 @@ checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
420
420
 
421
421
  [[package]]
422
422
  name = "hyper"
423
- version = "1.9.0"
423
+ version = "1.10.1"
424
424
  source = "registry+https://github.com/rust-lang/crates.io-index"
425
- checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca"
425
+ checksum = "55281c53a1894c864990125767da440a4e630446785086f52523b20033b74498"
426
426
  dependencies = [
427
427
  "atomic-waker",
428
428
  "bytes",
@@ -440,15 +440,14 @@ dependencies = [
440
440
 
441
441
  [[package]]
442
442
  name = "hyper-rustls"
443
- version = "0.27.7"
443
+ version = "0.27.9"
444
444
  source = "registry+https://github.com/rust-lang/crates.io-index"
445
- checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58"
445
+ checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f"
446
446
  dependencies = [
447
447
  "http",
448
448
  "hyper",
449
449
  "hyper-util",
450
450
  "rustls",
451
- "rustls-pki-types",
452
451
  "tokio",
453
452
  "tokio-rustls",
454
453
  "tower-service",
@@ -606,9 +605,9 @@ dependencies = [
606
605
 
607
606
  [[package]]
608
607
  name = "indexmap"
609
- version = "2.13.0"
608
+ version = "2.14.0"
610
609
  source = "registry+https://github.com/rust-lang/crates.io-index"
611
- checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"
610
+ checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
612
611
  dependencies = [
613
612
  "equivalent",
614
613
  "hashbrown",
@@ -620,16 +619,6 @@ version = "2.12.0"
620
619
  source = "registry+https://github.com/rust-lang/crates.io-index"
621
620
  checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2"
622
621
 
623
- [[package]]
624
- name = "iri-string"
625
- version = "0.7.12"
626
- source = "registry+https://github.com/rust-lang/crates.io-index"
627
- checksum = "25e659a4bb38e810ebc252e53b5814ff908a8c58c2a9ce2fae1bbec24cbf4e20"
628
- dependencies = [
629
- "memchr",
630
- "serde",
631
- ]
632
-
633
622
  [[package]]
634
623
  name = "itoa"
635
624
  version = "1.0.18"
@@ -638,21 +627,20 @@ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
638
627
 
639
628
  [[package]]
640
629
  name = "js-sys"
641
- version = "0.3.94"
630
+ version = "0.3.102"
642
631
  source = "registry+https://github.com/rust-lang/crates.io-index"
643
- checksum = "2e04e2ef80ce82e13552136fabeef8a5ed1f985a96805761cbb9a2c34e7664d9"
632
+ checksum = "03d04c30968dffe80775bd4d7fb676131cd04a1fb46d2686dbffbaec2d9dfd31"
644
633
  dependencies = [
645
634
  "cfg-if",
646
635
  "futures-util",
647
- "once_cell",
648
636
  "wasm-bindgen",
649
637
  ]
650
638
 
651
639
  [[package]]
652
640
  name = "libc"
653
- version = "0.2.184"
641
+ version = "0.2.186"
654
642
  source = "registry+https://github.com/rust-lang/crates.io-index"
655
- checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af"
643
+ checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
656
644
 
657
645
  [[package]]
658
646
  name = "litemap"
@@ -671,15 +659,15 @@ dependencies = [
671
659
 
672
660
  [[package]]
673
661
  name = "log"
674
- version = "0.4.29"
662
+ version = "0.4.32"
675
663
  source = "registry+https://github.com/rust-lang/crates.io-index"
676
- checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
664
+ checksum = "953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a"
677
665
 
678
666
  [[package]]
679
667
  name = "lru"
680
- version = "0.16.3"
668
+ version = "0.18.0"
681
669
  source = "registry+https://github.com/rust-lang/crates.io-index"
682
- checksum = "a1dc47f592c06f33f8e3aea9591776ec7c9f9e4124778ff8a3c3b87159f7e593"
670
+ checksum = "8a860605968fce16869fd239cf4237a82f3ac470723415db603b0e8b6c8d4fb9"
683
671
  dependencies = [
684
672
  "hashbrown",
685
673
  ]
@@ -703,15 +691,15 @@ dependencies = [
703
691
 
704
692
  [[package]]
705
693
  name = "memchr"
706
- version = "2.8.0"
694
+ version = "2.8.2"
707
695
  source = "registry+https://github.com/rust-lang/crates.io-index"
708
- checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
696
+ checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4"
709
697
 
710
698
  [[package]]
711
699
  name = "mio"
712
- version = "1.2.0"
700
+ version = "1.2.1"
713
701
  source = "registry+https://github.com/rust-lang/crates.io-index"
714
- checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1"
702
+ checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda"
715
703
  dependencies = [
716
704
  "libc",
717
705
  "wasi",
@@ -868,9 +856,9 @@ dependencies = [
868
856
 
869
857
  [[package]]
870
858
  name = "pyo3"
871
- version = "0.28.3"
859
+ version = "0.29.0"
872
860
  source = "registry+https://github.com/rust-lang/crates.io-index"
873
- checksum = "91fd8e38a3b50ed1167fb981cd6fd60147e091784c427b8f7183a7ee32c31c12"
861
+ checksum = "cd274650b21d4bfc26a0a47587962c1edb425f69287324355cd040c3ea66071c"
874
862
  dependencies = [
875
863
  "libc",
876
864
  "once_cell",
@@ -882,9 +870,9 @@ dependencies = [
882
870
 
883
871
  [[package]]
884
872
  name = "pyo3-build-config"
885
- version = "0.28.3"
873
+ version = "0.29.0"
886
874
  source = "registry+https://github.com/rust-lang/crates.io-index"
887
- checksum = "e368e7ddfdeb98c9bca7f8383be1648fd84ab466bf2bc015e94008db6d35611e"
875
+ checksum = "c5e2a7d2f0d013342f295c048ad19237add5154a55b1c5a254c0ec93d4109078"
888
876
  dependencies = [
889
877
  "target-lexicon",
890
878
  ]
@@ -897,9 +885,9 @@ checksum = "4bf83fcee540452241ba030140f50418b973e840a64727c967b9266660f0a690"
897
885
 
898
886
  [[package]]
899
887
  name = "pyo3-ffi"
900
- version = "0.28.3"
888
+ version = "0.29.0"
901
889
  source = "registry+https://github.com/rust-lang/crates.io-index"
902
- checksum = "7f29e10af80b1f7ccaf7f69eace800a03ecd13e883acfacc1e5d0988605f651e"
890
+ checksum = "ca85c467da1bbc8d866eea5deff9cf29ea5f7785054a17da36e65bda9c05845b"
903
891
  dependencies = [
904
892
  "libc",
905
893
  "pyo3-build-config",
@@ -907,9 +895,9 @@ dependencies = [
907
895
 
908
896
  [[package]]
909
897
  name = "pyo3-macros"
910
- version = "0.28.3"
898
+ version = "0.29.0"
911
899
  source = "registry+https://github.com/rust-lang/crates.io-index"
912
- checksum = "df6e520eff47c45997d2fc7dd8214b25dd1310918bbb2642156ef66a67f29813"
900
+ checksum = "9ac53762fd065daa3194dd09337a38bd793a188100fd1a9304c4ab312d901771"
913
901
  dependencies = [
914
902
  "proc-macro2",
915
903
  "pyo3-macros-backend",
@@ -919,13 +907,12 @@ dependencies = [
919
907
 
920
908
  [[package]]
921
909
  name = "pyo3-macros-backend"
922
- version = "0.28.3"
910
+ version = "0.29.0"
923
911
  source = "registry+https://github.com/rust-lang/crates.io-index"
924
- checksum = "c4cdc218d835738f81c2338f822078af45b4afdf8b2e33cbb5916f108b813acb"
912
+ checksum = "4ca3a1557399783172dc5bf39cfca835157732532cba56b71d2292161e53b362"
925
913
  dependencies = [
926
914
  "heck",
927
915
  "proc-macro2",
928
- "pyo3-build-config",
929
916
  "quote",
930
917
  "syn",
931
918
  ]
@@ -1002,9 +989,9 @@ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
1002
989
 
1003
990
  [[package]]
1004
991
  name = "rand"
1005
- version = "0.9.2"
992
+ version = "0.9.4"
1006
993
  source = "registry+https://github.com/rust-lang/crates.io-index"
1007
- checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
994
+ checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea"
1008
995
  dependencies = [
1009
996
  "rand_chacha",
1010
997
  "rand_core",
@@ -1031,9 +1018,9 @@ dependencies = [
1031
1018
 
1032
1019
  [[package]]
1033
1020
  name = "rayon"
1034
- version = "1.11.0"
1021
+ version = "1.12.0"
1035
1022
  source = "registry+https://github.com/rust-lang/crates.io-index"
1036
- checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f"
1023
+ checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
1037
1024
  dependencies = [
1038
1025
  "either",
1039
1026
  "rayon-core",
@@ -1129,9 +1116,9 @@ dependencies = [
1129
1116
 
1130
1117
  [[package]]
1131
1118
  name = "rustls"
1132
- version = "0.23.37"
1119
+ version = "0.23.40"
1133
1120
  source = "registry+https://github.com/rust-lang/crates.io-index"
1134
- checksum = "758025cb5fccfd3bc2fd74708fd4682be41d99e5dff73c377c0646c6012c73a4"
1121
+ checksum = "ef86cd5876211988985292b91c96a8f2d298df24e75989a43a3c73f2d4d8168b"
1135
1122
  dependencies = [
1136
1123
  "once_cell",
1137
1124
  "ring",
@@ -1143,9 +1130,9 @@ dependencies = [
1143
1130
 
1144
1131
  [[package]]
1145
1132
  name = "rustls-pki-types"
1146
- version = "1.14.0"
1133
+ version = "1.14.1"
1147
1134
  source = "registry+https://github.com/rust-lang/crates.io-index"
1148
- checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd"
1135
+ checksum = "30a7197ae7eb376e574fe940d068c30fe0462554a3ddbe4eca7838e049c937a9"
1149
1136
  dependencies = [
1150
1137
  "web-time",
1151
1138
  "zeroize",
@@ -1153,9 +1140,9 @@ dependencies = [
1153
1140
 
1154
1141
  [[package]]
1155
1142
  name = "rustls-webpki"
1156
- version = "0.103.10"
1143
+ version = "0.103.13"
1157
1144
  source = "registry+https://github.com/rust-lang/crates.io-index"
1158
- checksum = "df33b2b81ac578cabaf06b89b0631153a3f416b0a886e8a7a1707fb51abbd1ef"
1145
+ checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e"
1159
1146
  dependencies = [
1160
1147
  "ring",
1161
1148
  "rustls-pki-types",
@@ -1182,9 +1169,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
1182
1169
 
1183
1170
  [[package]]
1184
1171
  name = "selectors"
1185
- version = "0.36.1"
1172
+ version = "0.38.0"
1186
1173
  source = "registry+https://github.com/rust-lang/crates.io-index"
1187
- checksum = "c5d9c0c92a92d33f08817311cf3f2c29a3538a8240e94a6a3c622ce652d7e00c"
1174
+ checksum = "8adfa1c298912827b8a28b223b3b874357397ae706e6190acd9bf28cee99114d"
1188
1175
  dependencies = [
1189
1176
  "bitflags",
1190
1177
  "cssparser",
@@ -1201,9 +1188,9 @@ dependencies = [
1201
1188
 
1202
1189
  [[package]]
1203
1190
  name = "semver"
1204
- version = "1.0.27"
1191
+ version = "1.0.28"
1205
1192
  source = "registry+https://github.com/rust-lang/crates.io-index"
1206
- checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
1193
+ checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
1207
1194
  dependencies = [
1208
1195
  "serde",
1209
1196
  "serde_core",
@@ -1241,9 +1228,9 @@ dependencies = [
1241
1228
 
1242
1229
  [[package]]
1243
1230
  name = "serde_json"
1244
- version = "1.0.149"
1231
+ version = "1.0.150"
1245
1232
  source = "registry+https://github.com/rust-lang/crates.io-index"
1246
- checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"
1233
+ checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"
1247
1234
  dependencies = [
1248
1235
  "itoa",
1249
1236
  "memchr",
@@ -1284,15 +1271,15 @@ dependencies = [
1284
1271
 
1285
1272
  [[package]]
1286
1273
  name = "shlex"
1287
- version = "1.3.0"
1274
+ version = "2.0.1"
1288
1275
  source = "registry+https://github.com/rust-lang/crates.io-index"
1289
- checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
1276
+ checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
1290
1277
 
1291
1278
  [[package]]
1292
1279
  name = "siphasher"
1293
- version = "1.0.2"
1280
+ version = "1.0.3"
1294
1281
  source = "registry+https://github.com/rust-lang/crates.io-index"
1295
- checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e"
1282
+ checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649"
1296
1283
 
1297
1284
  [[package]]
1298
1285
  name = "slab"
@@ -1302,15 +1289,15 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
1302
1289
 
1303
1290
  [[package]]
1304
1291
  name = "smallvec"
1305
- version = "1.15.1"
1292
+ version = "1.15.2"
1306
1293
  source = "registry+https://github.com/rust-lang/crates.io-index"
1307
- checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
1294
+ checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
1308
1295
 
1309
1296
  [[package]]
1310
1297
  name = "socket2"
1311
- version = "0.6.3"
1298
+ version = "0.6.4"
1312
1299
  source = "registry+https://github.com/rust-lang/crates.io-index"
1313
- checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"
1300
+ checksum = "52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51"
1314
1301
  dependencies = [
1315
1302
  "libc",
1316
1303
  "windows-sys 0.61.2",
@@ -1446,9 +1433,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
1446
1433
 
1447
1434
  [[package]]
1448
1435
  name = "tokio"
1449
- version = "1.50.0"
1436
+ version = "1.52.3"
1450
1437
  source = "registry+https://github.com/rust-lang/crates.io-index"
1451
- checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d"
1438
+ checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe"
1452
1439
  dependencies = [
1453
1440
  "bytes",
1454
1441
  "libc",
@@ -1526,20 +1513,20 @@ dependencies = [
1526
1513
 
1527
1514
  [[package]]
1528
1515
  name = "tower-http"
1529
- version = "0.6.8"
1516
+ version = "0.6.11"
1530
1517
  source = "registry+https://github.com/rust-lang/crates.io-index"
1531
- checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8"
1518
+ checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840"
1532
1519
  dependencies = [
1533
1520
  "bitflags",
1534
1521
  "bytes",
1535
1522
  "futures-util",
1536
1523
  "http",
1537
1524
  "http-body",
1538
- "iri-string",
1539
1525
  "pin-project-lite",
1540
1526
  "tower",
1541
1527
  "tower-layer",
1542
1528
  "tower-service",
1529
+ "url",
1543
1530
  ]
1544
1531
 
1545
1532
  [[package]]
@@ -1641,9 +1628,9 @@ dependencies = [
1641
1628
 
1642
1629
  [[package]]
1643
1630
  name = "wasm-bindgen"
1644
- version = "0.2.117"
1631
+ version = "0.2.125"
1645
1632
  source = "registry+https://github.com/rust-lang/crates.io-index"
1646
- checksum = "0551fc1bb415591e3372d0bc4780db7e587d84e2a7e79da121051c5c4b89d0b0"
1633
+ checksum = "8ddb3f79143bced6de84270411622a2699cee572fc0875aeaf1e7867cf9fca1a"
1647
1634
  dependencies = [
1648
1635
  "cfg-if",
1649
1636
  "once_cell",
@@ -1654,9 +1641,9 @@ dependencies = [
1654
1641
 
1655
1642
  [[package]]
1656
1643
  name = "wasm-bindgen-futures"
1657
- version = "0.4.67"
1644
+ version = "0.4.75"
1658
1645
  source = "registry+https://github.com/rust-lang/crates.io-index"
1659
- checksum = "03623de6905b7206edd0a75f69f747f134b7f0a2323392d664448bf2d3c5d87e"
1646
+ checksum = "503b14d284f2c8dac03b819967e155ea753f573586193b2b2c95990cb5d69280"
1660
1647
  dependencies = [
1661
1648
  "js-sys",
1662
1649
  "wasm-bindgen",
@@ -1664,9 +1651,9 @@ dependencies = [
1664
1651
 
1665
1652
  [[package]]
1666
1653
  name = "wasm-bindgen-macro"
1667
- version = "0.2.117"
1654
+ version = "0.2.125"
1668
1655
  source = "registry+https://github.com/rust-lang/crates.io-index"
1669
- checksum = "7fbdf9a35adf44786aecd5ff89b4563a90325f9da0923236f6104e603c7e86be"
1656
+ checksum = "4e21a184b13fb19e157296e2c46056aec9092264fab83e4ba59e68c61b323c3d"
1670
1657
  dependencies = [
1671
1658
  "quote",
1672
1659
  "wasm-bindgen-macro-support",
@@ -1674,9 +1661,9 @@ dependencies = [
1674
1661
 
1675
1662
  [[package]]
1676
1663
  name = "wasm-bindgen-macro-support"
1677
- version = "0.2.117"
1664
+ version = "0.2.125"
1678
1665
  source = "registry+https://github.com/rust-lang/crates.io-index"
1679
- checksum = "dca9693ef2bab6d4e6707234500350d8dad079eb508dca05530c85dc3a529ff2"
1666
+ checksum = "fecefd9c35bd935a20fc3fc344b5f29138961e4f47fb03297d88f2587afb5ebd"
1680
1667
  dependencies = [
1681
1668
  "bumpalo",
1682
1669
  "proc-macro2",
@@ -1687,18 +1674,18 @@ dependencies = [
1687
1674
 
1688
1675
  [[package]]
1689
1676
  name = "wasm-bindgen-shared"
1690
- version = "0.2.117"
1677
+ version = "0.2.125"
1691
1678
  source = "registry+https://github.com/rust-lang/crates.io-index"
1692
- checksum = "39129a682a6d2d841b6c429d0c51e5cb0ed1a03829d8b3d1e69a011e62cb3d3b"
1679
+ checksum = "23939e44bb9a5d7576fa2b563dc2e136628f1224e88a8deed09e04858b77871f"
1693
1680
  dependencies = [
1694
1681
  "unicode-ident",
1695
1682
  ]
1696
1683
 
1697
1684
  [[package]]
1698
1685
  name = "web-sys"
1699
- version = "0.3.94"
1686
+ version = "0.3.102"
1700
1687
  source = "registry+https://github.com/rust-lang/crates.io-index"
1701
- checksum = "cd70027e39b12f0849461e08ffc50b9cd7688d942c1c8e3c7b22273236b4dd0a"
1688
+ checksum = "a6430a72df5eb332242960fe84b3002a241163998241eb596d4f739b9757061d"
1702
1689
  dependencies = [
1703
1690
  "js-sys",
1704
1691
  "wasm-bindgen",
@@ -1716,9 +1703,9 @@ dependencies = [
1716
1703
 
1717
1704
  [[package]]
1718
1705
  name = "web_atoms"
1719
- version = "0.2.3"
1706
+ version = "0.2.4"
1720
1707
  source = "registry+https://github.com/rust-lang/crates.io-index"
1721
- checksum = "57a9779e9f04d2ac1ce317aee707aa2f6b773afba7b931222bff6983843b1576"
1708
+ checksum = "d7cff6eef815df1834fd250e3a2ff436044d82a9f1bc1980ca1dbdf07effc538"
1722
1709
  dependencies = [
1723
1710
  "phf",
1724
1711
  "phf_codegen",
@@ -1728,9 +1715,9 @@ dependencies = [
1728
1715
 
1729
1716
  [[package]]
1730
1717
  name = "webpki-roots"
1731
- version = "1.0.6"
1718
+ version = "1.0.7"
1732
1719
  source = "registry+https://github.com/rust-lang/crates.io-index"
1733
- checksum = "22cfaf3c063993ff62e73cb4311efde4db1efb31ab78a3e5c457939ad5cc0bed"
1720
+ checksum = "52f5ee44c96cf55f1b349600768e3ece3a8f26010c05265ab73f945bb1a2eb9d"
1734
1721
  dependencies = [
1735
1722
  "rustls-pki-types",
1736
1723
  ]
@@ -1967,15 +1954,15 @@ checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
1967
1954
 
1968
1955
  [[package]]
1969
1956
  name = "writeable"
1970
- version = "0.6.2"
1957
+ version = "0.6.3"
1971
1958
  source = "registry+https://github.com/rust-lang/crates.io-index"
1972
- checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
1959
+ checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
1973
1960
 
1974
1961
  [[package]]
1975
1962
  name = "yoke"
1976
- version = "0.8.2"
1963
+ version = "0.8.3"
1977
1964
  source = "registry+https://github.com/rust-lang/crates.io-index"
1978
- checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca"
1965
+ checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"
1979
1966
  dependencies = [
1980
1967
  "stable_deref_trait",
1981
1968
  "yoke-derive",
@@ -1996,18 +1983,18 @@ dependencies = [
1996
1983
 
1997
1984
  [[package]]
1998
1985
  name = "zerocopy"
1999
- version = "0.8.48"
1986
+ version = "0.8.52"
2000
1987
  source = "registry+https://github.com/rust-lang/crates.io-index"
2001
- checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9"
1988
+ checksum = "ce1022995ff5ff5d841ad7d994facc23098cd40152f2c1d11cd607c6f530653f"
2002
1989
  dependencies = [
2003
1990
  "zerocopy-derive",
2004
1991
  ]
2005
1992
 
2006
1993
  [[package]]
2007
1994
  name = "zerocopy-derive"
2008
- version = "0.8.48"
1995
+ version = "0.8.52"
2009
1996
  source = "registry+https://github.com/rust-lang/crates.io-index"
2010
- checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4"
1997
+ checksum = "1ae7f38b72ec2a254e2b87ef277cf2cd4fb97cbebf944faa6f33354da0867930"
2011
1998
  dependencies = [
2012
1999
  "proc-macro2",
2013
2000
  "quote",
@@ -2016,9 +2003,9 @@ dependencies = [
2016
2003
 
2017
2004
  [[package]]
2018
2005
  name = "zerofrom"
2019
- version = "0.1.7"
2006
+ version = "0.1.8"
2020
2007
  source = "registry+https://github.com/rust-lang/crates.io-index"
2021
- checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df"
2008
+ checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"
2022
2009
  dependencies = [
2023
2010
  "zerofrom-derive",
2024
2011
  ]
@@ -2037,9 +2024,9 @@ dependencies = [
2037
2024
 
2038
2025
  [[package]]
2039
2026
  name = "zeroize"
2040
- version = "1.8.2"
2027
+ version = "1.9.0"
2041
2028
  source = "registry+https://github.com/rust-lang/crates.io-index"
2042
- checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0"
2029
+ checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e"
2043
2030
 
2044
2031
  [[package]]
2045
2032
  name = "zerotrie"
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "css-inline-python"
3
- version = "0.20.2"
3
+ version = "0.21.0"
4
4
  authors = ["Dmitry Dygalo <dmitry@dygalo.dev>"]
5
5
  edition = "2024"
6
6
  rust-version = "1.85"
@@ -15,7 +15,7 @@ crate-type = ["cdylib"]
15
15
  built = { version = "0.8.0", features = ["cargo-lock", "chrono"] }
16
16
 
17
17
  [dependencies]
18
- pyo3 = { version = "0.28.0", features = ["extension-module", "abi3-py39"] }
18
+ pyo3 = { version = "0.29.0", features = ["extension-module", "abi3-py310"] }
19
19
  pyo3-built = "0.6"
20
20
  rayon = "1"
21
21
  url = "2"
@@ -44,7 +44,7 @@ into:
44
44
  - Can process multiple documents in parallel
45
45
  - Works on Linux, Windows, macOS and in the browser via PyOdide
46
46
  - Supports HTML5 & CSS3
47
- - Tested on CPython 3.9, 3.10, 3.11, 3.12, 3.13, 3.14 and PyPy 3.11.
47
+ - Tested on CPython 3.10, 3.11, 3.12, 3.13, 3.14 and PyPy 3.11.
48
48
 
49
49
  ## Playground
50
50
 
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "css-inline"
3
- version = "0.20.2"
3
+ version = "0.21.0"
4
4
  authors = ["Dmitry Dygalo <dmitry@dygalo.dev>"]
5
5
  edition = "2021"
6
6
  license = "MIT"
@@ -16,7 +16,11 @@ exclude = [
16
16
  "tests",
17
17
  ]
18
18
  categories = ["web-programming"]
19
- rust-version = "1.80"
19
+ rust-version = "1.85"
20
+ resolver = "3"
21
+
22
+ [[bin]]
23
+ name = "css-inline"
20
24
 
21
25
  [features]
22
26
  default = ["cli", "http", "file", "stylesheet-cache"]
@@ -26,15 +30,15 @@ file = []
26
30
  stylesheet-cache = ["lru"]
27
31
 
28
32
  [dependencies]
29
- cssparser = "0.36.0"
33
+ cssparser = "0.37.0"
30
34
  html5ever = "0.39.0"
31
- lru = { version = "0.16.0", optional = true }
35
+ lru = { version = "0.18.0", optional = true }
32
36
  memchr = "2.7"
33
37
  precomputed-hash = "0.1.1"
34
38
  rayon = { version = "1.10", optional = true }
35
39
  reqwest = { version = "0.12.0", optional = true, default-features = false, features = ["rustls-tls", "blocking"] }
36
40
  rustc-hash = "2.0.0"
37
- selectors = "0.36.1"
41
+ selectors = "0.38.0"
38
42
  smallvec = "1"
39
43
  url = "2"
40
44
 
@@ -59,7 +59,7 @@ To include it in your project, add the following line to the dependencies sectio
59
59
  css-inline = "0.20"
60
60
  ```
61
61
 
62
- The Minimum Supported Rust Version is 1.80.
62
+ The Minimum Supported Rust Version is 1.85.
63
63
 
64
64
  ## Usage
65
65
 
@@ -220,16 +220,14 @@ impl Document {
220
220
 
221
221
  match bytes.first() {
222
222
  // Class selector: .classname
223
- Some(b'.') => extract_identifier(&bytes[1..]).map_or(true, |name| {
224
- self.by_class.contains_key(&LocalName::from(name))
225
- }),
223
+ Some(b'.') => extract_identifier(&bytes[1..])
224
+ .is_none_or(|name| self.by_class.contains_key(&LocalName::from(name))),
226
225
  // ID selector: #id
227
226
  Some(b'#') => extract_identifier(&bytes[1..])
228
- .map_or(true, |name| self.by_id.contains_key(&LocalName::from(name))),
227
+ .is_none_or(|name| self.by_id.contains_key(&LocalName::from(name))),
229
228
  // Tag selector: starts with ASCII letter
230
- Some(b'a'..=b'z' | b'A'..=b'Z') => extract_identifier(bytes).map_or(true, |name| {
231
- self.by_tag.contains_key(&LocalName::from(name))
232
- }),
229
+ Some(b'a'..=b'z' | b'A'..=b'Z') => extract_identifier(bytes)
230
+ .is_none_or(|name| self.by_tag.contains_key(&LocalName::from(name))),
233
231
  // Universal (*), attribute ([), pseudo-class (:), empty, or unknown
234
232
  _ => true,
235
233
  }
@@ -119,6 +119,37 @@ fn find_style_value<'a>(styles: &'a ElementStyleMap<'_>, property: &str) -> Opti
119
119
  .map(|(_, _, value)| *value)
120
120
  }
121
121
 
122
+ /// Find a property value in an element's inline `style` attribute (last declaration wins).
123
+ fn find_inline_style_value<'a>(style: &'a str, property: &str) -> Option<&'a str> {
124
+ let mut input = cssparser::ParserInput::new(style);
125
+ let mut css_parser = cssparser::Parser::new(&mut input);
126
+ let mut declaration_parser = parser::CSSDeclarationListParser;
127
+ let declarations = cssparser::RuleBodyParser::new(&mut css_parser, &mut declaration_parser);
128
+ let mut found = None;
129
+ for (name, value) in declarations.flatten() {
130
+ if name.eq_ignore_ascii_case(property) {
131
+ found = Some(value);
132
+ }
133
+ }
134
+ found
135
+ }
136
+
137
+ /// Pick the cascade-effective value between an inline `style` declaration and a stylesheet rule.
138
+ /// Precedence (high to low): inline `!important`, stylesheet `!important`, inline, stylesheet.
139
+ fn effective_dimension<'a>(
140
+ inline: Option<&'a str>,
141
+ stylesheet: Option<&'a str>,
142
+ ) -> Option<&'a str> {
143
+ let important = |v: &str| v.trim_end().ends_with("!important");
144
+ if inline.is_some_and(important) {
145
+ inline
146
+ } else if stylesheet.is_some_and(important) {
147
+ stylesheet
148
+ } else {
149
+ inline.or(stylesheet)
150
+ }
151
+ }
152
+
122
153
  #[allow(clippy::too_many_arguments, clippy::fn_params_excessive_bools)]
123
154
  pub(crate) fn serialize_to<W: Write>(
124
155
  document: &Document,
@@ -398,7 +429,7 @@ impl<'a, W: Write> HtmlSerializer<'a, W> {
398
429
  self.styles.get_mut(node_id.get()).and_then(|slot| {
399
430
  slot.take().map(|mut styles| {
400
431
  // Sort by specificity for consistent output order
401
- styles.sort_unstable_by(|a, b| a.1.cmp(&b.1));
432
+ styles.sort_unstable_by_key(|a| a.1);
402
433
  styles
403
434
  })
404
435
  })
@@ -418,11 +449,14 @@ impl<'a, W: Write> HtmlSerializer<'a, W> {
418
449
  if let Some(ref html_name) = html_name {
419
450
  if supports_dimension_attrs(html_name) {
420
451
  let allow_percent = is_table_element(html_name);
452
+ // Resolve the cascade-effective value across the inline `style` and stylesheet.
453
+ let style_attr = attrs.get(local_name!("style"));
421
454
  if apply_width_attributes && !attrs.contains(local_name!("width")) {
422
- if let Some(dim) = styles
423
- .as_ref()
424
- .and_then(|s| find_style_value(s, "width"))
425
- .and_then(|v| extract_dimension_value(v, allow_percent))
455
+ if let Some(dim) = effective_dimension(
456
+ style_attr.and_then(|s| find_inline_style_value(s, "width")),
457
+ styles.as_ref().and_then(|s| find_style_value(s, "width")),
458
+ )
459
+ .and_then(|v| extract_dimension_value(v, allow_percent))
426
460
  {
427
461
  self.writer.write_all(b" width=\"")?;
428
462
  dim.write_to(&mut self.writer)?;
@@ -430,10 +464,11 @@ impl<'a, W: Write> HtmlSerializer<'a, W> {
430
464
  }
431
465
  }
432
466
  if apply_height_attributes && !attrs.contains(local_name!("height")) {
433
- if let Some(dim) = styles
434
- .as_ref()
435
- .and_then(|s| find_style_value(s, "height"))
436
- .and_then(|v| extract_dimension_value(v, allow_percent))
467
+ if let Some(dim) = effective_dimension(
468
+ style_attr.and_then(|s| find_inline_style_value(s, "height")),
469
+ styles.as_ref().and_then(|s| find_style_value(s, "height")),
470
+ )
471
+ .and_then(|v| extract_dimension_value(v, allow_percent))
437
472
  {
438
473
  self.writer.write_all(b" height=\"")?;
439
474
  dim.write_to(&mut self.writer)?;
@@ -16,7 +16,6 @@ classifiers=[
16
16
  "Operating System :: Microsoft :: Windows",
17
17
  "Operating System :: POSIX",
18
18
  "Programming Language :: Python :: 3",
19
- "Programming Language :: Python :: 3.9",
20
19
  "Programming Language :: Python :: 3.10",
21
20
  "Programming Language :: Python :: 3.11",
22
21
  "Programming Language :: Python :: 3.12",
@@ -27,7 +26,7 @@ classifiers=[
27
26
  "Programming Language :: Rust",
28
27
  ]
29
28
  dependencies = []
30
- requires-python = ">=3.9"
29
+ requires-python = ">=3.10"
31
30
 
32
31
  [project.urls]
33
32
  homepage = "https://github.com/Stranger6667/css-inline/tree/master/bindings/python"
@@ -35,7 +34,7 @@ repository = "https://github.com/Stranger6667/css-inline"
35
34
 
36
35
  [tool.ruff]
37
36
  line-length = 120
38
- target-version = "py39"
37
+ target-version = "py310"
39
38
 
40
39
  [tool.ruff.lint.isort]
41
40
  known-first-party = ["css_inline"]
File without changes