@dreamworld/web-util
Advanced tools
Comparing version 1.3.1-trim-html-is-not-woking-with-nested-html.2 to 1.3.1-trim-html-is-not-woking-with-nested-html.3
@@ -32,8 +32,10 @@ import textToHtml from './textToHtml'; | ||
var trimStart = false; | ||
var bRemoveChild = true; | ||
var childNodes = Array.from(el.childNodes || []); | ||
childNodes.forEach(child => { | ||
if(!trimStart) { | ||
if(!trimStart && bRemoveChild) { | ||
if(!child.textContent || !child.textContent.trim() === "") { | ||
el.removeChild(child); | ||
} else { | ||
bRemoveChild = false; | ||
if(child.nodeType == Node.TEXT_NODE) { | ||
@@ -83,8 +85,10 @@ child.textContent = child.textContent.trimStart(); | ||
var trimEnd = false; | ||
var bRemoveChild = true; | ||
var childNodes = Array.from(el.childNodes || []).reverse(); | ||
childNodes.forEach(child => { | ||
if(!trimEnd) { | ||
if(!trimEnd && bRemoveChild) { | ||
if(!child.textContent || !child.textContent.trim() === "") { | ||
el.removeChild(child); | ||
} else { | ||
bRemoveChild = false; | ||
if(child.nodeType == Node.TEXT_NODE) { | ||
@@ -91,0 +95,0 @@ child.textContent = child.textContent.trimEnd(); |
{ | ||
"name": "@dreamworld/web-util", | ||
"version": "1.3.1-trim-html-is-not-woking-with-nested-html.2", | ||
"version": "1.3.1-trim-html-is-not-woking-with-nested-html.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10759
200