Skip to content

Commit

Permalink
Fix intertable interface typo
Browse files Browse the repository at this point in the history
  • Loading branch information
aomarks committed Jul 26, 2019
1 parent 6743779 commit 5e1a3f9
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/blocking-elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ const _getDistributedChildren = Symbol();
const _isInertable = Symbol();
const _handleMutations = Symbol();

interface IntertableHTMLElement extends HTMLElement {
interface InertableHTMLElement extends HTMLElement {
inert?: boolean;
[_siblingsToRestore]?: Set<IntertableHTMLElement>;
[_siblingsToRestore]?: Set<InertableHTMLElement>;
[_parentMO]?: MutationObserver;
}

Expand All @@ -47,21 +47,21 @@ class BlockingElements {
/**
* The blocking elements.
*/
private[_blockingElements]: IntertableHTMLElement[] = [];
private[_blockingElements]: InertableHTMLElement[] = [];

/**
* Used to keep track of the parents of the top element, from the element
* itself up to body. When top changes, the old top might have been removed
* from the document, so we need to memoize the inerted parents' siblings
* in order to restore their inerteness when top changes.
*/
private[_topElParents]: IntertableHTMLElement[] = [];
private[_topElParents]: InertableHTMLElement[] = [];

/**
* Elements that are already inert before the first blocking element is
* pushed.
*/
private[_alreadyInertElements] = new Set<IntertableHTMLElement>();
private[_alreadyInertElements] = new Set<InertableHTMLElement>();

/**
* Call this whenever this object is about to become obsolete. This empties
Expand Down Expand Up @@ -196,7 +196,7 @@ class BlockingElements {
* https://html.spec.whatwg.org/multipage/interaction.html#inert
*/
private[_swapInertedSibling](
oldInert: IntertableHTMLElement, newInert: IntertableHTMLElement): void {
oldInert: InertableHTMLElement, newInert: InertableHTMLElement): void {
const siblingsToRestore = oldInert[_siblingsToRestore];
// oldInert is not contained in siblings to restore, so we have to check
// if it's inertable and if already inert.
Expand Down Expand Up @@ -224,7 +224,7 @@ class BlockingElements {
* doesn't specify if it should be reflected.
* https://html.spec.whatwg.org/multipage/interaction.html#inert
*/
private[_restoreInertedSiblings](elements: IntertableHTMLElement[]) {
private[_restoreInertedSiblings](elements: InertableHTMLElement[]) {
elements.forEach((el) => {
const mo = el[_parentMO];
if (mo !== undefined) {
Expand All @@ -250,14 +250,14 @@ class BlockingElements {
* https://html.spec.whatwg.org/multipage/interaction.html#inert
*/
private[_inertSiblings](
elements: IntertableHTMLElement[], toSkip: Set<HTMLElement>|null,
elements: InertableHTMLElement[], toSkip: Set<HTMLElement>|null,
toKeepInert: Set<HTMLElement>|null) {
for (const element of elements) {
const children =
element.parentNode !== null ? element.parentNode.children : [];
const inertedSiblings = new Set<HTMLElement>();
for (let j = 0; j < children.length; j++) {
const sibling = children[j] as IntertableHTMLElement;
const sibling = children[j] as InertableHTMLElement;
// Skip the input element, if not inertable or to be skipped.
if (sibling === element || !this[_isInertable](sibling) ||
(toSkip && toSkip.has(sibling))) {
Expand Down Expand Up @@ -295,13 +295,13 @@ class BlockingElements {
for (const mutation of mutations) {
const idx = mutation.target === document.body ?
parents.length :
parents.indexOf(mutation.target as IntertableHTMLElement);
parents.indexOf(mutation.target as InertableHTMLElement);
const inertedChild = parents[idx - 1];
const inertedSiblings = inertedChild[_siblingsToRestore];

// To restore.
for (let i = 0; i < mutation.removedNodes.length; i++) {
const sibling = mutation.removedNodes[i] as IntertableHTMLElement;
const sibling = mutation.removedNodes[i] as InertableHTMLElement;
if (sibling === inertedChild) {
console.info('Detected removal of the top Blocking Element.');
this.pop();
Expand All @@ -315,7 +315,7 @@ class BlockingElements {

// To inert.
for (let i = 0; i < mutation.addedNodes.length; i++) {
const sibling = mutation.removedNodes[i] as IntertableHTMLElement;
const sibling = mutation.removedNodes[i] as InertableHTMLElement;
if (!this[_isInertable](sibling)) {
continue;
}
Expand Down

0 comments on commit 5e1a3f9

Please sign in to comment.