Repository navigation
css: recognize ::details-content, ::picker(), ::checkmark and ::picker-icon - #41122
Conversation
…r-icon These pseudo-elements are defined in css-pseudo-4 and css-forms-1 and are in lightningcss 1.33.0's lookup tables. Bun's port missed them, so it warned 'Unsupported pseudo-class or pseudo-element' on valid CSS. Add the three simple entries to lookup_pseudo_element and the picker() entry to the functional table. Each is a real PseudoElement variant with its own serialization, as upstream does. Fixes #41120
|
Scope looks right to me, thanks for the fast turnaround. Two follow-ups, and the parity rule puts them in different places.
The scroll-marker family I will take upstream instead. You are right that lightningcss master lacks |
|
Sounds good. This PR stays at the four parity entries. One note for the :target-current port: lightningcss accepts it only when the scroll_navigation_controls option is set, and that option is off by default. Bun does not surface a switch for it in bun build today. So the port needs a decision: hard-enable the three entries, or carry the flag and pick a default. Worth stating in your PR body. Linking the lightningcss PRs here works well. Once they land upstream, the scroll-marker family reaches Bun through the normal table updates. |
|
Both linked, and the flag question has an answer I can measure rather than pick. Hard-enable. The cost is not only the diagnostic, and I would rather state it up front. Recognizing the three moves them out of Ordering: this wants to go in after #38572, since that is what makes the gap visible. The scroll-marker family is now up at parcel-bundler/lightningcss#1321, against #1177. It adds the three pseudo-elements behind the |
|
Opened as #41139, hard-enabled, with the One correction to what I wrote above, since it was an objection I raised and it does not hold. I said recognizing these would turn on The scroll-marker family is at parcel-bundler/lightningcss#1321 against their #1177. |
Problem
bun buildwarnsInvalid selector. Unsupported pseudo-class or pseudo-element 'details-content'(and the same forpicker,checkmark,picker-icon) on valid CSS. The emitted CSS is correct, only the diagnostic is wrong.src/css/selectors/parser.rstrail lightningcss 1.33.0, the source this parser is ported from.lookup_pseudo_element(line 1528) missesdetails-content,picker-icon,checkmark. The functional table inparse_functional_pseudo_element(line 1238) missespicker().Fix
PseudoElementvariant with its own serialization (DetailsContent,PickerIcon,Checkmark,PickerFunction { identifier: Ident }), the same shape lightningcss uses, not a mapping toCustom.::picker()parses one<ident>argument, as upstream does. The simple entries go through the existing case-insensitive table, so::DETAILS-CONTENTnow serializes as::details-content.::scroll-marker,::scroll-marker-group,::scroll-button()) from the issue still warns. lightningcss warns on those too, including current master, so this PR stays at upstream parity.test/bundler/css/forms-pseudo-elements-41120.test.ts(both tests fail on 1.4.1). Also rantest/bundler/css/(174 pass) andtest/js/bun/css/(failures there are pre-existing fuzz-test timeouts, identical on an unpatched build).Background
PseudoElement::Custom, passes through unchanged, and warns unless it is vendor-prefixed. The warning path is intentional and is not touched here.::details-contentis css-pseudo-4.::picker(),::picker-icon,::checkmarkare css-forms-1 (the customizable<select>styling). All four ship in Chromium stable.pickerentry follows that shape, with the comment updated for the new length set.Notes
src/selector.rs:details-content(line 284),picker-icon(line 310),checkmark(line 311) in the simple table,pickerin the functional table (line 339). No scroll-marker family entries there, on the tag or on master.:target-currentfrom the issue is quiet in Bun today because bare pseudo-class warnings gate on a_prefix instead of-. css: warn about unknown bare pseudo-classes unless they are vendor prefixed #38572 fixes that gate separately. Upstream gates:target-currentbehind a non-defaultscroll_navigation_controlsoption, so no entry is added here.::picker(not an ident)now fails selector parsing instead of parsing as a custom function. lightningcss behaves the same way.src/css/selectors/parser.rsandsrc/css/selectors/selector.rsmatch on these variants.CssEql/CssHashcome from derives. The targets-compat check inselector.rstreats the new variants like other post-selectors-4 pseudo-elements (not downlevelable), unchanged from upstream.[human-review] gate passed · iteration 0 · 3 files touched
fails on main (without fix)
passes on PR (with fix)
diff hotspot
gate history · 1 passed · 0 rejected · iteration 0
evidence per changed file
root cause · written by the author bot
The pseudo-element lookup tables in the CSS selector parser were ported from an older snapshot of lightningcss and lacked entries that upstream later added, so
::details-content,::picker(),::checkmarkand::picker-iconfell through to the fallback path that emits an "unsupported pseudo-element" warning while still passing the selector through as a custom pseudo-element. The fix adds these four names as proper pseudo-element variants with upstream-matching serialization, including registeringpicker()in the functional pseudo-element table, so they parse cleanly without warnings.…