-
-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: prevent mangling of 'named timeline range names and percentages' in keyframe selectors #1518
Conversation
@@ -163,7 +163,7 @@ const tagReplacements = new Map([ | |||
function tag(selector) { | |||
const value = selector.value.toLowerCase(); | |||
|
|||
if (tagReplacements.has(value)) { | |||
if (tagReplacements.has(value) && selector.parent && selector.parent.nodes.length === 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the long delay in answering. It looks fine, but could you maybe write a comment explaining what the selector.parent
etc. check is trying to achieve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I refactored and added comments to clarify the handling of simple vs complex tag selectors. 7c68ea8
I'm not sure if checking parent node length is the best way to differentiate between a complex or a simple selector. Do you know if there is a better way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No better way comes to mind, in fact the codebase is full of this sort of parent checks. Partly I think it's because the parsers we use were mainly developed before the introduction of more recent CSS features.
Codecov ReportAll modified lines are covered by tests ✅
📢 Thoughts on this report? Let us know!. |
e7596d6
to
7c68ea8
Compare
This PR fixes an issue reported in #1460
Keyframe selectors from scroll-driven animations (named timeline range name and percentage) are mangled by replacing
100%
withto
in keyframe selectors where it is not valid.This PR fixes the issue by only replacing
100%
withto
when the parent selector only has one child node.