Repository navigation
Conversation
…hadows, as jsdom does
## Description
Swift's inline style declaration kept a CSS-wide keyword's case for
properties that keep identifiers' case (`font-family: INHERIT`) or keep
values as written (the shadows), and kept a `box-shadow` or `text-shadow`
of nothing but identifiers (`Foo`, `red, blue`) as written. jsdom
lower-cases `inherit`, `initial`, `unset`, `revert` and `revert-layer` for
every property, reads `none` as a keyword, and rejects such a shadow, so
upstream's HTML and Swift's differed for those values.
`normalizeCSSValue` now does the same. `CSSTests` checks each property in
`css/properties` with the probes `css.test.ts` ran in jsdom, not only the
generated table, which is how the Rust port's runner found the
difference, and pins the keyword and shadow cases.
## Test plan
### Before
```
$ swift test --skip-build --filter ConformanceTests.CSSTests
✘ Test cssWideKeywordsAndShadows() recorded an issue at CSSTests.swift:57:5: Expectation failed: probe("font-family", "INHERIT") == "inherit"
✘ Test cssWideKeywordsAndShadows() recorded an issue at CSSTests.swift:58:5: Expectation failed: probe("box-shadow", "Unset") == "unset"
✘ Test cssWideKeywordsAndShadows() recorded an issue at CSSTests.swift:59:5: Expectation failed: probe("box-shadow", "NONE") == "none"
✘ Test cssWideKeywordsAndShadows() recorded an issue at CSSTests.swift:60:5: Expectation failed: probe("box-shadow", "Foo") == ""
✘ Test cssWideKeywordsAndShadows() recorded an issue at CSSTests.swift:61:5: Expectation failed: probe("text-shadow", "red, blue") == ""
✘ Test propertiesNormalizeAsJSDOM() recorded an issue at CSSTests.swift:48:7: Expectation failed: (probe(c.name, "Foo") == "Foo") == c.preserveCase
✘ Test propertiesNormalizeAsJSDOM() recorded an issue at CSSTests.swift:48:7: Expectation failed: (probe(c.name, "Foo") == "Foo") == c.preserveCase
✘ Test propertiesNormalizeAsJSDOM() recorded an issue at CSSTests.swift:48:7: Expectation failed: (probe(c.name, "Foo") == "Foo") == c.preserveCase
✘ Test run with 4 tests in 1 suite failed after 0.082 seconds with 8 issues.
```
### After
```
$ swift test --skip-build --filter ConformanceTests.CSSTests
✔ Test cssWideKeywordsAndShadows() passed after 0.002 seconds.
✔ Test cssTextNormalizesAsJSDOM() passed after 0.007 seconds.
✔ Test propertyTableMatchesVectors() passed after 0.008 seconds.
✔ Test propertiesNormalizeAsJSDOM() passed after 0.104 seconds.
✔ Test run with 4 tests in 1 suite passed after 0.105 seconds.
$ swift test --skip-build --filter "ConformanceTests|LexicalTests|LexicalHTMLTests|LexicalSelectionTests|LexicalClipboardTests"
✔ Test run with 34 tests in 13 suites passed after 0.514 seconds.
```
The expected values were checked against jsdom
(`element.style.setProperty(name, value)` then `getPropertyValue(name)`).
Linux only; macOS and iOS run in CI.
Amp-Thread-ID: https://ampcode.com/threads/T-506c8fa1-4309-40f1-9810-732b311eaeab
tmm
force-pushed
the
swift-css-shadow
branch
from
November 14, 2026 17:55
9f48b0b to
d77175c
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Swift's inline style declaration kept a CSS-wide keyword's case for
properties that keep identifiers' case (
font-family: INHERIT) or keepvalues as written (the shadows), and kept a
box-shadowortext-shadowof nothing but identifiers (
Foo,red, blue) as written. jsdomlower-cases
inherit,initial,unset,revertandrevert-layerforevery property, reads
noneas a keyword, and rejects such a shadow, soupstream's HTML and Swift's differed for those values.
normalizeCSSValuenow does the same.CSSTestschecks each property incss/propertieswith the probescss.test.tsran in jsdom, not only thegenerated table, which is how the Rust port's runner found the
difference, and pins the keyword and shadow cases.
Test plan
Before
After
The expected values were checked against jsdom
(
element.style.setProperty(name, value)thengetPropertyValue(name)).Linux only; macOS and iOS run in CI.