forked from opensearch-project/oui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Portale element to any referenced DOM element (opensearch-project#707)
Co-authored-by: Andrey Myssak <[email protected]> Signed-off-by: Sergey Myssak <[email protected]>
- Loading branch information
1 parent
27a5a29
commit 5261dfa
Showing
10 changed files
with
176 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
if (typeof window !== 'undefined') { | ||
HTMLElement.prototype.insertAdjacentElement = function (position, element) { | ||
switch (position) { | ||
case 'beforebegin': | ||
this.parentNode.insertBefore(element, this); | ||
break; | ||
case 'afterend': | ||
if (this.nextSibling) { | ||
this.parentNode.insertBefore(element, this.nextSibling); | ||
} else { | ||
this.parentNode.appendChild(element); | ||
} | ||
break; | ||
// add other cases if needed | ||
default: | ||
throw new Error(`Unsupported position: ${position}`); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`OuiPortal is rendered 1`] = ` | ||
<div> | ||
<OuiPortal> | ||
<Portal | ||
containerInfo={ | ||
<div> | ||
Content | ||
</div> | ||
} | ||
> | ||
Content | ||
</Portal> | ||
</OuiPortal> | ||
</div> | ||
exports[`OuiPortal should render OuiPortal 1`] = ` | ||
<OuiPortal> | ||
<Portal | ||
containerInfo={ | ||
<div> | ||
Content | ||
</div> | ||
} | ||
> | ||
Content | ||
</Portal> | ||
</OuiPortal> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters