diff --git a/index.js b/index.js index c147d4c..99a4af0 100644 --- a/index.js +++ b/index.js @@ -70,7 +70,8 @@ export default function(opts) { * it's difficult to know what the correct/final slot content will be until after the parser has rendered the DOM for * us. * - * When performing shadow DOM rendering, it provides an un-styled container where we can attach + * When performing shadow DOM rendering, it provides an un-styled container where we can attach the Svelte component + * once it begins rendering. */ if (!window.customElements.get('svelte-retag')) { window.customElements.define('svelte-retag', class extends HTMLElement { @@ -148,7 +149,7 @@ export default function(opts) { // If compiled as IIFE/UMD and executed early, then the document is likely to be in the process of loading // and thus actively parsing tags, including not only this tag but also nested content (which may not yet be - // available yet). + // available). const isLoading = (document.readyState === 'loading'); // Setup the special wrapper if not already present (which can happen when @@ -241,7 +242,8 @@ export default function(opts) { // construct/connectedCallback on this one). this._restoreLightSlots(); - // Lastly, unwinding everything in reverse: Remove the special wrapper. + // Lastly, unwinding everything in reverse: Remove the "light" DOM root (the special wrapper) which + // is only added during connectedCallback(), unlike shadow DOM which is attached in construct. this.removeChild(this._root); } } @@ -312,8 +314,10 @@ export default function(opts) { } /** - * To support context, this traverses the DOM to find potential parent svelte-retag elements which may contain - * context necessary to render this component. See context functions at: https://svelte.dev/docs/svelte#setcontext + * To support context, this traverses the DOM to find potential parent elements (also managed by svelte-retag) which + * may contain context necessary to render this component. + * + * See context functions at: https://svelte.dev/docs/svelte#setcontext * * @returns {Map|null} */