Skip to content

Commit

Permalink
remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
HalvorHaugan committed Aug 23, 2023
1 parent 9dbb823 commit eedd386
Showing 1 changed file with 1 addition and 39 deletions.
40 changes: 1 addition & 39 deletions @navikt/core/react/src/modal/dialog-polyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,36 +49,6 @@ function safeDispatchEvent(target, event) {
return target.dispatchEvent(event);
}

/**
* @param {Element} el to check for stacking context
* @return {boolean} whether this el or its parents creates a stacking context
*/
function createsStackingContext(el) {
while (el && el !== document.body) {
var s = window.getComputedStyle(el);
// eslint-disable-next-line no-loop-func
var invalid = function (k, ok) {
return !(s[k] === undefined || s[k] === ok);
};

if (
s.opacity < 1 ||
invalid("zIndex", "auto") ||
invalid("transform", "none") ||
invalid("mixBlendMode", "normal") ||
invalid("filter", "none") ||
invalid("perspective", "none") ||
s["isolation"] === "isolate" ||
s.position === "fixed" ||
s.webkitOverflowScrolling === "touch"
) {
return true;
}
el = el.parentElement;
}
return false;
}

/**
* Finds the nearest <dialog> from the passed element.
*
Expand Down Expand Up @@ -482,14 +452,6 @@ dialogPolyfillInfo.prototype = /** @type {HTMLDialogElement.prototype} */ {
);
}

if (createsStackingContext(this.dialog_.parentElement)) {
/*console.warn(
"A dialog is being shown inside a stacking context. " +
"This may cause it to be unusable. For more information, see this link: " +
"https://github.com/GoogleChrome/dialog-polyfill/#stacking-context"
);*/
}

this.setOpen(true);
this.openAsModal_ = true;

Expand Down Expand Up @@ -608,7 +570,7 @@ dialogPolyfill.needsCentering = function (dialog) {
* @param {!Element} element to force upgrade
*/
dialogPolyfill.forceRegisterDialog = function (element) {
if (/*window.HTMLDialogElement ||*/ element.showModal) {
if (element.showModal) {
console.warn(
"This browser already supports <dialog>, the polyfill " +
"may not work correctly",
Expand Down

0 comments on commit eedd386

Please sign in to comment.