Skip to content

Commit

Permalink
use WeakSet, add back safari 9
Browse files Browse the repository at this point in the history
  • Loading branch information
valdrinkoshi committed Mar 20, 2018
1 parent de86be1 commit 32ee0af
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
14 changes: 7 additions & 7 deletions blocking-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@

/**
* Elements that are already inert before the first blocking element is pushed.
* @type {Set<HTMLElement>}
* @type {WeakSet<HTMLElement>}
* @private
*/
this[_alreadyInertElements] = new Set();
this[_alreadyInertElements] = new WeakSet();
}

/**
Expand Down Expand Up @@ -241,15 +241,15 @@
* doesn't specify if it should be reflected.
* https://html.spec.whatwg.org/multipage/interaction.html#inert
* @param {!Array<HTMLElement>} elements
* @param {Set<HTMLElement>} toSkip
* @param {Set<HTMLElement>} toKeepInert
* @param {WeakSet<HTMLElement>} toSkip
* @param {WeakSet<HTMLElement>} toKeepInert
* @private
*/
[_inertSiblings](elements, toSkip, toKeepInert) {
for (let i = 0, l = elements.length; i < l; i++) {
const element = elements[i];
const children = element.parentNode.children;
const inertedSiblings = new Set();
const inertedSiblings = new WeakSet();
for (let j = 0; j < children.length; j++) {
const sibling = children[j];
// Skip the input element, if not inertable or to be skipped.
Expand Down Expand Up @@ -326,15 +326,15 @@
* Returns the distributed children of the element's shadow root.
* Returns null if the element doesn't have a shadow root.
* @param {!element} element
* @return {Set<HTMLElement>|null}
* @return {WeakSet<HTMLElement>|null}
* @private
*/
[_getDistributedChildren](element) {
const shadowRoot = element.shadowRoot;
if (!shadowRoot) {
return null;
}
const result = new Set();
const result = new WeakSet();
let i;
let j;
let nodes;
Expand Down
14 changes: 7 additions & 7 deletions dist/blocking-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ var createClass = function () {

/**
* Elements that are already inert before the first blocking element is pushed.
* @type {Set<HTMLElement>}
* @type {WeakSet<HTMLElement>}
* @private
*/
this[_alreadyInertElements] = new Set();
this[_alreadyInertElements] = new WeakSet();
}

/**
Expand Down Expand Up @@ -318,8 +318,8 @@ var createClass = function () {
* doesn't specify if it should be reflected.
* https://html.spec.whatwg.org/multipage/interaction.html#inert
* @param {!Array<HTMLElement>} elements
* @param {Set<HTMLElement>} toSkip
* @param {Set<HTMLElement>} toKeepInert
* @param {WeakSet<HTMLElement>} toSkip
* @param {WeakSet<HTMLElement>} toKeepInert
* @private
*/

Expand All @@ -329,7 +329,7 @@ var createClass = function () {
for (var i = 0, l = elements.length; i < l; i++) {
var element = elements[i];
var children = element.parentNode.children;
var inertedSiblings = new Set();
var inertedSiblings = new WeakSet();
for (var j = 0; j < children.length; j++) {
var sibling = children[j];
// Skip the input element, if not inertable or to be skipped.
Expand Down Expand Up @@ -410,7 +410,7 @@ var createClass = function () {
* Returns the distributed children of the element's shadow root.
* Returns null if the element doesn't have a shadow root.
* @param {!element} element
* @return {Set<HTMLElement>|null}
* @return {WeakSet<HTMLElement>|null}
* @private
*/

Expand All @@ -421,7 +421,7 @@ var createClass = function () {
if (!shadowRoot) {
return null;
}
var result = new Set();
var result = new WeakSet();
var i = void 0;
var j = void 0;
var nodes = void 0;
Expand Down
2 changes: 1 addition & 1 deletion dist/blocking-elements.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
"microsoftedge",
"14"
],
[
"OS X 10.11",
"safari",
"9"
],
[
"OS X 10.12",
"safari",
Expand Down

0 comments on commit 32ee0af

Please sign in to comment.