Socket
Socket
Sign inDemoInstall

@open-wc/semantic-dom-diff

Package Overview
Dependencies
Maintainers
3
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@open-wc/semantic-dom-diff - npm Package Compare versions

Comparing version 0.19.3 to 0.19.4

6

CHANGELOG.md
# 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 @@

33

get-diffable-html.js

@@ -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 @@ *

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc