@lwrjs/client-modules
Advanced tools
Comparing version 0.0.2-alpha18 to 0.0.2-alpha19
@@ -26,3 +26,3 @@ /** | ||
if (typeof customElements !== 'undefined' && typeof document !== 'undefined') { | ||
const uniqueRoot = rootModules.length === 1; | ||
const container = document.querySelector('[lwr-root]'); | ||
rootModules.forEach(([moduleSpecifier, ctor]) => { | ||
@@ -32,13 +32,8 @@ // Kebab-case the specifier | ||
customElements.define(elementName, ctor.CustomElementConstructor); | ||
}); | ||
customElements.define(elementName, ctor.CustomElementConstructor); // Append the root element to the DOM, if it does not exist | ||
if (uniqueRoot) { | ||
// Append the root element to the DOM, if it does not exist | ||
const rootElementName = toKebabCase(rootModules[0][0]); | ||
const rootEl = document.body.querySelector(rootElementName); | ||
let el = document.body.querySelector(elementName); | ||
if (!rootEl) { | ||
const el = document.createElement(rootElementName); | ||
const container = document.querySelector('[lwr-root]'); | ||
if (!el) { | ||
el = document.createElement(elementName); | ||
@@ -53,4 +48,4 @@ if (container) { | ||
} | ||
} | ||
}); | ||
} | ||
} |
@@ -23,2 +23,3 @@ import { init } from '../init'; | ||
expect(customElements.get('generated-laura-home-page')).toBeDefined(); | ||
expect(document.body.querySelector('generated-laura-home-page')).not.toBeNull(); | ||
}); | ||
@@ -31,2 +32,3 @@ it('initializes and append root element to lwr-root node', () => { | ||
expect(customElements.get('c-darrell')).toBeDefined(); | ||
expect(document.body.querySelector('[lwr-root] c-darrell')).not.toBeNull(); | ||
}); | ||
@@ -45,2 +47,4 @@ it('initializes and skips appending the root element', () => { | ||
expect(customElements.get('c-brian')).toBeDefined(); | ||
expect(document.body.querySelector('c-hunter')).not.toBeNull(); | ||
expect(document.body.querySelector('c-brian')).not.toBeNull(); | ||
}); | ||
@@ -47,0 +51,0 @@ it('initializes in a headless environment', () => { |
@@ -30,3 +30,3 @@ import type { LightningElement } from 'lwc/types'; | ||
if (typeof customElements !== 'undefined' && typeof document !== 'undefined') { | ||
const uniqueRoot = rootModules.length === 1; | ||
const container = document.querySelector('[lwr-root]'); | ||
@@ -39,11 +39,7 @@ rootModules.forEach(([moduleSpecifier, ctor]) => { | ||
customElements.define(elementName, ctor.CustomElementConstructor); | ||
}); | ||
if (uniqueRoot) { | ||
// Append the root element to the DOM, if it does not exist | ||
const rootElementName = toKebabCase(rootModules[0][0]); | ||
const rootEl = document.body.querySelector(rootElementName); | ||
if (!rootEl) { | ||
const el = document.createElement(rootElementName); | ||
const container = document.querySelector('[lwr-root]'); | ||
let el = document.body.querySelector(elementName); | ||
if (!el) { | ||
el = document.createElement(elementName); | ||
if (container) { | ||
@@ -57,4 +53,4 @@ // Append to a node with the "lwr-root" attribute | ||
} | ||
} | ||
}); | ||
} | ||
} |
@@ -7,3 +7,3 @@ { | ||
}, | ||
"version": "0.0.2-alpha18", | ||
"version": "0.0.2-alpha19", | ||
"homepage": "https://lwr.dev/", | ||
@@ -32,3 +32,3 @@ "repository": { | ||
"@locker/sandbox": "0.11.7", | ||
"@lwrjs/shared-utils": "0.0.2-alpha18" | ||
"@lwrjs/shared-utils": "0.0.2-alpha19" | ||
}, | ||
@@ -55,3 +55,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "9cf922f2e624d3255ab89d39a019be4e88793c61" | ||
"gitHead": "96059521952c09f1a411f0aea3fed204a9bd5303" | ||
} |
446833
10832
+ Added@lwrjs/shared-utils@0.0.2-alpha19(transitive)
- Removed@lwrjs/shared-utils@0.0.2-alpha18(transitive)