Repository navigation
Selectors cssparser upgrade - #264
Conversation
|
I'd missed the additional tests that get run by the script. I'll try understanding what broke when I have time. |
|
there is a test failure. This seems like an edge case, so I'm not sure if that's an implementation problem, or the test needs updating. |
|
I'm looking into it right now. The test is correct, so there's a regression somewhere. |
|
I'm still not sure what changed but basically CSS doesn't consider an empty string to start or end by an empty string. |
This finally resolves the dependency on phf 0.8. - Port to_unconditional from selectors – this is no longer implemented for ParsedCaseSensitivity. - Add PhantomData to ExtraMatchingData which now requires a lifetime. - Add unsupported Has(_) type
|
So the current issue is in With I think this may be a legit use-after-free error, or at least an incompatibility of selectors with WASM. I've tracked it down to The /// A selector list is a tagged pointer with either a single selector, or a ThinArc<()> of multiple
/// selectors.
#[derive(Clone, Eq, Debug, PartialEq)]
#[cfg_attr(feature = "to_shmem", derive(ToShmem))]
#[cfg_attr(feature = "to_shmem", shmem(no_bounds))]
pub struct SelectorList<Impl: SelectorImpl>(
#[cfg_attr(feature = "to_shmem", shmem(field_bound))]
ThinArcUnion<SpecificityAndFlags, Component<Impl>, (), Selector<Impl>>,
); |
|
|
🚢 Thank you for this, looks like we can get rid of the duplicate crates in downstream projects now. |
|
Any chance of getting a new release out? I'd really like to get this improvement in our projects |
Per the Selectors spec, `[att^=""]`, `[att$=""]`, `[att*=""]` and `[att~=""]` represent nothing. Since the selectors/cssparser upgrade in cloudflare#264 (v2.4.0), the prefix and suffix matchers checked that the element's attribute value is non-empty instead of the selector's value, and the whitespace-list matcher had no check at all, so an empty value matched the empty item produced by an empty value or by leading, trailing or repeated whitespace. `[att*=""]` was already right. Check the selector's value instead, as the selectors crate does in `AttrSelectorOperator::eval_str`. The W3C css3-modsel-184 fixtures only cover `class=""` and a missing attribute, so they passed with the old check. Fixes cloudflare#341 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Per the Selectors spec, `[att^=""]`, `[att$=""]`, `[att*=""]` and `[att~=""]` represent nothing. Since the selectors/cssparser upgrade in cloudflare#264 (v2.4.0), the prefix and suffix matchers checked that the element's attribute value is non-empty instead of the selector's value, and the whitespace-list matcher had no check at all, so an empty value matched the empty item produced by an empty value or by leading, trailing or repeated whitespace. `[att*=""]` was already right. Check the selector's value instead, as the selectors crate does in `AttrSelectorOperator::eval_str`. The W3C css3-modsel-184 fixtures only cover `class=""` and a missing attribute, so they passed with the old check. Fixes cloudflare#341 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Per the Selectors spec, `[att^=""]`, `[att$=""]`, `[att*=""]` and `[att~=""]` represent nothing. Since the selectors/cssparser upgrade in #264 (v2.4.0), the prefix and suffix matchers checked that the element's attribute value is non-empty instead of the selector's value, and the whitespace-list matcher had no check at all, so an empty value matched the empty item produced by an empty value or by leading, trailing or repeated whitespace. `[att*=""]` was already right. Check the selector's value instead, as the selectors crate does in `AttrSelectorOperator::eval_str`. The W3C css3-modsel-184 fixtures only cover `class=""` and a missing attribute, so they passed with the old check. Fixes #341 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This takes the branch from #250 (comment) and applies some additional commits to make this work. I'm not sure if this is correct, but tests pass. The biggest change I did was making tests have
[foo*=""]require attributes, which it wasn't expecting before.Closes #250
Closes #262