flackr / scroll-timeline

A polyfill of ScrollTimeline.
Apache License 2.0
887 stars 82 forks source link

Don't mangle ScrollTimeline and ViewTimeline class names to satisfy wpt. #225

Closed flackr closed 5 months ago

flackr commented 5 months ago

@johannesodland @bramus This is an alternative to #200 now that we can use terser and configure exactly which classnames it shouldn't mangle. This addresses item 2 from #219.

johannesodland commented 5 months ago

Nice 😀🙏🏻

flackr commented 5 months ago

Here's a size comparison of the different options:

keep_classnames size gzipped
false 51490 bytes 14.59 kB
/(Scroll\|View)Timeline/ 51705 bytes 14.61 kB
true 51949 bytes 14.64 kB

Given the relatively minimal change to code size, it's probably fine to keep all classnames in the interest of correctness. Of course it might be nice to be explicit about which classnames we expect to be preserved. I was thinking we may want to add classes like ScrollTimelineInternal in the WeakMap instead of the bare object we currently add so that we could have an easy to use location to attach internal functionality without needing a bunch of bare functions. In this case, these internal classes could be minified without issue.