Socket
Socket
Sign inDemoInstall

@open-wc/semantic-dom-diff

Package Overview
Dependencies
Maintainers
2
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.6.1 to 0.6.2

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [0.6.2](https://github.com/open-wc/open-wc/tree/master/packages/semantic-dom-diff/compare/@open-wc/semantic-dom-diff@0.6.1...@open-wc/semantic-dom-diff@0.6.2) (2018-12-20)
### Bug Fixes
* properly apply prettier ([a12bb09](https://github.com/open-wc/open-wc/tree/master/packages/semantic-dom-diff/commit/a12bb09))
## [0.6.1](https://github.com/open-wc/open-wc/tree/master/packages/semantic-dom-diff/compare/@open-wc/semantic-dom-diff@0.6.0...@open-wc/semantic-dom-diff@0.6.1) (2018-12-20)

@@ -8,0 +19,0 @@

8

package.json
{
"name": "@open-wc/semantic-dom-diff",
"version": "0.6.1",
"version": "0.6.2",
"description": "To compare dom and shadow dom trees. Part of open-wc recommendations",

@@ -26,4 +26,4 @@ "author": "open-wc",

"@bundled-es-modules/chai": "^4.2.0",
"@open-wc/testing-karma": "^0.4.1",
"@open-wc/testing-karma-bs": "^0.2.1",
"@open-wc/testing-karma": "^0.4.2",
"@open-wc/testing-karma-bs": "^0.2.2",
"@open-wc/testing-wallaby": "^0.1.4",

@@ -33,3 +33,3 @@ "mocha": "^5.0.0",

},
"gitHead": "c9e573bb063cabb3798c7ccf6bd22c58664d2992"
"gitHead": "e252bcf876e3061f6434e5165a3f8497354ae48f"
}

@@ -20,5 +20,3 @@ import { isElement, isTextNode } from './parse5-utils.js';

if (isAttribute(arg)) {
return arg.value
? `attribute [${arg.name}="${arg.value}"]`
: `attribute [${arg.name}]`;
return arg.value ? `attribute [${arg.name}="${arg.value}"]` : `attribute [${arg.name}]`;
}

@@ -25,0 +23,0 @@

@@ -11,26 +11,32 @@ /* eslint-disable no-param-reassign */

function sortAttributes(attrs) {
return attrs
// Sort attributes
.map((attr) => {
if (attr.name === 'class') {
attr.value = attr.value.trim().split(/\s+/).sort().join(' ');
}
return (
attrs
// Sort attributes
.map(attr => {
if (attr.name === 'class') {
attr.value = attr.value
.trim()
.split(/\s+/)
.sort()
.join(' ');
}
return attr;
})
// Sort classes
.sort((attrA, attrB) => {
const a = attrA.name.toLowerCase();
const b = attrB.name.toLowerCase();
return attr;
})
// Sort classes
.sort((attrA, attrB) => {
const a = attrA.name.toLowerCase();
const b = attrB.name.toLowerCase();
if (a < b) {
return -1;
}
if (a < b) {
return -1;
}
if (a > b) {
return 1;
}
if (a > b) {
return 1;
}
return 0;
});
return 0;
})
);
}

@@ -37,0 +43,0 @@

export function sanitizeHtmlString(htmlString) {
return htmlString
// Remove space characters after opening tags
.replace(/>\s+/g, '>')
// Remove space characters before closing tags
.replace(/\s+</g, '<')
// remove lit-html expression markers
.replace(/<!---->/g, '')
// Remove leading and trailing whitespace
.trim();
return (
htmlString
// Remove space characters after opening tags
.replace(/>\s+/g, '>')
// Remove space characters before closing tags
.replace(/\s+</g, '<')
// remove lit-html expression markers
.replace(/<!---->/g, '')
// Remove leading and trailing whitespace
.trim()
);
}
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