Re: [csswg-drafts] [css-selectors] :clicked for animations on click

I don't think this fit in the basic model of selectors. Selectors select elements based on their current state, not events fired on them. That said, selectors matching is not supposed to be described as a timeline. It simply applies to each specific moment of the document.

I understand that, event-triggered animation is a long-requested feature for CSS. Currently, the best approach to do is using the [Web Animations API](https://w3c.github.io/web-animations/). With that, you can do something like:
```javascript
elem.addEventListener("click", function() {
  elem.animate({ /* ... */ }, 200);
});
```

In the future, CSS might add some kind of event-triggered animation mechanism, but I don't think selectors spec would be the right place for this to happen in any sense.

-- 
GitHub Notification of comment by upsuper
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1674#issuecomment-323719283 using your GitHub account

Received on Monday, 21 August 2017 11:25:22 UTC