question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

keyframe selectors "overly analyzed"

See original GitHub issue

Suppose I have a CSS like this:

@keyframes RotateSlot {
  0% { margin-top: 0 }
  3% { margin-top: -2em }
  20% { margin-top: -2em }
  23% { margin-top: -4em }
  40% { margin-top: -4em }
  43% { margin-top: -6em }
  60% { margin-top: -6em }
  63% { margin-top: -8em }
  90% { margin-top: -8em }
  93% { margin-top: 0 }
  100% { margin-top: 0 }
}

When I run that, this happens:

▶ ./bin/minimalcss.js -d http://localhost:8080/keyframe.html
0% SyntaxError: Unmatched selector: %
3% SyntaxError: Unmatched selector: %
20% SyntaxError: Unmatched selector: %
23% SyntaxError: Unmatched selector: %
40% SyntaxError: Unmatched selector: %
43% SyntaxError: Unmatched selector: %
60% SyntaxError: Unmatched selector: %
63% SyntaxError: Unmatched selector: %
90% SyntaxError: Unmatched selector: %
93% SyntaxError: Unmatched selector: %
100% SyntaxError: Unmatched selector: %

It basically thinks 0% is a CSS selector and it tries to look for that in the DOM (using cheerio). I.e. dom('0%').length > 0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lahmatiycommented, Jan 20, 2018

Inside @keyframes a rules are using. That’s not a regular rules, but keyframe-block. However, at the moment CSSTree uses the same node type for both cases. I’m thinking about introducing an additional node types for that. For now you can use this.atrule.name and csstree.keyword() to filter rules, as you already did.

0reactions
peterbecommented, Jan 19, 2018

Let’s use csstree.keyword(this.atrule.name).basename instead of this.atrule.name

Read more comments on GitHub >

github_iconTop Results From Across the Web

keyframes - CSS: Cascading Style Sheets - MDN Web Docs
Each @keyframes rule contains a style list of keyframe selectors, which specify percentages along the animation when the keyframe occurs, and a ...
Read more >
Keyframe Animation Syntax | CSS-Tricks
Hi guys I want to be able to control the “frames” so I have 5 frames inside of one CSS sprite. They represent...
Read more >
CSS Keyframes: A Brief Introduction with Examples - Simplilearn
In CSS, keyframes are used for animations. It gives you more control over the animation you want to perform. The animation is created...
Read more >
Create more complex animations using CSS @keyframes
@keyframes animations are different. When animation-name and animation-duration are assigned to a selector, the properties and values contained ...
Read more >
How to dynamically create '@-Keyframe' CSS animations?
But, say you want to dynamically keep adding in keyframes over and over again, then your webpage get really ... This method has...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found