From 12b1cb0d592cfd2a214d8e505d2dc09e075c441b Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 15 Jun 2022 12:25:47 +0200 Subject: [PATCH] Remove polyfill and point to new archived location --- README.md | 3 +- polyfill/.eslintrc | 45 - polyfill/.gitignore | 3 - polyfill/README.md | 213 -- polyfill/intersection-observer-test.html | 73 - polyfill/intersection-observer-test.js | 3329 ---------------------- polyfill/intersection-observer.js | 1014 ------- 7 files changed, 2 insertions(+), 4678 deletions(-) delete mode 100644 polyfill/.eslintrc delete mode 100644 polyfill/.gitignore delete mode 100644 polyfill/README.md delete mode 100644 polyfill/intersection-observer-test.html delete mode 100644 polyfill/intersection-observer-test.js delete mode 100644 polyfill/intersection-observer.js diff --git a/README.md b/README.md index 80f2e31f..52e690e8 100644 --- a/README.md +++ b/README.md @@ -10,4 +10,5 @@ Implementation status: [Draft Spec](https://w3c.github.io/IntersectionObserver/) -[Polyfill](./polyfill/) +Given that multiple native implementations of IntersectionObserver exist today, the polyfill that +was formerly maintained in this repo is no longer supported and has been archived at https://github.com/GoogleChromeLabs/intersection-observer. diff --git a/polyfill/.eslintrc b/polyfill/.eslintrc deleted file mode 100644 index 3cac2bab..00000000 --- a/polyfill/.eslintrc +++ /dev/null @@ -1,45 +0,0 @@ -{ - "env": { - "browser": true, - "node": true, - "mocha": true - }, - "globals": { - "expect": false, - "sinon": false - }, - "extends": [ - "eslint:recommended" - ], - "rules": { - // possible errors - "no-cond-assign": 0, - "no-empty": 0, - "valid-jsdoc": [2, { - "prefer": {"return": "return"}, - "requireReturn": false - }], - // best practices - "no-extra-bind": 2, - // style - "comma-spacing": [2, {"before": false, "after": true}], - "eol-last": [0], - "key-spacing": [2, {"beforeColon": false, "afterColon": true}], - "linebreak-style": [2, "unix"], - "max-len": [2, 80, {"ignoreUrls": true}], - "no-multiple-empty-lines": [2, {"max": 2}], - "no-unused-vars": ["error", {"vars": "all"}], - "no-trailing-spaces": 2, - "object-curly-spacing": [2, "never"], - "quotes": [2, "single"], - "require-jsdoc": [2, { - "require": { - "FunctionDeclaration": true, - "MethodDefinition": true, - "ClassDeclaration": true - } - }], - "semi": [2, "always"], - "semi-spacing": [2, {"before": false, "after": true}], - } -} \ No newline at end of file diff --git a/polyfill/.gitignore b/polyfill/.gitignore deleted file mode 100644 index 24000a81..00000000 --- a/polyfill/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Sauce Labs testing files -easy-sauce-config.json -sauce.sh diff --git a/polyfill/README.md b/polyfill/README.md deleted file mode 100644 index 6d9bcb2f..00000000 --- a/polyfill/README.md +++ /dev/null @@ -1,213 +0,0 @@ -# `IntersectionObserver` polyfill - -This library polyfills the native [`IntersectionObserver`](http://w3c.github.io/IntersectionObserver/) API in unsupporting browsers. See the [API documentation](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) for usage information. - -- [Installation](#installation) -- [Configuring the polyfill](#configuring-the-polyfill) -- [Limitations](#limitations) -- [Browser support](#browser-support) -- [Running the tests](#running-the-tests) - -## Installation - -You can install the polyfill via npm or by downloading a [zip](https://github.com/w3c/IntersectionObserver/archive/gh-pages.zip) of this repository: - -```sh -npm install intersection-observer -``` - -### Adding the polyfill to your site - -The examples below show various ways to add the `IntersectionObserver` polyfill to your site. Be sure to include the polyfill prior to referencing it anywhere in your JavaScript code. - -**Using ` - - - -``` - -**Using a module loader (e.g. Browserify or Webpack):** - -```js -// Require the polyfill before requiring any other modules. -require('intersection-observer'); - -require('./foo.js'); -require('./bar.js'); -``` - -## Configuring the polyfill - -It's impossible to handle all possible ways a target element could intersect with a root element without resorting to constantly polling the document for intersection changes. - -To avoid this extra work and performance penalty, the default configuration of the polyfill optimizes for the most common `IntersectionObserver` use cases, which primarily include target elements intersecting with a root element due to: - -- User scrolling. -- Resizing the window. -- Changes to the DOM. - -All of the above can be handled without polling the DOM. - -There are, however, additional use cases that the default configuration will not detect. These include target elements intersecting with a root element due to: - -- CSS changes on `:hover`, `:active`, or `:focus` states. -- CSS changes due to transitions or animations with a long initial delay. -- Resizable `