WebKit Bugzilla
Attachment 347145 Details for
Bug 183586
: connectedCallback is invoked during the removal of the element inside another element's connectedCallback
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Only repro that produces different results in Safari vs. Chrome/Firefox
bug183586.html (text/html), 1.42 KB, created by
Ryosuke Niwa
on 2018-08-14 19:40:52 PDT
(
hide
)
Description:
Only repro that produces different results in Safari vs. Chrome/Firefox
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2018-08-14 19:40:52 PDT
Size:
1.42 KB
patch
obsolete
><!doctype html> ><html> ><body> ><pre id="log"></pre> ><script> > >function log(text) { > document.getElementById('log').textContent += `${text}\n`; >} > >class Parenter extends HTMLElement { > connectedCallback() { > const child = this.firstChild; > log('Parenter.connectedCallback removal begin'); > this.removeChild(child); > log('Parenter.connectedCallback removal end'); > this.appendChild(child); > } >} >customElements.define('x-parenter', Parenter); > >class Child extends HTMLElement { > constructor() { > super(); > log('child constructor'); > } > connectedCallback() { > log('Child.connectedCallback isConnected=' + this.isConnected.toString()); > } > disconnectedCallback2() { > log('Child.disconnectedCallback isConnected=' + this.isConnected.toString()); > } >} >customElements.define('x-child', Child); > >const container = document.createElement('div'); >container.innerHTML = '<x-parenter><x-child></x-child></x-parenter>'; >customElements.upgrade(container); >document.body.appendChild(container); >/* >const htmlFragment = '<x-parenter><x-child></x-child></x-parenter>'; > >function appendWithDOMParser(body, fragment, mime) { > const doc = (new DOMParser()).parseFromString(fragment, mime); > const resultBody = document.importNode(doc.body, true); > > log('append begin'); > body.appendChild(resultBody); >} > >appendWithDOMParser(document.body, htmlFragment, 'text/html'); >*/ ></script> ></body> ></html> >
<!doctype html> <html> <body> <pre id="log"></pre> <script> function log(text) { document.getElementById('log').textContent += `${text}\n`; } class Parenter extends HTMLElement { connectedCallback() { const child = this.firstChild; log('Parenter.connectedCallback removal begin'); this.removeChild(child); log('Parenter.connectedCallback removal end'); this.appendChild(child); } } customElements.define('x-parenter', Parenter); class Child extends HTMLElement { constructor() { super(); log('child constructor'); } connectedCallback() { log('Child.connectedCallback isConnected=' + this.isConnected.toString()); } disconnectedCallback2() { log('Child.disconnectedCallback isConnected=' + this.isConnected.toString()); } } customElements.define('x-child', Child); const container = document.createElement('div'); container.innerHTML = '<x-parenter><x-child></x-child></x-parenter>'; customElements.upgrade(container); document.body.appendChild(container); /* const htmlFragment = '<x-parenter><x-child></x-child></x-parenter>'; function appendWithDOMParser(body, fragment, mime) { const doc = (new DOMParser()).parseFromString(fragment, mime); const resultBody = document.importNode(doc.body, true); log('append begin'); body.appendChild(resultBody); } appendWithDOMParser(document.body, htmlFragment, 'text/html'); */ </script> </body> </html>
View Attachment As Raw
Actions:
View
Attachments on
bug 183586
:
335672
|
340977
|
340981
|
341004
|
341117
|
341135
|
341186
|
341211
|
341272
|
341278
|
345570
|
345834
|
346614
| 347145 |
357032