W3C home > Mailing lists > Public > public-fx@w3.org > October to December 2015

Re: [css3-animations] Declaring an animation to trigger when element is detached from the DOM

From: Kristopher Giesing <kris.giesing@gmail.com>
Date: Tue, 8 Dec 2015 19:01:08 -0800
Message-ID: <CAAhnRF-VfSsBx4kOVM8c0XnQcOqfHoi9_q9w6SVsjSQTu-LqEQ@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Rachel Nabors <rachelnabors@gmail.com>, Zacqary Adam Xeper <zacqary.xeper@datadoghq.com>, www-style list <www-style@w3.org>, "public-fx@w3.org" <public-fx@w3.org>
I've often thought it would be nice if there was a meta selector for
"detached" so that each author didn't have to create their own custom
property.  If there were such a meta selector then the existing transition
syntax for CSS would be sufficient to create entry and exit transitions as
elements were attached and detached.

Cheers,

- Kris

On Tue, Dec 8, 2015 at 3:19 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

> On Mon, Nov 23, 2015 at 10:30 PM, Rachel Nabors <rachelnabors@gmail.com>
> wrote:
> > I see the need. I would argue that this would be more of an
> "exit-transition" than exit-animation, though: fires once and describes how
> values should change (upon application and in accordance with :detached)
>
> Right, but the "enter animation" is also basically an enter
> transition.  The CSS animation syntax is explicitly intended for
> animations that play continuously while the element is in some state;
> it just so happens that it's fairly easy to tweak things so that an
> animation plays only once and then goes quiet, simulating something
> that happens on "entrance" to the state.
>
> If we feel like it's important to do this without JS, then we need to
> do it *properly*, not just layer further hacks over the already-abused
> Animation syntax.  I put together a proposal for that a few years ago,
> documented at <http://www.xanthir.com/b4LH0>.  In short, you'd use
> some custom property to track your "state", then use a rule like:
>
> @transition selector > for.the-element {
>   over: --foo;
>   from: the-state;
>   to: *;
>   animation: foo-animation 1s;
> }
>
> And now, anytime the --foo property changes from "--foo: the-state;"
> to anything else, it'll fire the animation.
>
> ~TJ
>
>
Received on Wednesday, 9 December 2015 03:01:40 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 9 December 2015 03:01:40 UTC