GoogleChrome / inert-polyfill

Polyfill for the HTML inert attribute
Apache License 2.0
187 stars 48 forks source link

Difference between this polyfill and the WICG's one #11

Closed ciampo closed 4 years ago

ciampo commented 6 years ago

Hi,

was looking for the inert polyfill and I found both this one and https://github.com/WICG/inert . Can someone explain the differences between these 2 polyfills, and also the reason why there are 2 of them?

Thanks

Permik commented 6 years ago

A quote from the README:

If these limitations do not work for your project, there is also a WICG polyfill, which uses MutationObserver to recursively walk HTML trees to clear tabIndex (clearing or setting to -1). This is more correct, but will incur a performance hit when inert is enabled or disabled. The GoogleChrome hosted polyfill simply overloads focus and related events to prevent focus.

ciampo commented 6 years ago

Oh, I completely missed it. It makes sense — although it's quite confusing to have 2 polyfills for the same API. Developers using this polyfill may experience a behaviour that is different from the spec

samthor commented 4 years ago

Developers using either polyfill will likely experience behavior that is different from spec. :)

We cover this in limitations in the README, closing.