@open-wc/semantic-dom-diff
Advanced tools
Comparing version 0.19.3 to 0.19.4
# Change Log | ||
## 0.19.4 | ||
### Patch Changes | ||
- 47f54fb0: Remove comments before creating the TreeWalking, so text nodes should not be splitted by them and treated as semantic. | ||
## 0.19.3 | ||
@@ -4,0 +10,0 @@ |
@@ -95,6 +95,22 @@ const DEFAULT_IGNORE_TAGS = ['script', 'style', 'svg']; | ||
/** @param {Text} textNode */ | ||
function printText(textNode) { | ||
const value = textNode.nodeValue.trim(); | ||
/** | ||
* @param {Text} textNode | ||
* @param {TreeWalker} walker | ||
*/ | ||
function printText(textNode, walker) { | ||
let value = ''; | ||
let node = textNode; | ||
while (node && node instanceof Text) { | ||
value += node.nodeValue; | ||
node = walker.nextSibling(); | ||
} | ||
if (node) { | ||
walker.previousSibling(); | ||
} | ||
value = value.trim(); | ||
if (value !== '') { | ||
@@ -196,4 +212,7 @@ text += `${getIndentation()}${value}\n`; | ||
/** @param {Node} node */ | ||
function onNodeStart(node) { | ||
/** | ||
* @param {Node} node | ||
* @param {TreeWalker} walker | ||
*/ | ||
function onNodeStart(node, walker) { | ||
// don't print this node if we should ignore it | ||
@@ -212,3 +231,3 @@ if (getTagName(node) === 'diff-container' || ignoreTags.includes(getTagName(node))) { | ||
if (node instanceof Text) { | ||
printText(node); | ||
printText(node, walker); | ||
} else if (node instanceof Element) { | ||
@@ -265,3 +284,3 @@ printOpenElement(node); | ||
const current = walker.currentNode; | ||
onNodeStart(current); | ||
onNodeStart(current, walker); | ||
@@ -268,0 +287,0 @@ // crawl children if we should for this node, and if it has children |
{ | ||
"name": "@open-wc/semantic-dom-diff", | ||
"version": "0.19.3", | ||
"version": "0.19.4", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
@@ -323,8 +323,4 @@ --- | ||
<my-element> | ||
<p> | ||
Here's my button | ||
</p> | ||
<my-button-23443 data-tag-name="my-button"> | ||
Hey! | ||
</my-button-23443> | ||
<p>Here's my button</p> | ||
<my-button-23443 data-tag-name="my-button"> Hey! </my-button-23443> | ||
</my-element> | ||
@@ -348,5 +344,3 @@ ``` | ||
<my-element> | ||
<p> | ||
Here's my button | ||
</p> | ||
<p>Here's my button</p> | ||
</my-element> | ||
@@ -370,8 +364,4 @@ ``` | ||
<my-element> | ||
<p> | ||
Here's my button | ||
</p> | ||
<my-button data-tag-name="my-button"> | ||
Hey! | ||
</my-button> | ||
<p>Here's my button</p> | ||
<my-button data-tag-name="my-button"> Hey! </my-button> | ||
</my-element> | ||
@@ -378,0 +368,0 @@ ``` |
@@ -26,3 +26,3 @@ // @ts-nocheck | ||
/** | ||
* For comparision we do not need the style scoping classes on polyfilled browsers | ||
* For comparison we do not need the style scoping classes on polyfilled browsers | ||
* Rather naive approach for now - probably need to improve once we have failing cases. | ||
@@ -29,0 +29,0 @@ * |
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
67109
688
370