@@ -34,8 +34,9 @@ export const patchPseudoShadowDom = (hostElementPrototype: HTMLElement) => {
3434 *
3535 * @param HostElementPrototype The Stencil component to be patched
3636 */
37- export const patchCloneNode = ( HostElementPrototype : HTMLElement ) => {
38- const orgCloneNode = HostElementPrototype . cloneNode ;
37+ export const patchCloneNode = ( HostElementPrototype : any ) => {
38+ if ( HostElementPrototype . __cloneNode ) return ;
39+ const orgCloneNode = ( HostElementPrototype . __cloneNode = HostElementPrototype . cloneNode ) ;
3940
4041 HostElementPrototype . cloneNode = function ( deep ?: boolean ) {
4142 const srcNode = this ;
@@ -91,6 +92,7 @@ export const patchCloneNode = (HostElementPrototype: HTMLElement) => {
9192 * @param HostElementPrototype The Stencil component to be patched
9293 */
9394export const patchSlotAppendChild = ( HostElementPrototype : any ) => {
95+ if ( HostElementPrototype . __appendChild ) return ;
9496 HostElementPrototype . __appendChild = HostElementPrototype . appendChild ;
9597
9698 HostElementPrototype . appendChild = function ( this : d . RenderNode , newChild : d . RenderNode ) {
@@ -122,6 +124,7 @@ export const patchSlotAppendChild = (HostElementPrototype: any) => {
122124 * @param ElementPrototype The Stencil component to be patched
123125 */
124126const patchSlotRemoveChild = ( ElementPrototype : any ) => {
127+ if ( ElementPrototype . __removeChild ) return ;
125128 ElementPrototype . __removeChild = ElementPrototype . removeChild ;
126129
127130 ElementPrototype . removeChild = function ( this : d . RenderNode , toRemove : d . RenderNode ) {
@@ -146,6 +149,7 @@ const patchSlotRemoveChild = (ElementPrototype: any) => {
146149 * @param HostElementPrototype the `Element` to be patched
147150 */
148151export const patchSlotPrepend = ( HostElementPrototype : HTMLElement ) => {
152+ if ( ( HostElementPrototype as any ) . __prepend ) return ;
149153 ( HostElementPrototype as any ) . __prepend = HostElementPrototype . prepend ;
150154
151155 HostElementPrototype . prepend = function ( this : d . HostElement , ...newChildren : ( d . RenderNode | string ) [ ] ) {
@@ -183,6 +187,7 @@ export const patchSlotPrepend = (HostElementPrototype: HTMLElement) => {
183187 * @param HostElementPrototype the `Element` to be patched
184188 */
185189export const patchSlotAppend = ( HostElementPrototype : HTMLElement ) => {
190+ if ( ( HostElementPrototype as any ) . __append ) return ;
186191 ( HostElementPrototype as any ) . __append = HostElementPrototype . append ;
187192 HostElementPrototype . append = function ( this : d . HostElement , ...newChildren : ( d . RenderNode | string ) [ ] ) {
188193 newChildren . forEach ( ( newChild : d . RenderNode | string ) => {
@@ -202,6 +207,7 @@ export const patchSlotAppend = (HostElementPrototype: HTMLElement) => {
202207 * @param HostElementPrototype the `Element` to be patched
203208 */
204209export const patchSlotInsertAdjacentHTML = ( HostElementPrototype : HTMLElement ) => {
210+ if ( ( HostElementPrototype as any ) . __insertAdjacentHTML ) return ;
205211 const originalInsertAdjacentHtml = HostElementPrototype . insertAdjacentHTML ;
206212
207213 HostElementPrototype . insertAdjacentHTML = function ( this : d . HostElement , position : InsertPosition , text : string ) {
@@ -249,6 +255,7 @@ export const patchSlotInsertAdjacentText = (HostElementPrototype: HTMLElement) =
249255 * @param HostElementPrototype the custom element prototype to patch
250256 */
251257const patchInsertBefore = ( HostElementPrototype : HTMLElement ) => {
258+ if ( ( HostElementPrototype as any ) . __insertBefore ) return ;
252259 const eleProto : d . RenderNode = HostElementPrototype ;
253260 if ( eleProto . __insertBefore ) return ;
254261
@@ -318,6 +325,7 @@ const patchInsertBefore = (HostElementPrototype: HTMLElement) => {
318325 * @param HostElementPrototype the `Element` to be patched
319326 */
320327export const patchSlotInsertAdjacentElement = ( HostElementPrototype : HTMLElement ) => {
328+ if ( ( HostElementPrototype as any ) . __insertAdjacentElement ) return ;
321329 const originalInsertAdjacentElement = HostElementPrototype . insertAdjacentElement ;
322330
323331 HostElementPrototype . insertAdjacentElement = function (
0 commit comments