Compare commits
46 Commits
Author | SHA1 | Date | |
---|---|---|---|
cc5f93305b | |||
67052baad0 | |||
08fc62d06f | |||
975e463fd6 | |||
3bc93871f9 | |||
49db495bb9 | |||
d0ee536301 | |||
344e213c41 | |||
0ae13c970e | |||
0502e7bc99 | |||
c0a425e16d | |||
90089357cf | |||
e36aed4b2b | |||
4d2aa7a0ee | |||
759fa1ff43 | |||
042caeeeb5 | |||
6ddfaffbff | |||
567507c88b | |||
35f7bdd984 | |||
602fa2b7ff | |||
b1aae3e5b9 | |||
6b381d6115 | |||
25006901d9 | |||
ee613836d1 | |||
4b53173618 | |||
46a0220273 | |||
46a6c903e1 | |||
134151eb70 | |||
ac1c3ac53d | |||
09c23d04f4 | |||
3f359cb58c | |||
a85eb48343 | |||
7c851b5ed2 | |||
bcd69059f8 | |||
acba539a6f | |||
446b4c38ea | |||
bc6d3f45f8 | |||
bd381ff23f | |||
7e5bdf8521 | |||
f427141c7c | |||
e8191187a1 | |||
6e1dcccd81 | |||
f8eee10a40 | |||
a6492a5465 | |||
eb9c2bd284 | |||
9991e234ce |
4
.gitignore
vendored
4
.gitignore
vendored
@ -15,8 +15,6 @@ node_modules/
|
|||||||
|
|
||||||
# builds
|
# builds
|
||||||
dist/
|
dist/
|
||||||
dist_web/
|
dist_*/
|
||||||
dist_serve/
|
|
||||||
dist_ts_web/
|
|
||||||
|
|
||||||
# custom
|
# custom
|
@ -19,22 +19,35 @@ mirror:
|
|||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci git mirror
|
- npmci git mirror
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
- notpriv
|
||||||
|
|
||||||
snyk:
|
auditProductionDependencies:
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:snyk
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
stage: security
|
||||||
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
|
- npmci command npm install --production --ignore-scripts
|
||||||
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
- npmci command npm audit --audit-level=high --only=prod --production
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
auditDevDependencies:
|
||||||
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci command npm install --ignore-scripts
|
- npmci command npm install --ignore-scripts
|
||||||
- npmci command snyk test
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
- npmci command npm audit --audit-level=high --only=dev
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
allow_failure: true
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# test stage
|
# test stage
|
||||||
@ -49,9 +62,7 @@ testStable:
|
|||||||
- npmci npm test
|
- npmci npm test
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
|
||||||
- docker
|
- docker
|
||||||
- priv
|
|
||||||
|
|
||||||
testBuild:
|
testBuild:
|
||||||
stage: test
|
stage: test
|
||||||
@ -62,9 +73,7 @@ testBuild:
|
|||||||
- npmci command npm run build
|
- npmci command npm run build
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
@ -84,6 +93,8 @@ release:
|
|||||||
codequality:
|
codequality:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g tslint typescript
|
- npmci command npm install -g tslint typescript
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -15,7 +15,7 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"projectType": {
|
"projectType": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["website", "element", "service", "npm"]
|
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
23152
package-lock.json
generated
23152
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
32
package.json
32
package.json
@ -1,42 +1,46 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartssr",
|
"name": "@pushrocks/smartssr",
|
||||||
"version": "1.0.10",
|
"version": "1.0.35",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "a smart server side renderer supporting shadow dom",
|
"description": "a smart server side renderer supporting shadow dom",
|
||||||
"main": "dist/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/ --web)",
|
"test": "(tstest test/ --web)",
|
||||||
"build": "(tsbuild --web)",
|
"build": "(tsbuild --web)",
|
||||||
"format": "(gitzone format)"
|
"serve": "tsrun scripts/serve.ts"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.24",
|
"@gitzone/tsbuild": "^2.1.26",
|
||||||
"@gitzone/tstest": "^1.0.43",
|
"@gitzone/tstest": "^1.0.54",
|
||||||
"@pushrocks/smartserve": "^1.1.41",
|
"@pushrocks/smartserve": "^1.1.41",
|
||||||
"@pushrocks/tapbundle": "^3.2.9",
|
"@pushrocks/tapbundle": "^3.2.14",
|
||||||
"@types/node": "^14.0.27",
|
"@types/node": "^16.6.1",
|
||||||
"tslint": "^6.1.3",
|
"tslint": "^6.1.3",
|
||||||
"tslint-config-prettier": "^1.15.0"
|
"tslint-config-prettier": "^1.15.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartdelay": "^2.0.10",
|
"@pushrocks/smartdelay": "^2.0.13",
|
||||||
"@pushrocks/smartfile": "^7.0.12",
|
"@pushrocks/smartfile": "^8.0.10",
|
||||||
"@pushrocks/smartpromise": "^3.0.6",
|
"@pushrocks/smartpromise": "^3.1.6",
|
||||||
"@pushrocks/smartpuppeteer": "^1.0.15",
|
"@pushrocks/smartpuppeteer": "^1.0.27",
|
||||||
"@pushrocks/smarttime": "^3.0.24"
|
"@pushrocks/smarttime": "^3.0.38"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
"ts_web/**/*",
|
"ts_web/**/*",
|
||||||
"dist/**/*",
|
"dist/**/*",
|
||||||
"dist_web/**/*",
|
"dist_*/**/*",
|
||||||
|
"dist_ts/**/*",
|
||||||
"dist_ts_web/**/*",
|
"dist_ts_web/**/*",
|
||||||
"assets/**/*",
|
"assets/**/*",
|
||||||
"cli.js",
|
"cli.js",
|
||||||
"npmextra.json",
|
"npmextra.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
|
],
|
||||||
|
"browserslist": [
|
||||||
|
"last 1 chrome versions"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
21
readme.md
21
readme.md
@ -8,13 +8,20 @@ a smart server side renderer supporting shadow dom
|
|||||||
* [docs (typedoc)](https://pushrocks.gitlab.io/smartssr/)
|
* [docs (typedoc)](https://pushrocks.gitlab.io/smartssr/)
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
[](https://gitlab.com/pushrocks/smartssr/commits/master)
|
|
||||||
[](https://gitlab.com/pushrocks/smartssr/commits/master)
|
Status Category | Status Badge
|
||||||
[](https://www.npmjs.com/package/@pushrocks/smartssr)
|
-- | --
|
||||||
[](https://snyk.io/test/npm/@pushrocks/smartssr)
|
GitLab Pipelines | [](https://lossless.cloud)
|
||||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
||||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
npm | [](https://lossless.cloud)
|
||||||
[](https://prettier.io/)
|
Snyk | [](https://lossless.cloud)
|
||||||
|
TypeScript Support | [](https://lossless.cloud)
|
||||||
|
node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
|
Code Style | [](https://lossless.cloud)
|
||||||
|
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
||||||
|
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
||||||
|
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
||||||
|
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
21
test/test.ts
21
test/test.ts
@ -5,28 +5,21 @@ let testSSRInstance: smartssr.SmartSSR;
|
|||||||
|
|
||||||
tap.test('should create a valid smartssr instance', async () => {
|
tap.test('should create a valid smartssr instance', async () => {
|
||||||
testSSRInstance = new smartssr.SmartSSR({
|
testSSRInstance = new smartssr.SmartSSR({
|
||||||
debug: true
|
debug: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should start the smartssr instance', async () => {
|
tap.test('should render central.eu', async (tools) => {
|
||||||
await testSSRInstance.start();
|
|
||||||
});
|
|
||||||
|
|
||||||
tap.test('should render central.eu', async tools => {
|
|
||||||
await testSSRInstance.renderPage('https://central.eu/article/5e76873b9cf69b7bf6bc78bc/Introducing%3A%20central.eu');
|
|
||||||
});
|
|
||||||
|
|
||||||
tap.skip.test('should render lossless.com', async () => {
|
|
||||||
await testSSRInstance.renderPage('https://lossless.com');
|
await testSSRInstance.renderPage('https://lossless.com');
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.skip.test('should render https://lossless.gmbh', async () => {
|
tap.test('should render lossless.com', async () => {
|
||||||
const renderedPage = await testSSRInstance.renderPage('https://lossless.gmbh');
|
await testSSRInstance.renderPage('https://lossless.com');
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should stop the smartssr instance', async () => {
|
tap.test('should render https://lossless.gmbh', async () => {
|
||||||
await testSSRInstance.stop();
|
const renderedPage = await testSSRInstance.renderPage('https://lossless.gmbh');
|
||||||
|
console.log(renderedPage);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
@ -11,79 +11,87 @@ export interface ISmartSSROptions {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export class SmartSSR {
|
export class SmartSSR {
|
||||||
public browser: plugins.smartpuppeteer.puppeteer.Browser;
|
|
||||||
public options: ISmartSSROptions;
|
public options: ISmartSSROptions;
|
||||||
|
|
||||||
constructor(optionsArg?: ISmartSSROptions) {
|
constructor(optionsArg?: ISmartSSROptions) {
|
||||||
this.options = {
|
this.options = {
|
||||||
... {
|
...{
|
||||||
debug: false
|
debug: false,
|
||||||
},
|
},
|
||||||
...optionsArg
|
...optionsArg,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async start() {
|
|
||||||
this.browser = await plugins.smartpuppeteer.getEnvAwareBrowserInstance();
|
|
||||||
}
|
|
||||||
public async stop() {
|
|
||||||
if (this.browser) {
|
|
||||||
await plugins.smartdelay.delayFor(3000);
|
|
||||||
await this.browser.close();
|
|
||||||
this.browser = null;
|
|
||||||
} else {
|
|
||||||
console.log('browser was not in started mode');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async renderPage(urlArg: string) {
|
public async renderPage(urlArg: string) {
|
||||||
const overallTimeMeasurement = new plugins.smarttime.HrtMeasurement();
|
const overallTimeMeasurement = new plugins.smarttime.HrtMeasurement();
|
||||||
overallTimeMeasurement.start();
|
overallTimeMeasurement.start();
|
||||||
const resultDeferred = plugins.smartpromise.defer<string>();
|
const resultDeferred = plugins.smartpromise.defer<string>();
|
||||||
const context = await this.browser.createIncognitoBrowserContext();
|
const browser = new plugins.smartpuppeteer.IncognitoBrowser();
|
||||||
const page = await context.newPage();
|
const renderTimeMeasurement = new plugins.smarttime.HrtMeasurement();
|
||||||
page.on('console', msg => {
|
let renderedPageString: string;
|
||||||
console.log(`${urlArg}: ${msg.text()}`);
|
let screenshotBuffer: Buffer;
|
||||||
});
|
await browser.start();
|
||||||
|
try {
|
||||||
|
const context = await browser.getNewIncognitoContext();
|
||||||
|
const page = await context.newPage();
|
||||||
|
|
||||||
|
// lets protect against left open tabs
|
||||||
|
plugins.smartdelay.delayFor(30000).then(async () => {
|
||||||
|
try {
|
||||||
|
await browser.stop();
|
||||||
|
} catch {}
|
||||||
|
});
|
||||||
|
|
||||||
|
page.on('console', (msg) => {
|
||||||
|
console.log(`${urlArg}: ${msg.text()}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
renderTimeMeasurement.start();
|
||||||
|
await page.goto(urlArg, {
|
||||||
|
waitUntil: 'networkidle2',
|
||||||
|
timeout: 30000,
|
||||||
|
});
|
||||||
|
|
||||||
page.on('load', async (...args) => {
|
|
||||||
await plugins.smartdelay.delayFor(5000);
|
|
||||||
let screenshotBuffer: Buffer;
|
|
||||||
|
|
||||||
if (this.options.debug) {
|
if (this.options.debug) {
|
||||||
screenshotBuffer = await page.screenshot({
|
screenshotBuffer = await page.screenshot({
|
||||||
encoding: 'binary'
|
encoding: 'binary',
|
||||||
});
|
}) as Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
await page.$eval('body', serializeFunction);
|
await page.$eval('body', serializeFunction);
|
||||||
const pageContent = await page.content();
|
const pageContent = await page.content();
|
||||||
const renderedPageString = pageContent;
|
renderedPageString = pageContent;
|
||||||
resultDeferred.resolve(renderedPageString);
|
resultDeferred.resolve(renderedPageString);
|
||||||
|
renderTimeMeasurement.stop();
|
||||||
if (this.options.debug) {
|
|
||||||
plugins.smartfile.memory.toFsSync(
|
|
||||||
renderedPageString,
|
|
||||||
plugins.path.join(paths.noGitDir, 'test.html')
|
|
||||||
);
|
|
||||||
const fs = await import('fs');
|
|
||||||
fs.writeFileSync(plugins.path.join(paths.noGitDir, 'test.png'), screenshotBuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
// lets clean up async
|
||||||
|
await page.close();
|
||||||
const renderTimeMeasurement = new plugins.smarttime.HrtMeasurement();
|
await context.close();
|
||||||
renderTimeMeasurement.start();
|
} catch (e) {
|
||||||
await page.goto(urlArg);
|
console.log(e);
|
||||||
const result = await resultDeferred.promise;
|
await browser.stop();
|
||||||
renderTimeMeasurement.stop();
|
return;
|
||||||
|
}
|
||||||
// lets clean up async
|
await browser.stop();
|
||||||
context.close();
|
|
||||||
|
|
||||||
overallTimeMeasurement.stop();
|
overallTimeMeasurement.stop();
|
||||||
console.log(`Overall it took ${overallTimeMeasurement.milliSeconds} milliseconds to render ${urlArg}`);
|
console.log(
|
||||||
console.log(`The rendering alone took ${renderTimeMeasurement.milliSeconds} milliseconds for ${urlArg}`)
|
`Overall it took ${overallTimeMeasurement.milliSeconds} milliseconds to render ${urlArg}`
|
||||||
return result;
|
);
|
||||||
|
console.log(
|
||||||
|
`The rendering alone took ${renderTimeMeasurement.milliSeconds} milliseconds for ${urlArg}`
|
||||||
|
);
|
||||||
|
|
||||||
|
// debug
|
||||||
|
if (this.options.debug) {
|
||||||
|
plugins.smartfile.memory.toFsSync(
|
||||||
|
renderedPageString,
|
||||||
|
plugins.path.join(paths.noGitDir, 'test.html')
|
||||||
|
);
|
||||||
|
const fs = await import('fs');
|
||||||
|
fs.writeFileSync(plugins.path.join(paths.noGitDir, 'test.png'), screenshotBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultDeferred.promise;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
declare var document: Document;
|
declare var document: Document;
|
||||||
export function serializeFunction(rootNode) {
|
export function serializeFunction(rootNode: Node) {
|
||||||
const uuidv4 = () => {
|
const uuidv4 = () => {
|
||||||
return 'unixxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
return 'unixxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
||||||
const r = (Math.random() * 16) | 0;
|
const r = (Math.random() * 16) | 0;
|
||||||
@ -26,7 +26,7 @@ export function serializeFunction(rootNode) {
|
|||||||
};
|
};
|
||||||
const loopProtection: any[] = [];
|
const loopProtection: any[] = [];
|
||||||
|
|
||||||
function serializeNode(nodeArg: HTMLElement, logThis = false) {
|
function serializeNode(nodeArg: HTMLElement | any, logThis = false) {
|
||||||
if (loopProtection.includes(nodeArg)) {
|
if (loopProtection.includes(nodeArg)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -34,37 +34,60 @@ export function serializeFunction(rootNode) {
|
|||||||
// console.log(nodeArg.nodeName);
|
// console.log(nodeArg.nodeName);
|
||||||
if (nodeArg.shadowRoot) {
|
if (nodeArg.shadowRoot) {
|
||||||
nodeArg.setAttribute('smartssr', 'yes');
|
nodeArg.setAttribute('smartssr', 'yes');
|
||||||
|
|
||||||
// lets handle the current node
|
// lets handle the current node
|
||||||
const nodeUUID = uuidv4();
|
const nodeUUID = uuidv4();
|
||||||
|
|
||||||
nodeArg.classList.add(nodeUUID);
|
nodeArg.classList.add(nodeUUID);
|
||||||
|
|
||||||
|
// find all slots
|
||||||
const slots = nodeArg.shadowRoot.querySelectorAll('slot');
|
const slots = nodeArg.shadowRoot.querySelectorAll('slot');
|
||||||
|
|
||||||
// handle slot element
|
// handle slot element
|
||||||
slots.forEach((slot) => {
|
const slotsForMove: HTMLSlotElement[] = [];
|
||||||
nodeArg.childNodes.forEach((lightNode) => slot.parentNode.insertBefore(lightNode, slot));
|
slots.forEach((slot: any) => {
|
||||||
slot.parentNode.removeChild(slot);
|
slotsForMove.push(slot);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
for (const slot of slotsForMove) {
|
||||||
|
const slottedLightNodesForMove: any[] = [];
|
||||||
|
slot.assignedNodes().forEach((lightNode) => slottedLightNodesForMove.push(lightNode));
|
||||||
|
slottedLightNodesForMove.forEach((lightNode) =>
|
||||||
|
slot.parentNode.insertBefore(lightNode, slot)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// lets modify the css
|
// lets modify the css
|
||||||
const childNodes = nodeArg.shadowRoot.childNodes;
|
const childNodes = nodeArg.shadowRoot.childNodes;
|
||||||
// tslint:disable-next-line: prefer-for-of
|
// tslint:disable-next-line: prefer-for-of
|
||||||
const noteForAppending: HTMLElement[] = [];
|
const noteForAppending: HTMLElement[] = [];
|
||||||
childNodes.forEach((childNode) => {
|
|
||||||
|
// lets care about static css first
|
||||||
|
if (
|
||||||
|
(nodeArg.constructor as any).styles &&
|
||||||
|
(nodeArg.constructor as any).styles instanceof Array
|
||||||
|
) {
|
||||||
|
for (const objectArg of (nodeArg.constructor as any).styles) {
|
||||||
|
const styleTag = document.createElement('style');
|
||||||
|
styleTag.textContent = prependCss(nodeUUID, objectArg.cssText);
|
||||||
|
noteForAppending.push(styleTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
childNodes.forEach((childNode: ChildNode) => {
|
||||||
if (childNode instanceof HTMLElement) {
|
if (childNode instanceof HTMLElement) {
|
||||||
if (childNode.tagName === 'STYLE') {
|
if (childNode.tagName === 'STYLE') {
|
||||||
childNode.textContent = prependCss(nodeUUID, childNode.textContent);
|
childNode.textContent = prependCss(nodeUUID, childNode.textContent);
|
||||||
} else {
|
} else {
|
||||||
if (nodeArg.tagName?.includes('ARTICLEGRID')) {
|
|
||||||
console.log('hello ' + childNode.id);
|
|
||||||
}
|
|
||||||
serializeNode(childNode, logThis);
|
serializeNode(childNode, logThis);
|
||||||
}
|
}
|
||||||
noteForAppending.push(childNode);
|
noteForAppending.push(childNode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
noteForAppending.forEach(childNode => {
|
while (nodeArg.firstChild) {
|
||||||
|
nodeArg.removeChild(nodeArg.firstChild);
|
||||||
|
}
|
||||||
|
noteForAppending.forEach((childNode) => {
|
||||||
nodeArg.append(childNode);
|
nodeArg.append(childNode);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user