polyfill-library 4.7.0 → 4.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +4 -4
- package/README.md +41 -0
- package/package.json +10 -21
- package/polyfills/__dist/Array.prototype.sort/meta.json +1 -1
- package/polyfills/__dist/Array.prototype.sort/min.js +1 -1
- package/polyfills/__dist/Array.prototype.sort/raw.js +20 -9
- package/polyfills/__dist/Array.prototype.toReversed/meta.json +1 -0
- package/polyfills/__dist/Array.prototype.toReversed/min.js +1 -0
- package/polyfills/__dist/Array.prototype.toReversed/raw.js +29 -0
- package/polyfills/__dist/Array.prototype.toSorted/meta.json +1 -0
- package/polyfills/__dist/Array.prototype.toSorted/min.js +1 -0
- package/polyfills/__dist/Array.prototype.toSorted/raw.js +37 -0
- package/polyfills/__dist/Array.prototype.toSpliced/meta.json +1 -0
- package/polyfills/__dist/Array.prototype.toSpliced/min.js +1 -0
- package/polyfills/__dist/Array.prototype.toSpliced/raw.js +96 -0
- package/polyfills/__dist/Array.prototype.with/meta.json +1 -0
- package/polyfills/__dist/Array.prototype.with/min.js +1 -0
- package/polyfills/__dist/Array.prototype.with/raw.js +60 -0
- package/polyfills/__dist/HTMLFormElement.prototype.requestSubmit/meta.json +1 -0
- package/polyfills/__dist/HTMLFormElement.prototype.requestSubmit/min.js +1 -0
- package/polyfills/__dist/HTMLFormElement.prototype.requestSubmit/raw.js +116 -0
- package/polyfills/__dist/IntersectionObserver/meta.json +1 -1
- package/polyfills/__dist/IntersectionObserver/min.js +1 -1
- package/polyfills/__dist/IntersectionObserver/raw.js +2 -1
- package/polyfills/__dist/IntersectionObserverEntry/meta.json +1 -1
- package/polyfills/__dist/Intl.DateTimeFormat.~locale.en-US-POSIX/meta.json +1 -1
- package/polyfills/__dist/Intl.NumberFormat.~locale.he/meta.json +1 -1
- package/polyfills/__dist/Intl.NumberFormat.~locale.id/meta.json +1 -1
- package/polyfills/__dist/Intl.NumberFormat.~locale.jv/meta.json +1 -1
- package/polyfills/__dist/Intl.NumberFormat.~locale.sr-Latn/meta.json +1 -1
- package/polyfills/__dist/Intl.NumberFormat.~locale.sr-Latn-BA/meta.json +1 -1
- package/polyfills/__dist/Intl.NumberFormat.~locale.sr-Latn-ME/meta.json +1 -1
- package/polyfills/__dist/Intl.NumberFormat.~locale.sr-Latn-XK/meta.json +1 -1
- package/polyfills/__dist/Intl.RelativeTimeFormat.~locale.en-US-POSIX/meta.json +1 -1
- package/polyfills/__dist/Intl.RelativeTimeFormat.~locale.he/meta.json +1 -1
- package/polyfills/__dist/Intl.RelativeTimeFormat.~locale.id/meta.json +1 -1
- package/polyfills/__dist/Intl.RelativeTimeFormat.~locale.jv/meta.json +1 -1
- package/polyfills/__dist/Intl.RelativeTimeFormat.~locale.sr-Latn/meta.json +1 -1
- package/polyfills/__dist/Intl.RelativeTimeFormat.~locale.sr-Latn-BA/meta.json +1 -1
- package/polyfills/__dist/Intl.RelativeTimeFormat.~locale.sr-Latn-ME/meta.json +1 -1
- package/polyfills/__dist/Intl.RelativeTimeFormat.~locale.sr-Latn-XK/meta.json +1 -1
- package/polyfills/__dist/ResizeObserver/min.js +1 -1
- package/polyfills/__dist/ResizeObserver/raw.js +5 -5
- package/polyfills/__dist/TypedArray.prototype.@@toStringTag/raw.js +1 -1
- package/polyfills/__dist/TypedArray.prototype.at/raw.js +1 -1
- package/polyfills/__dist/TypedArray.prototype.entries/meta.json +1 -1
- package/polyfills/__dist/TypedArray.prototype.entries/min.js +1 -1
- package/polyfills/__dist/TypedArray.prototype.entries/raw.js +21 -25
- package/polyfills/__dist/TypedArray.prototype.findLast/meta.json +1 -1
- package/polyfills/__dist/TypedArray.prototype.findLast/min.js +1 -1
- package/polyfills/__dist/TypedArray.prototype.findLast/raw.js +12 -11
- package/polyfills/__dist/TypedArray.prototype.findLastIndex/meta.json +1 -1
- package/polyfills/__dist/TypedArray.prototype.findLastIndex/min.js +1 -1
- package/polyfills/__dist/TypedArray.prototype.findLastIndex/raw.js +12 -11
- package/polyfills/__dist/TypedArray.prototype.keys/meta.json +1 -1
- package/polyfills/__dist/TypedArray.prototype.keys/min.js +1 -1
- package/polyfills/__dist/TypedArray.prototype.keys/raw.js +21 -25
- package/polyfills/__dist/TypedArray.prototype.sort/meta.json +1 -0
- package/polyfills/__dist/TypedArray.prototype.sort/min.js +1 -0
- package/polyfills/__dist/TypedArray.prototype.sort/raw.js +71 -0
- package/polyfills/__dist/TypedArray.prototype.toReversed/meta.json +1 -0
- package/polyfills/__dist/TypedArray.prototype.toReversed/min.js +1 -0
- package/polyfills/__dist/TypedArray.prototype.toReversed/raw.js +50 -0
- package/polyfills/__dist/TypedArray.prototype.toSorted/meta.json +1 -0
- package/polyfills/__dist/TypedArray.prototype.toSorted/min.js +1 -0
- package/polyfills/__dist/TypedArray.prototype.toSorted/raw.js +59 -0
- package/polyfills/__dist/TypedArray.prototype.with/meta.json +1 -0
- package/polyfills/__dist/TypedArray.prototype.with/min.js +1 -0
- package/polyfills/__dist/TypedArray.prototype.with/raw.js +83 -0
- package/polyfills/__dist/_ESAbstract.IsValidIntegerIndex/meta.json +1 -0
- package/polyfills/__dist/_ESAbstract.IsValidIntegerIndex/min.js +1 -0
- package/polyfills/__dist/_ESAbstract.IsValidIntegerIndex/raw.js +16 -0
- package/polyfills/__dist/_ESAbstract.TypedArrayCreate/meta.json +1 -0
- package/polyfills/__dist/_ESAbstract.TypedArrayCreate/min.js +1 -0
- package/polyfills/__dist/_ESAbstract.TypedArrayCreate/raw.js +20 -0
- package/polyfills/__dist/_ESAbstract.TypedArrayCreateSameType/meta.json +1 -0
- package/polyfills/__dist/_ESAbstract.TypedArrayCreateSameType/min.js +1 -0
- package/polyfills/__dist/_ESAbstract.TypedArrayCreateSameType/raw.js +41 -0
- package/polyfills/__dist/aliases.json +1 -1
- package/polyfills/__dist/atob/meta.json +1 -1
- package/polyfills/__dist/atob/min.js +1 -1
- package/polyfills/__dist/atob/raw.js +22 -16
package/CHANGELOG.md
CHANGED
@@ -4,10 +4,10 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
4
4
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
6
6
|
|
7
|
-
#### [v4.
|
7
|
+
#### [v4.8.0](https://github.com/Financial-Times/polyfill-library/compare/v4.8.0...v4.8.0)
|
8
8
|
|
9
|
-
#### v4.
|
9
|
+
#### v4.8.0
|
10
10
|
|
11
|
-
>
|
11
|
+
> 26 June 2023
|
12
12
|
|
13
|
-
-
|
13
|
+
- Bump semver from 7.5.0 to 7.5.2 [`#1298`](https://github.com/Financial-Times/polyfill-library/pull/1298)
|
package/README.md
CHANGED
@@ -84,6 +84,47 @@ Create a polyfill bundle.
|
|
84
84
|
|
85
85
|
Returns a polyfill bundle as either a utf-8 ReadStream or as a Promise of a utf-8 String.
|
86
86
|
|
87
|
+
## AWS Lambda
|
88
|
+
|
89
|
+
To use this package in an AWS Lambda function, you need to include the distribution Polyfills located in `./node_modules/polyfill-library/polyfills/__dist` in the root directory of your Lambda. In AWS, Lambdas are executed in the `/var/task/...` directory. Therefore, during execution, the directory where the polyfills will be located will be `/var/task/polyfill-library/__dist`.
|
90
|
+
|
91
|
+
### Example of a script to copy files
|
92
|
+
|
93
|
+
The following snippet will allow us to copy the polyfills to our already compiled Lambda. To do this, we will first install the necessary dependencies.
|
94
|
+
|
95
|
+
```bash
|
96
|
+
yarn add -D make-dir fs-extra
|
97
|
+
```
|
98
|
+
|
99
|
+
Once the dependencies are installed, we will create the file with the script at `/scripts/polyfills-serverless.mjs` and replace `YOUR_BUNDELED_LAMBDA_DIRECTORY` with the directory that contains our packaged Lambda.
|
100
|
+
|
101
|
+
In the example, we will use the directory `./.serverless_nextjs/api-lambda`, which is the one used when using Serverless Next.js.
|
102
|
+
|
103
|
+
```js
|
104
|
+
import { copySync } from 'fs-extra/esm';
|
105
|
+
import makeDir from 'make-dir';
|
106
|
+
|
107
|
+
const DIR_POLYFILLS = './node_modules/polyfill-library/polyfills/__dist';
|
108
|
+
// const DIR_SERVERLESS = 'YOUR_BUNDELED_LAMBDA_DIRECTORY/polyfills/__dist';
|
109
|
+
const DIR_SERVERLESS = './.serverless_nextjs/api-lambda/polyfills/__dist';
|
110
|
+
|
111
|
+
const paths = await makeDir(DIR_SERVERLESS);
|
112
|
+
console.log(`The directory ${paths} is created successfully.`);
|
113
|
+
|
114
|
+
try {
|
115
|
+
console.log('Copying polyfills to serverless directory...');
|
116
|
+
copySync(DIR_POLYFILLS, DIR_SERVERLESS, { overwrite: false });
|
117
|
+
console.log('Polyfills copied successfully!');
|
118
|
+
} catch (err) {
|
119
|
+
console.error(err);
|
120
|
+
}
|
121
|
+
```
|
122
|
+
|
123
|
+
To execute the script, you will need to run the following command:
|
124
|
+
|
125
|
+
```bash
|
126
|
+
node ./scripts/polyfills-serverless.mjs
|
127
|
+
```
|
87
128
|
|
88
129
|
## Contributing
|
89
130
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "polyfill-library",
|
3
|
-
"version": "4.
|
3
|
+
"version": "4.8.0",
|
4
4
|
"description": "A polyfill combinator",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"contributors": [
|
@@ -33,10 +33,8 @@
|
|
33
33
|
"test-polyfills": "karma start",
|
34
34
|
"test-all-polyfills": "node ./test/polyfills/test-all-features.js",
|
35
35
|
"test-end-to-end": "mocha test/end-to-end/**/*.test.js",
|
36
|
-
"test-node": "mocha test/node/**/*.js",
|
37
|
-
"test-node-unit": "
|
38
|
-
"test-node-coverage": "nyc check-coverage --lines 90 --branches 90 --functions 90",
|
39
|
-
"test-coverage": "nyc report --reporter=lcov",
|
36
|
+
"test-node": "nyc mocha test/node/**/*.js",
|
37
|
+
"test-node-unit": "mocha test/unit --recursive",
|
40
38
|
"test": "npm run build && npm run test-node && npm run test-node-unit && npm run test-polyfills",
|
41
39
|
"prepublishOnly": "npm run build && mv polyfills/__dist __dist && rimraf polyfills && mkdir polyfills && mv __dist polyfills/__dist",
|
42
40
|
"create-new-polyfill": "node ./tasks/create-new-polyfill.js",
|
@@ -87,20 +85,17 @@
|
|
87
85
|
"Base64": "^1.0.0",
|
88
86
|
"bluebird": "^3.7.2",
|
89
87
|
"browserstack": "1.6.1",
|
90
|
-
"browserstack-local": "^1.
|
88
|
+
"browserstack-local": "^1.5.2",
|
91
89
|
"chai": "^4.3.4",
|
92
90
|
"cli-color": "^2.0.0",
|
93
91
|
"compression": "^1.7.4",
|
94
|
-
"
|
95
|
-
"diff": "4.0.2",
|
92
|
+
"diff": "^5.0.0",
|
96
93
|
"dotenv": "^8.2.0",
|
97
94
|
"eslint": "^7.0.0",
|
98
95
|
"eslint-plugin-uncalled-iife": "^1.0.2",
|
99
96
|
"eslint-plugin-unicorn": "^27.0.0",
|
100
97
|
"execa": "^5.0.0",
|
101
98
|
"express": "^4.17.3",
|
102
|
-
"fastestsmallesttextencoderdecoder": "1.0.22",
|
103
|
-
"fs-extra": "^9.0.1",
|
104
99
|
"glob": "^7.1.1",
|
105
100
|
"globby": "^11.0.0",
|
106
101
|
"handlebars": "^4.7.2",
|
@@ -108,36 +103,30 @@
|
|
108
103
|
"html5shiv": "^3.7.3",
|
109
104
|
"js-polyfills": "^0.1.40",
|
110
105
|
"karma": "^6.0.0",
|
111
|
-
"karma-browserstack-launcher": "^1.
|
106
|
+
"karma-browserstack-launcher": "^1.6.0",
|
112
107
|
"karma-firefox-launcher": "^2.1.2",
|
113
108
|
"karma-mocha": "^2.0.1",
|
114
109
|
"karma-mocha-reporter": "^2.2.5",
|
115
|
-
"karma-summary-optional-console-reporter": "^1.6.1",
|
116
110
|
"lodash": "^4.17.14",
|
117
|
-
"mkdirp": "^1.0.4",
|
118
111
|
"mocha": "^3.5.3",
|
119
112
|
"mockery": "^2.1.0",
|
120
113
|
"mutationobserver-shim": "^0.3.2",
|
121
114
|
"nyc": "^15.0.0",
|
122
115
|
"picturefill": "^3.0.1",
|
123
|
-
"prettier": "^2.0.5",
|
124
116
|
"proclaim": "^3.6.0",
|
125
117
|
"rimraf": "^3.0.0",
|
126
118
|
"seamless-scroll-polyfill": "1.2.4",
|
127
119
|
"semver": "^7.3.7",
|
128
|
-
"sinon": "^
|
120
|
+
"sinon": "^15.0.0",
|
129
121
|
"spdx-licenses": "^1.0.0",
|
130
122
|
"uglify-js": "^2.7.5",
|
131
123
|
"unorm": "^1.6.0",
|
132
124
|
"usertiming": "^0.1.8",
|
133
125
|
"web-animations-js": "^2.2.5",
|
134
|
-
"webdriverio": "^
|
135
|
-
"whatwg-fetch": "^3.6.2"
|
136
|
-
"yaku": "1.0.1",
|
137
|
-
"yaml": "^1.1.0"
|
126
|
+
"webdriverio": "^8.0.0",
|
127
|
+
"whatwg-fetch": "^3.6.2"
|
138
128
|
},
|
139
129
|
"volta": {
|
140
|
-
"node": "
|
141
|
-
"npm": "6.14.16"
|
130
|
+
"node": "16.20.0"
|
142
131
|
}
|
143
132
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"aliases":["es6","es2015","modernizr:es6array"],"dependencies":["_ESAbstract.CreateMethodProperty","_ESAbstract.IsCallable"],"license":"MIT","spec":"http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.sort","docs":"https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/sort","browsers":{"android":"*","chrome":"<70","edge":"*","edge_mob":"*","firefox":"<3","ie":"*","ie_mob":"*","opera":"<57","op_mob":"<49","safari":"<10.1","ios_saf":"<10.3","samsung_mob":"<10.0"},"detectSource":"\"sort\"in Array.prototype&&function(){var r={length:3,0:2,1:1,2:3}\nreturn Array.prototype.sort.call(r,function(r,t){return r-t})===r}()\n","baseDir":"Array/prototype/sort","hasTests":true,"isTestable":true,"isPublic":true,"size":
|
1
|
+
{"aliases":["es6","es2015","modernizr:es6array"],"dependencies":["_ESAbstract.CreateMethodProperty","_ESAbstract.IsCallable"],"license":"MIT","spec":"http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.sort","docs":"https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/sort","browsers":{"android":"*","chrome":"<70","edge":"*","edge_mob":"*","firefox":"<3","ie":"*","ie_mob":"*","opera":"<57","op_mob":"<49","safari":"<10.1","ios_saf":"<10.3","samsung_mob":"<10.0"},"detectSource":"\"sort\"in Array.prototype&&function(){var r={length:3,0:2,1:1,2:3}\nreturn Array.prototype.sort.call(r,function(r,t){return r-t})===r}()\n","baseDir":"Array/prototype/sort","hasTests":true,"isTestable":true,"isPublic":true,"size":602}
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";var origSort=Array.prototype.sort;CreateMethodProperty(Array.prototype,"sort",function r
|
1
|
+
"use strict";var origSort=Array.prototype.sort;CreateMethodProperty(Array.prototype,"sort",function t(r){if(void 0!==r&&!1===IsCallable(r))throw new TypeError("The comparison function must be either a function or undefined");if(void 0===r)origSort.call(this);else{var i,e=[];for(i=0;i<this.length;i++)i in this&&e.push({item:this[i],index:i});for(origSort.call(e,function(t,i){if(void 0===i.item)return-1;if(void 0===t.item)return 1;var e=+r.call(void 0,t.item,i.item)||0;return 0===e?t.index-i.index:e}),i=0;i<e.length;)e[i]&&(this[i]=e[i].item),i++;for(;i<this.length;)delete this[i++]}return this});
|
@@ -33,22 +33,33 @@ CreateMethodProperty(Array.prototype, "sort", function sort(compareFn) {
|
|
33
33
|
// if compareFn exists, sort the array, breaking sorting ties by using the
|
34
34
|
// items' original index position.
|
35
35
|
|
36
|
+
var index;
|
37
|
+
|
36
38
|
// Keep track of the items starting index position.
|
37
|
-
var that =
|
38
|
-
|
39
|
-
|
39
|
+
var that = [];
|
40
|
+
for (index = 0; index < this.length; index++) {
|
41
|
+
if (index in this) {
|
42
|
+
that.push({ item: this[index], index: index });
|
43
|
+
}
|
44
|
+
}
|
40
45
|
origSort.call(that, function(a, b) {
|
41
|
-
|
46
|
+
// this implementation is based on https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.sort.js#L69-L76
|
47
|
+
if (b.item === undefined) return -1;
|
48
|
+
if (a.item === undefined) return 1;
|
49
|
+
var compareResult = +(compareFn.call(undefined, a.item, b.item)) || 0;
|
42
50
|
return compareResult === 0 ? a.index - b.index : compareResult;
|
43
51
|
});
|
44
52
|
// update the original object (`this`) with the new position for the items
|
45
53
|
// which were moved.
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
}
|
54
|
+
index = 0;
|
55
|
+
while (index < that.length) {
|
56
|
+
if (that[index]) {
|
57
|
+
this[index] = that[index].item;
|
51
58
|
}
|
59
|
+
index++;
|
60
|
+
}
|
61
|
+
while (index < this.length) {
|
62
|
+
delete this[index++];
|
52
63
|
}
|
53
64
|
}
|
54
65
|
|
@@ -0,0 +1 @@
|
|
1
|
+
{"aliases":["es2023"],"dependencies":["_ESAbstract.ArrayCreate","_ESAbstract.CreateDataPropertyOrThrow","_ESAbstract.CreateMethodProperty","_ESAbstract.Get","_ESAbstract.LengthOfArrayLike","_ESAbstract.ToObject","_ESAbstract.ToString"],"license":"MIT","spec":"https://tc39.es/ecma262/#sec-array.prototype.toreversed","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toReversed","browsers":{"android":"*","bb":"*","chrome":"<110","edge":"*","edge_mob":"*","firefox":"*","firefox_mob":"*","ie":"*","ie_mob":"*","opera":"<96","op_mob":"<74","op_mini":"*","safari":"<16.3","ios_saf":"<16.3","samsung_mob":"*"},"detectSource":"\"toReversed\"in Array.prototype\n","baseDir":"Array/prototype/toReversed","hasTests":true,"isTestable":true,"isPublic":true,"size":234}
|
@@ -0,0 +1 @@
|
|
1
|
+
CreateMethodProperty(Array.prototype,"toReversed",function r(){for(var e=ToObject(this),t=LengthOfArrayLike(e),o=ArrayCreate(t),a=0;a<t;){var n=ToString(t-a-1),y=ToString(a),i=Get(e,n);CreateDataPropertyOrThrow(o,y,i),a+=1}return o});
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
// Array.prototype.toReversed
|
3
|
+
/* global ArrayCreate, CreateDataPropertyOrThrow, CreateMethodProperty, Get, LengthOfArrayLike, ToObject, ToString */
|
4
|
+
// 23.1.3.33 Array.prototype.toReversed ( )
|
5
|
+
CreateMethodProperty(Array.prototype, 'toReversed', function toReversed() {
|
6
|
+
// 1. Let O be ? ToObject(this value).
|
7
|
+
var O = ToObject(this);
|
8
|
+
// 2. Let len be ? LengthOfArrayLike(O).
|
9
|
+
var len = LengthOfArrayLike(O);
|
10
|
+
// 3. Let A be ? ArrayCreate(len).
|
11
|
+
var A = ArrayCreate(len);
|
12
|
+
// 4. Let k be 0.
|
13
|
+
var k = 0;
|
14
|
+
// 5. Repeat, while k < len,
|
15
|
+
while (k < len) {
|
16
|
+
// a. Let from be ! ToString(𝔽(len - k - 1)).
|
17
|
+
var from = ToString(len - k - 1);
|
18
|
+
// b. Let Pk be ! ToString(𝔽(k)).
|
19
|
+
var Pk = ToString(k);
|
20
|
+
// c. Let fromValue be ? Get(O, from).
|
21
|
+
var fromValue = Get(O, from);
|
22
|
+
// d. Perform ! CreateDataPropertyOrThrow(A, Pk, fromValue).
|
23
|
+
CreateDataPropertyOrThrow(A, Pk, fromValue);
|
24
|
+
// e. Set k to k + 1.
|
25
|
+
k = k + 1;
|
26
|
+
}
|
27
|
+
// 6. Return A.
|
28
|
+
return A;
|
29
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
{"aliases":["es2023"],"dependencies":["_ESAbstract.ArrayCreate","_ESAbstract.CreateDataPropertyOrThrow","_ESAbstract.CreateMethodProperty","_ESAbstract.IsCallable","_ESAbstract.LengthOfArrayLike","_ESAbstract.ToObject","_ESAbstract.ToString"],"license":"MIT","spec":"https://tc39.es/ecma262/#sec-array.prototype.tosorted","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toSorted","browsers":{"android":"*","bb":"*","chrome":"<110","edge":"*","edge_mob":"*","firefox":"*","firefox_mob":"*","ie":"*","ie_mob":"*","opera":"<96","op_mob":"<74","op_mini":"*","safari":"<16.3","ios_saf":"<16.3","samsung_mob":"*"},"detectSource":"\"toSorted\"in Array.prototype\n","baseDir":"Array/prototype/toSorted","hasTests":true,"isTestable":true,"isPublic":true,"size":348}
|
@@ -0,0 +1 @@
|
|
1
|
+
CreateMethodProperty(Array.prototype,"toSorted",function r(e){if(void 0!==e&&!1===IsCallable(e))throw new TypeError("The comparison function must be either a function or undefined");for(var t=ToObject(this),o=LengthOfArrayLike(t),a=ArrayCreate(o),n=0;n<o;)CreateDataPropertyOrThrow(a,ToString(n),t[n]),n+=1;return void 0!==e?a.sort(e):a.sort(),a});
|
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
// Array.prototype.toSorted
|
3
|
+
/* global ArrayCreate, CreateDataPropertyOrThrow, CreateMethodProperty, IsCallable, LengthOfArrayLike, ToObject, ToString */
|
4
|
+
// 23.1.3.34 Array.prototype.toSorted ( comparefn )
|
5
|
+
CreateMethodProperty(Array.prototype, 'toSorted', function toSorted(comparefn) {
|
6
|
+
// 1. If comparefn is not undefined and IsCallable(comparefn) is false, throw a TypeError exception.
|
7
|
+
if (comparefn !== undefined && IsCallable(comparefn) === false) {
|
8
|
+
throw new TypeError(
|
9
|
+
"The comparison function must be either a function or undefined"
|
10
|
+
);
|
11
|
+
}
|
12
|
+
// 2. Let O be ? ToObject(this value).
|
13
|
+
var O = ToObject(this);
|
14
|
+
// 3. Let len be ? LengthOfArrayLike(O).
|
15
|
+
var len = LengthOfArrayLike(O);
|
16
|
+
// 4. Let A be ? ArrayCreate(len).
|
17
|
+
var A = ArrayCreate(len);
|
18
|
+
|
19
|
+
// 7. Let j be 0.
|
20
|
+
var j = 0;
|
21
|
+
// 8. Repeat, while j < len,
|
22
|
+
while (j < len) {
|
23
|
+
// a. Perform ! CreateDataPropertyOrThrow(A, ! ToString(𝔽(j)), sortedList[j]).
|
24
|
+
CreateDataPropertyOrThrow(A, ToString(j), O[j]);
|
25
|
+
// b. Set j to j + 1.
|
26
|
+
j = j + 1;
|
27
|
+
}
|
28
|
+
|
29
|
+
// Polyfill.io - These steps are handled by native `Array.prototype.sort`, below
|
30
|
+
// 5. Let SortCompare be a new Abstract Closure with parameters (x, y) that captures comparefn and performs the following steps when called:
|
31
|
+
// a. Return ? CompareArrayElements(x, y, comparefn).
|
32
|
+
// 6. Let sortedList be ? SortIndexedProperties(O, len, SortCompare, read-through-holes).
|
33
|
+
comparefn !== undefined ? A.sort(comparefn) : A.sort();
|
34
|
+
|
35
|
+
// 9. Return A.
|
36
|
+
return A;
|
37
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
{"aliases":["es2023"],"dependencies":["_ESAbstract.ArrayCreate","_ESAbstract.CreateDataPropertyOrThrow","_ESAbstract.CreateMethodProperty","_ESAbstract.Get","_ESAbstract.LengthOfArrayLike","_ESAbstract.ToIntegerOrInfinity","_ESAbstract.ToObject","_ESAbstract.ToString","Number.MAX_SAFE_INTEGER"],"license":"MIT","spec":"https://tc39.es/ecma262/#sec-array.prototype.tospliced","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toSpliced","browsers":{"android":"*","bb":"*","chrome":"<110","edge":"*","edge_mob":"*","firefox":"*","firefox_mob":"*","ie":"*","ie_mob":"*","opera":"<96","op_mob":"<74","op_mini":"*","safari":"<16.3","ios_saf":"<16.3","samsung_mob":"*"},"detectSource":"\"toSpliced\"in Array.prototype\n","baseDir":"Array/prototype/toSpliced","hasTests":true,"isTestable":true,"isPublic":true,"size":791}
|
@@ -0,0 +1 @@
|
|
1
|
+
CreateMethodProperty(Array.prototype,"toSpliced",function r(e,t){var a,o=ToObject(this),n=LengthOfArrayLike(o),i=ToIntegerOrInfinity(e);a=i===-1/0?0:i<0?Math.max(n+i,0):Math.min(i,n);var h,y=arguments.length>2?Array.prototype.slice.call(arguments,2):[],g=y.length;if(0===arguments.length)h=0;else if(1===arguments.length)h=n-a;else{var T=ToIntegerOrInfinity(t);h=Math.min(Math.max(0,T),n-a)}var f=n+g-h;if(f>Number.MAX_SAFE_INTEGER)throw new TypeError("Length exceeded the maximum array length");for(var l=ArrayCreate(f),p=0,c=a+h;p<a;){var m=ToString(p),v=Get(o,m);CreateDataPropertyOrThrow(l,m,v),p+=1}for(y.forEach(function(r){var e=ToString(p);CreateDataPropertyOrThrow(l,e,r),p+=1});p<f;){var O=ToString(p),A=ToString(c),M=Get(o,A);CreateDataPropertyOrThrow(l,O,M),p+=1,c+=1}return l});
|
@@ -0,0 +1,96 @@
|
|
1
|
+
|
2
|
+
// Array.prototype.toSpliced
|
3
|
+
/* global ArrayCreate, CreateDataPropertyOrThrow, CreateMethodProperty, Get, LengthOfArrayLike, ToIntegerOrInfinity, ToObject, ToString */
|
4
|
+
// 23.1.3.35 Array.prototype.toSpliced ( start, skipCount, ...items )
|
5
|
+
CreateMethodProperty(Array.prototype, 'toSpliced', function toSpliced(start, skipCount) {
|
6
|
+
// 1. Let O be ? ToObject(this value).
|
7
|
+
var O = ToObject(this);
|
8
|
+
// 2. Let len be ? LengthOfArrayLike(O).
|
9
|
+
var len = LengthOfArrayLike(O);
|
10
|
+
// 3. Let relativeStart be ? ToIntegerOrInfinity(start).
|
11
|
+
var relativeStart = ToIntegerOrInfinity(start);
|
12
|
+
|
13
|
+
var actualStart;
|
14
|
+
// 4. If relativeStart is -∞, let actualStart be 0.
|
15
|
+
if (relativeStart === -Infinity) {
|
16
|
+
actualStart = 0
|
17
|
+
}
|
18
|
+
// 5. Else if relativeStart < 0, let actualStart be max(len + relativeStart, 0).
|
19
|
+
else if (relativeStart < 0) {
|
20
|
+
actualStart = Math.max(len + relativeStart, 0);
|
21
|
+
}
|
22
|
+
// 6. Else, let actualStart be min(relativeStart, len).
|
23
|
+
else {
|
24
|
+
actualStart = Math.min(relativeStart, len);
|
25
|
+
}
|
26
|
+
|
27
|
+
// 7. Let insertCount be the number of elements in items.
|
28
|
+
var items = arguments.length > 2 ? Array.prototype.slice.call(arguments, 2) : [];
|
29
|
+
var insertCount = items.length;
|
30
|
+
|
31
|
+
var actualSkipCount;
|
32
|
+
// 8. If start is not present, then
|
33
|
+
if (arguments.length === 0) {
|
34
|
+
// a. Let actualSkipCount be 0.
|
35
|
+
actualSkipCount = 0;
|
36
|
+
}
|
37
|
+
// 9. Else if skipCount is not present, then
|
38
|
+
else if (arguments.length === 1) {
|
39
|
+
// a. Let actualSkipCount be len - actualStart.
|
40
|
+
actualSkipCount = len - actualStart;
|
41
|
+
}
|
42
|
+
// 10. Else,
|
43
|
+
else {
|
44
|
+
// a. Let sc be ? ToIntegerOrInfinity(skipCount).
|
45
|
+
var sc = ToIntegerOrInfinity(skipCount);
|
46
|
+
// b. Let actualSkipCount be the result of clamping sc between 0 and len - actualStart.
|
47
|
+
actualSkipCount = Math.min(Math.max(0, sc), len - actualStart);
|
48
|
+
}
|
49
|
+
|
50
|
+
// 11. Let newLen be len + insertCount - actualSkipCount.
|
51
|
+
var newLen = len + insertCount - actualSkipCount;
|
52
|
+
// 12. If newLen > 253 - 1, throw a TypeError exception.
|
53
|
+
if (newLen > Number.MAX_SAFE_INTEGER) {
|
54
|
+
throw new TypeError('Length exceeded the maximum array length');
|
55
|
+
}
|
56
|
+
// 13. Let A be ? ArrayCreate(newLen).
|
57
|
+
var A = ArrayCreate(newLen);
|
58
|
+
// 14. Let i be 0.
|
59
|
+
var i = 0;
|
60
|
+
// 15. Let r be actualStart + actualSkipCount.
|
61
|
+
var r = actualStart + actualSkipCount;
|
62
|
+
// 16. Repeat, while i < actualStart,
|
63
|
+
while (i < actualStart) {
|
64
|
+
// a. Let Pi be ! ToString(𝔽(i)).
|
65
|
+
var Pi = ToString(i);
|
66
|
+
// b. Let iValue be ? Get(O, Pi).
|
67
|
+
var iValue = Get(O, Pi);
|
68
|
+
// c. Perform ! CreateDataPropertyOrThrow(A, Pi, iValue).
|
69
|
+
CreateDataPropertyOrThrow(A, Pi, iValue);
|
70
|
+
// d. Set i to i + 1.
|
71
|
+
i = i + 1;
|
72
|
+
}
|
73
|
+
// 17. For each element E of items, do
|
74
|
+
items.forEach(function (E) {
|
75
|
+
var Pi = ToString(i);
|
76
|
+
CreateDataPropertyOrThrow(A, Pi, E);
|
77
|
+
i = i + 1;
|
78
|
+
});
|
79
|
+
// 18. Repeat, while i < newLen,
|
80
|
+
while (i < newLen) {
|
81
|
+
// a. Let Pi be ! ToString(𝔽(i)).
|
82
|
+
var Pi2 = ToString(i);
|
83
|
+
// b. Let from be ! ToString(𝔽(r)).
|
84
|
+
var from = ToString(r);
|
85
|
+
// c. Let fromValue be ? Get(O, from).
|
86
|
+
var fromValue = Get(O, from);
|
87
|
+
// d. Perform ! CreateDataPropertyOrThrow(A, Pi, fromValue).
|
88
|
+
CreateDataPropertyOrThrow(A, Pi2, fromValue);
|
89
|
+
// e. Set i to i + 1.
|
90
|
+
i = i + 1;
|
91
|
+
// f. Set r to r + 1.
|
92
|
+
r = r + 1;
|
93
|
+
}
|
94
|
+
// 19. Return A.
|
95
|
+
return A;
|
96
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
{"aliases":["es2023"],"dependencies":["_ESAbstract.ArrayCreate","_ESAbstract.CreateDataPropertyOrThrow","_ESAbstract.CreateMethodProperty","_ESAbstract.Get","_ESAbstract.LengthOfArrayLike","_ESAbstract.ToIntegerOrInfinity","_ESAbstract.ToObject","_ESAbstract.ToString","Function.prototype.name"],"license":"MIT","spec":"https://tc39.es/ecma262/#sec-array.prototype.with","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/with","browsers":{"android":"*","bb":"*","chrome":"<110","edge":"*","edge_mob":"*","firefox":"*","firefox_mob":"*","ie":"*","ie_mob":"*","opera":"<96","op_mob":"<74","op_mini":"*","safari":"<16.3","ios_saf":"<16.3","samsung_mob":"*"},"detectSource":"\"with\"in Array.prototype\n","baseDir":"Array/prototype/with","hasTests":true,"isTestable":true,"isPublic":true,"size":552}
|
@@ -0,0 +1 @@
|
|
1
|
+
CreateMethodProperty(Array.prototype,"with",function r(e,t){var n=ToObject(this),a=LengthOfArrayLike(n),o=ToIntegerOrInfinity(e),i=o>=0?o:a+o;if(i>=a||i<0)throw new RangeError("Invalid index");for(var y=ArrayCreate(a),f=0;f<a;){var u=ToString(f),c=f===i?t:Get(n,u);CreateDataPropertyOrThrow(y,u,c),f+=1}return y}),function(){(function(){var r=function(){};try{return Object.defineProperty(r,"name",{value:"test"}),!0}catch(r){return!1}})()&&Object.defineProperty(Array.prototype.with,"name",{value:"with",writable:!1,enumerable:!1,configurable:!0})}();
|
@@ -0,0 +1,60 @@
|
|
1
|
+
|
2
|
+
// Array.prototype.with
|
3
|
+
/* global ArrayCreate, CreateDataPropertyOrThrow, CreateMethodProperty, Get, LengthOfArrayLike, ToIntegerOrInfinity, ToObject, ToString */
|
4
|
+
// 23.1.3.39 Array.prototype.with ( index, value )
|
5
|
+
CreateMethodProperty(Array.prototype, 'with', function With(index, value) {
|
6
|
+
// 1. Let O be ? ToObject(this value).
|
7
|
+
var O = ToObject(this);
|
8
|
+
// 2. Let len be ? LengthOfArrayLike(O).
|
9
|
+
var len = LengthOfArrayLike(O);
|
10
|
+
// 3. Let relativeIndex be ? ToIntegerOrInfinity(index).
|
11
|
+
var relativeIndex = ToIntegerOrInfinity(index);
|
12
|
+
// 4. If relativeIndex ≥ 0, let actualIndex be relativeIndex.
|
13
|
+
// 5. Else, let actualIndex be len + relativeIndex.
|
14
|
+
var actualIndex = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
|
15
|
+
// 6. If actualIndex ≥ len or actualIndex < 0, throw a RangeError exception.
|
16
|
+
if (actualIndex >= len || actualIndex < 0) {
|
17
|
+
throw new RangeError('Invalid index');
|
18
|
+
}
|
19
|
+
// 7. Let A be ? ArrayCreate(len).
|
20
|
+
var A = ArrayCreate(len);
|
21
|
+
// 8. Let k be 0.
|
22
|
+
var k = 0;
|
23
|
+
// 9. Repeat, while k < len,
|
24
|
+
while (k < len) {
|
25
|
+
// a. Let Pk be ! ToString(𝔽(k)).
|
26
|
+
var Pk = ToString(k);
|
27
|
+
// b. If k is actualIndex, let fromValue be value.
|
28
|
+
// c. Else, let fromValue be ? Get(O, Pk).
|
29
|
+
var fromValue = k === actualIndex ? value : Get(O, Pk);
|
30
|
+
// d. Perform ! CreateDataPropertyOrThrow(A, Pk, fromValue).
|
31
|
+
CreateDataPropertyOrThrow(A, Pk, fromValue);
|
32
|
+
// e. Set k to k + 1.
|
33
|
+
k = k + 1;
|
34
|
+
}
|
35
|
+
// 10. Return A.
|
36
|
+
return A;
|
37
|
+
});
|
38
|
+
|
39
|
+
(function () {
|
40
|
+
var supportsDefiningFunctionName = (function () {
|
41
|
+
var fn = function () {};
|
42
|
+
try {
|
43
|
+
Object.defineProperty(fn, 'name', {
|
44
|
+
value: 'test'
|
45
|
+
});
|
46
|
+
return true;
|
47
|
+
} catch (ignore) {
|
48
|
+
return false;
|
49
|
+
}
|
50
|
+
})();
|
51
|
+
|
52
|
+
if (supportsDefiningFunctionName) {
|
53
|
+
Object.defineProperty(Array.prototype.with, 'name', {
|
54
|
+
value: 'with',
|
55
|
+
writable: false,
|
56
|
+
enumerable: false,
|
57
|
+
configurable: true
|
58
|
+
})
|
59
|
+
}
|
60
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
{"aliases":[],"dependencies":["Node.prototype.isConnected"],"spec":"https://html.spec.whatwg.org/multipage/forms.html#dom-form-requestsubmit-dev","docs":"https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/requestSubmit","license":"MIT","browsers":{"android":"*","chrome":"<76","edge":"*","edge_mob":"*","firefox":"<75","firefox_mob":"<79","ie":"*","ie_mob":"*","opera":"<63","op_mob":"<64","op_mini":"*","safari":"<16.0","ios_saf":"<16.0","samsung_mob":"<12.0"},"detectSource":"\"function\"==typeof HTMLFormElement.prototype.requestSubmit\n","baseDir":"HTMLFormElement/prototype/requestSubmit","hasTests":true,"isTestable":true,"isPublic":true,"size":1180}
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(e){function t(e,t){if(!(e instanceof HTMLElement))throw new TypeError("Failed to execute 'requestSubmit' on 'HTMLFormElement': parameter 1 is not of type 'HTMLElement'.");if(e.form!==t||e.hasAttribute("form")&&(""===e.getAttribute("form")||e.getAttribute("form")!==t.id))throw i?new DOMException("Failed to execute 'requestSubmit' on 'HTMLFormElement': The specified element is not owned by this form element.","NotFoundError"):new Error("NotFoundError: Failed to execute 'requestSubmit' on 'HTMLFormElement': The specified element is not owned by this form element.");if(("submit"!==e.type||"BUTTON"!==e.tagName)&&!("submit"===e.type&&"INPUT"===e.tagName||"image"===e.type&&"INPUT"===e.tagName))throw new TypeError("Failed to execute 'requestSubmit' on 'HTMLFormElement': The specified element is not a submit button.")}if("function"!=typeof e.requestSubmit){var i=!1;try{new DOMException,i=!0}catch(e){}e.requestSubmit=function e(){if(this.isConnected){var i=arguments[0];if(i&&t(i,this),i&&!i.disabled)return void i.click();i=document.createElement("input"),i.type="submit",i.hidden=!0,this.appendChild(i),i.click(),this.removeChild(i)}}}}(HTMLFormElement.prototype);
|
@@ -0,0 +1,116 @@
|
|
1
|
+
|
2
|
+
// HTMLFormElement.prototype.requestSubmit
|
3
|
+
/**
|
4
|
+
* The MIT License (MIT)
|
5
|
+
*
|
6
|
+
* Copyright (c) 2019 Javan Makhmali <javan@javan.us>
|
7
|
+
*
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
* of this software and associated documentation files (the "Software"), to deal
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
13
|
+
* furnished to do so, subject to the following conditions:
|
14
|
+
*
|
15
|
+
* The above copyright notice and this permission notice shall be included in
|
16
|
+
* all copies or substantial portions of the Software.
|
17
|
+
*
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
* THE SOFTWARE.
|
25
|
+
*
|
26
|
+
* @link https://github.com/javan/form-request-submit-polyfill
|
27
|
+
*/
|
28
|
+
|
29
|
+
/* globals */
|
30
|
+
// eslint-disable-next-line no-unused-vars
|
31
|
+
|
32
|
+
(function (prototype) {
|
33
|
+
// Place all polyfill code within this function.
|
34
|
+
if (typeof prototype.requestSubmit === "function") return;
|
35
|
+
|
36
|
+
var supportsDomExceptionConstructor = false;
|
37
|
+
try {
|
38
|
+
new DOMException();
|
39
|
+
supportsDomExceptionConstructor = true;
|
40
|
+
} catch (e) { /* noop */ }
|
41
|
+
|
42
|
+
prototype.requestSubmit = function requestSubmit() {
|
43
|
+
if (!this.isConnected) {
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
|
47
|
+
var submitter = arguments[0];
|
48
|
+
if (submitter) {
|
49
|
+
validateSubmitter(submitter, this);
|
50
|
+
}
|
51
|
+
|
52
|
+
if (submitter && !submitter.disabled) {
|
53
|
+
submitter.click();
|
54
|
+
return;
|
55
|
+
}
|
56
|
+
|
57
|
+
submitter = document.createElement("input");
|
58
|
+
submitter.type = "submit";
|
59
|
+
submitter.hidden = true;
|
60
|
+
this.appendChild(submitter);
|
61
|
+
submitter.click();
|
62
|
+
this.removeChild(submitter);
|
63
|
+
};
|
64
|
+
|
65
|
+
function validateSubmitter(submitter, form) {
|
66
|
+
if (!(submitter instanceof HTMLElement)) {
|
67
|
+
throw new TypeError(
|
68
|
+
"Failed to execute 'requestSubmit' on 'HTMLFormElement': " +
|
69
|
+
"parameter 1 is not of type 'HTMLElement'" +
|
70
|
+
"."
|
71
|
+
);
|
72
|
+
}
|
73
|
+
|
74
|
+
if (
|
75
|
+
(submitter.form !== form) ||
|
76
|
+
// Older browsers have incorrect implementations for the "form" attribute
|
77
|
+
(submitter.hasAttribute('form') && (
|
78
|
+
submitter.getAttribute('form') === '' ||
|
79
|
+
submitter.getAttribute('form') !== form.id
|
80
|
+
))
|
81
|
+
) {
|
82
|
+
if (supportsDomExceptionConstructor) {
|
83
|
+
throw new DOMException(
|
84
|
+
"Failed to execute 'requestSubmit' on 'HTMLFormElement': " +
|
85
|
+
"The specified element is not owned by this form element" +
|
86
|
+
".",
|
87
|
+
"NotFoundError"
|
88
|
+
);
|
89
|
+
} else {
|
90
|
+
throw new Error(
|
91
|
+
"NotFoundError: Failed to execute 'requestSubmit' on 'HTMLFormElement': " +
|
92
|
+
"The specified element is not owned by this form element" +
|
93
|
+
"."
|
94
|
+
);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
if (submitter.type === "submit" && submitter.tagName === "BUTTON") {
|
99
|
+
return;
|
100
|
+
}
|
101
|
+
|
102
|
+
if (submitter.type === "submit" && submitter.tagName === "INPUT") {
|
103
|
+
return;
|
104
|
+
}
|
105
|
+
|
106
|
+
if (submitter.type === "image" && submitter.tagName === "INPUT") {
|
107
|
+
return;
|
108
|
+
}
|
109
|
+
|
110
|
+
throw new TypeError(
|
111
|
+
"Failed to execute 'requestSubmit' on 'HTMLFormElement': " +
|
112
|
+
"The specified element is not a submit button" +
|
113
|
+
"."
|
114
|
+
);
|
115
|
+
}
|
116
|
+
})(HTMLFormElement.prototype);
|
@@ -1 +1 @@
|
|
1
|
-
{"aliases":[],"dependencies":["Event","performance.now"],"docs":"https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver","spec":"http://rawgit.com/w3c/IntersectionObserver/master/index.html","notes":[],"repo":"https://github.com/w3c/IntersectionObserver","browsers":{"android":"*","bb":"*","chrome":"<51","edge":"<16","edge_mob":"<16","firefox":"<55","firefox_mob":"<55","ie":"*","ie_mob":"*","opera":"<45","op_mob":"<46","op_mini":"*","safari":"<17.0","ios_saf":"<17.0","samsung_mob":"<7.0"},"detectSource":"\"IntersectionObserver\"in window&&\"IntersectionObserverEntry\"in window&&\"intersectionRatio\"in window.IntersectionObserverEntry.prototype\n","baseDir":"IntersectionObserver","hasTests":
|
1
|
+
{"aliases":[],"dependencies":["Event","performance.now"],"docs":"https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver","spec":"http://rawgit.com/w3c/IntersectionObserver/master/index.html","notes":[],"repo":"https://github.com/w3c/IntersectionObserver","browsers":{"android":"*","bb":"*","chrome":"<51","edge":"<16","edge_mob":"<16","firefox":"<55","firefox_mob":"<55","ie":"*","ie_mob":"*","opera":"<45","op_mob":"<46","op_mini":"*","safari":"<17.0","ios_saf":"<17.0","samsung_mob":"<7.0"},"detectSource":"\"IntersectionObserver\"in window&&\"IntersectionObserverEntry\"in window&&\"intersectionRatio\"in window.IntersectionObserverEntry.prototype\n","baseDir":"IntersectionObserver","hasTests":true,"isTestable":true,"isPublic":true,"size":6765}
|
@@ -1 +1 @@
|
|
1
|
-
!function(t,e){"use strict";function n(t){this.time=t.time,this.target=t.target,this.rootBounds=t.rootBounds,this.boundingClientRect=t.boundingClientRect,this.intersectionRect=t.intersectionRect||u();try{this.isIntersecting=!!t.intersectionRect}catch(t){}var e=this.boundingClientRect,n=e.width*e.height,o=this.intersectionRect,i=o.width*o.height;this.intersectionRatio=n?Number((i/n).toFixed(4)):this.isIntersecting?1:0}function o(t,e){var n=e||{};if("function"!=typeof t)throw new Error("callback must be a function");if(n.root&&1!=n.root.nodeType)throw new Error("root must be an Element");this._checkForIntersections=r(this._checkForIntersections.bind(this),this.THROTTLE_TIMEOUT),this._callback=t,this._observationTargets=[],this._queuedEntries=[],this._rootMarginValues=this._parseRootMargin(n.rootMargin),this.thresholds=this._initThresholds(n.threshold),this.root=n.root||null,this.rootMargin=this._rootMarginValues.map(function(t){return t.value+t.unit}).join(" ")}function i(){return t.performance&&performance.now&&performance.now()}function r(t,e){var n=null;return function(){n||(n=setTimeout(function(){t(),n=null},e))}}function s(t,e,n,o){"function"==typeof t.addEventListener?t.addEventListener(e,n,o||!1):"function"==typeof t.attachEvent&&t.attachEvent("on"+e,n)}function h(t,e,n,o){"function"==typeof t.removeEventListener?t.removeEventListener(e,n,o||!1):"function"==typeof t.detatchEvent&&t.detatchEvent("on"+e,n)}function c(t,e){var n=Math.max(t.top,e.top),o=Math.min(t.bottom,e.bottom),i=Math.max(t.left,e.left),r=Math.min(t.right,e.right),s=r-i,h=o-n;return s>=0&&h>=0&&{x:i,y:n,top:n,bottom:o,left:i,right:r,width:s,height:h}}function a(t){var e;try{e=t.getBoundingClientRect()}catch(t){}return e?(e.width&&e.height&&e.x&&e.y||(e={x:e.left,y:e.top,top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.right-e.left,height:e.bottom-e.top}),e):u()}function u(){return{x:0,y:0,top:0,bottom:0,left:0,right:0,width:0,height:0}}function l(t,e){for(var n=e;n;){if(n==t)return!0;n=p(n)}return!1}function p(t){var e=t.parentNode;return e&&11==e.nodeType&&e.host?e.host:e&&e.assignedSlot?e.assignedSlot.parentNode:e}if(!("IntersectionObserver"in t&&"IntersectionObserverEntry"in t&&"intersectionRatio"in t.IntersectionObserverEntry.prototype)){var f=[];o.prototype.THROTTLE_TIMEOUT=100,o.prototype.POLL_INTERVAL=null,o.prototype.USE_MUTATION_OBSERVER=!0,o.prototype.observe=function(t){if(!this._observationTargets.some(function(e){return e.element==t})){if(!t||1!=t.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:t,entry:null}),this._monitorIntersections(),this._checkForIntersections()}},o.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter(function(e){return e.element!=t}),this._observationTargets.length||(this._unmonitorIntersections(),this._unregisterInstance())},o.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorIntersections(),this._unregisterInstance()},o.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},o.prototype._initThresholds=function(t){var e=t||[0];return Array.isArray(e)||(e=[e]),e.sort().filter(function(t,e,n){if("number"!=typeof t||isNaN(t)||t<0||t>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return t!==n[e-1]})},o.prototype._parseRootMargin=function(t){var e=t||"0px",n=e.split(/\s+/).map(function(t){var e=/^(-?\d*\.?\d+)(px|%)$/.exec(t);if(!e)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(e[1]),unit:e[2]}});return n[1]=n[1]||n[0],n[2]=n[2]||n[0],n[3]=n[3]||n[1],n},o.prototype._monitorIntersections=function(){this._monitoringIntersections||(this._monitoringIntersections=!0,this.POLL_INTERVAL?this._monitoringInterval=setInterval(this._checkForIntersections,this.POLL_INTERVAL):(s(t,"resize",this._checkForIntersections,!0),s(e,"scroll",this._checkForIntersections,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in t&&(this._domObserver=new MutationObserver(this._checkForIntersections),this._domObserver.observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))))},o.prototype._unmonitorIntersections=function(){this._monitoringIntersections&&(this._monitoringIntersections=!1,clearInterval(this._monitoringInterval),this._monitoringInterval=null,h(t,"resize",this._checkForIntersections,!0),h(e,"scroll",this._checkForIntersections,!0),this._domObserver&&(this._domObserver.disconnect(),this._domObserver=null))},o.prototype._checkForIntersections=function(){var t=this._rootIsInDom(),e=t?this._getRootRect():u();this._observationTargets.forEach(function(o){var r=o.element,s=a(r),h=this._rootContainsTarget(r),c=o.entry,u=t&&h&&this._computeTargetAndRootIntersection(r,e),l=o.entry=new n({time:i(),target:r,boundingClientRect:s,rootBounds:e,intersectionRect:u});c?t&&h?this._hasCrossedThreshold(c,l)&&this._queuedEntries.push(l):c&&c.isIntersecting&&this._queuedEntries.push(l):this._queuedEntries.push(l)},this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)},o.prototype._computeTargetAndRootIntersection=function(n,o){if("none"!=t.getComputedStyle(n).display){for(var i=a(n),r=i,s=p(n),h=!1;!h;){var u=null,l=1==s.nodeType?t.getComputedStyle(s):{};if("none"==l.display)return;if(s==this.root||s==e?(h=!0,u=o):s!=e.body&&s!=e.documentElement&&"visible"!=l.overflow&&(u=a(s)),u&&!(r=c(u,r)))break;s=p(s)}return r}},o.prototype._getRootRect=function(){var t;if(this.root)t=a(this.root);else{var n=e.documentElement,o=e.body;t={x:0,y:0,top:0,left:0,right:n.clientWidth||o.clientWidth,width:n.clientWidth||o.clientWidth,bottom:n.clientHeight||o.clientHeight,height:n.clientHeight||o.clientHeight}}return this._expandRectByRootMargin(t)},o.prototype._expandRectByRootMargin=function(t){var e=this._rootMarginValues.map(function(e,n){return"px"==e.unit?e.value:e.value*(n%2?t.width:t.height)/100}),n={top:t.top-e[0],right:t.right+e[1],bottom:t.bottom+e[2],left:t.left-e[3]};return n.width=n.right-n.left,n.height=n.bottom-n.top,n.x=n.left,n.y=n.top,n},o.prototype._hasCrossedThreshold=function(t,e){var n=t&&t.isIntersecting?t.intersectionRatio||0:-1,o=e.isIntersecting?e.intersectionRatio||0:-1;if(n!==o)for(var i=0;i<this.thresholds.length;i++){var r=this.thresholds[i];if(r==n||r==o||r<n!=r<o)return!0}},o.prototype._rootIsInDom=function(){return!this.root||l(e,this.root)},o.prototype._rootContainsTarget=function(t){return l(this.root||e,t)},o.prototype._registerInstance=function(){f.indexOf(this)<0&&f.push(this)},o.prototype._unregisterInstance=function(){var t=f.indexOf(this);-1!=t&&f.splice(t,1)},t.IntersectionObserver=o,t.IntersectionObserverEntry=n}}(window,document);
|
1
|
+
!function(t,e){"use strict";function n(t){this.time=t.time,this.target=t.target,this.rootBounds=t.rootBounds,this.boundingClientRect=t.boundingClientRect,this.intersectionRect=t.intersectionRect||u();try{this.isIntersecting=!!t.intersectionRect}catch(t){}var e=this.boundingClientRect,n=e.width*e.height,o=this.intersectionRect,i=o.width*o.height;this.intersectionRatio=n?Number((i/n).toFixed(4)):this.isIntersecting?1:0}function o(t,e){var n=e||{};if("function"!=typeof t)throw new Error("callback must be a function");if(n.root&&1!=n.root.nodeType)throw new Error("root must be an Element");this._checkForIntersections=r(this._checkForIntersections.bind(this),this.THROTTLE_TIMEOUT),this._callback=t,this._observationTargets=[],this._queuedEntries=[],this._rootMarginValues=this._parseRootMargin(n.rootMargin),this.thresholds=this._initThresholds(n.threshold),this.root=n.root||null,this.rootMargin=this._rootMarginValues.map(function(t){return t.value+t.unit}).join(" ")}function i(){return t.performance&&performance.now&&performance.now()}function r(t,e){var n=null;return function(){n||(n=setTimeout(function(){t(),n=null},e))}}function s(t,e,n,o){"function"==typeof t.addEventListener?t.addEventListener(e,n,o||!1):"function"==typeof t.attachEvent&&t.attachEvent("on"+e,n)}function h(t,e,n,o){"function"==typeof t.removeEventListener?t.removeEventListener(e,n,o||!1):"function"==typeof t.detatchEvent&&t.detatchEvent("on"+e,n)}function c(t,e){var n=Math.max(t.top,e.top),o=Math.min(t.bottom,e.bottom),i=Math.max(t.left,e.left),r=Math.min(t.right,e.right),s=r-i,h=o-n;return s>=0&&h>=0&&{x:i,y:n,top:n,bottom:o,left:i,right:r,width:s,height:h}}function a(t){var e;try{e=t.getBoundingClientRect()}catch(t){}return e?(e.width&&e.height&&e.x&&e.y||(e={x:e.left,y:e.top,top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.right-e.left,height:e.bottom-e.top}),e):u()}function u(){return{x:0,y:0,top:0,bottom:0,left:0,right:0,width:0,height:0}}function l(t,e){for(var n=e;n;){if(n==t)return!0;n=p(n)}return!1}function p(t){var e=t.parentNode;return e&&11==e.nodeType&&e.host?e.host:e&&e.assignedSlot?e.assignedSlot.parentNode:e}if(!("IntersectionObserver"in t&&"IntersectionObserverEntry"in t&&"intersectionRatio"in t.IntersectionObserverEntry.prototype)){var f=[];n.prototype.intersectionRatio=0,o.prototype.THROTTLE_TIMEOUT=100,o.prototype.POLL_INTERVAL=null,o.prototype.USE_MUTATION_OBSERVER=!0,o.prototype.observe=function(t){if(!this._observationTargets.some(function(e){return e.element==t})){if(!t||1!=t.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:t,entry:null}),this._monitorIntersections(),this._checkForIntersections()}},o.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter(function(e){return e.element!=t}),this._observationTargets.length||(this._unmonitorIntersections(),this._unregisterInstance())},o.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorIntersections(),this._unregisterInstance()},o.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},o.prototype._initThresholds=function(t){var e=t||[0];return Array.isArray(e)||(e=[e]),e.sort().filter(function(t,e,n){if("number"!=typeof t||isNaN(t)||t<0||t>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return t!==n[e-1]})},o.prototype._parseRootMargin=function(t){var e=t||"0px",n=e.split(/\s+/).map(function(t){var e=/^(-?\d*\.?\d+)(px|%)$/.exec(t);if(!e)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(e[1]),unit:e[2]}});return n[1]=n[1]||n[0],n[2]=n[2]||n[0],n[3]=n[3]||n[1],n},o.prototype._monitorIntersections=function(){this._monitoringIntersections||(this._monitoringIntersections=!0,this.POLL_INTERVAL?this._monitoringInterval=setInterval(this._checkForIntersections,this.POLL_INTERVAL):(s(t,"resize",this._checkForIntersections,!0),s(e,"scroll",this._checkForIntersections,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in t&&(this._domObserver=new MutationObserver(this._checkForIntersections),this._domObserver.observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))))},o.prototype._unmonitorIntersections=function(){this._monitoringIntersections&&(this._monitoringIntersections=!1,clearInterval(this._monitoringInterval),this._monitoringInterval=null,h(t,"resize",this._checkForIntersections,!0),h(e,"scroll",this._checkForIntersections,!0),this._domObserver&&(this._domObserver.disconnect(),this._domObserver=null))},o.prototype._checkForIntersections=function(){var t=this._rootIsInDom(),e=t?this._getRootRect():u();this._observationTargets.forEach(function(o){var r=o.element,s=a(r),h=this._rootContainsTarget(r),c=o.entry,u=t&&h&&this._computeTargetAndRootIntersection(r,e),l=o.entry=new n({time:i(),target:r,boundingClientRect:s,rootBounds:e,intersectionRect:u});c?t&&h?this._hasCrossedThreshold(c,l)&&this._queuedEntries.push(l):c&&c.isIntersecting&&this._queuedEntries.push(l):this._queuedEntries.push(l)},this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)},o.prototype._computeTargetAndRootIntersection=function(n,o){if("none"!=t.getComputedStyle(n).display){for(var i=a(n),r=i,s=p(n),h=!1;!h;){var u=null,l=1==s.nodeType?t.getComputedStyle(s):{};if("none"==l.display)return;if(s==this.root||s==e?(h=!0,u=o):s!=e.body&&s!=e.documentElement&&"visible"!=l.overflow&&(u=a(s)),u&&!(r=c(u,r)))break;s=p(s)}return r}},o.prototype._getRootRect=function(){var t;if(this.root)t=a(this.root);else{var n=e.documentElement,o=e.body;t={x:0,y:0,top:0,left:0,right:n.clientWidth||o.clientWidth,width:n.clientWidth||o.clientWidth,bottom:n.clientHeight||o.clientHeight,height:n.clientHeight||o.clientHeight}}return this._expandRectByRootMargin(t)},o.prototype._expandRectByRootMargin=function(t){var e=this._rootMarginValues.map(function(e,n){return"px"==e.unit?e.value:e.value*(n%2?t.width:t.height)/100}),n={top:t.top-e[0],right:t.right+e[1],bottom:t.bottom+e[2],left:t.left-e[3]};return n.width=n.right-n.left,n.height=n.bottom-n.top,n.x=n.left,n.y=n.top,n},o.prototype._hasCrossedThreshold=function(t,e){var n=t&&t.isIntersecting?t.intersectionRatio||0:-1,o=e.isIntersecting?e.intersectionRatio||0:-1;if(n!==o)for(var i=0;i<this.thresholds.length;i++){var r=this.thresholds[i];if(r==n||r==o||r<n!=r<o)return!0}},o.prototype._rootIsInDom=function(){return!this.root||l(e,this.root)},o.prototype._rootContainsTarget=function(t){return l(this.root||e,t)},o.prototype._registerInstance=function(){f.indexOf(this)<0&&f.push(this)},o.prototype._unregisterInstance=function(){var t=f.indexOf(this);-1!=t&&f.splice(t,1)},t.IntersectionObserver=o,t.IntersectionObserverEntry=n}}(window,document);
|