An open API service indexing awesome lists of open source software.

https://github.com/knowler/hidden-until-found-polyfill

A work in progress polyfill for the `hidden=until-found` HTML feature
https://github.com/knowler/hidden-until-found-polyfill

Last synced: 4 months ago
JSON representation

A work in progress polyfill for the `hidden=until-found` HTML feature

Awesome Lists containing this project

README

          

# `hidden=until-found` polyfill

This is a work-in-progress polyfill for the `hidden=until-found` feature which
will hide content until it’s found (i.e. usually via “find in page” browser
features). This only works in Firefox as there’s no way to detect find-in-page
activity in Safari. Chrome already supports the feature, so we don’t polyfill
it.

## Usage

The script should be loaded before any body content to ensure the mutation
observer picks up elements as they are added to the DOM.

```html

Hello, World!
```

## Limitations

- Does not work inside of shadow roots.
- Polyfilling declarative shadow DOM is heavy (i.e. you need to walk every
element) and selection changes inside the shadow DOM are complicated in
Firefox.
- Does not work in Safari.
- So, this is really only relevant for Firefox at this point.