@open-wc/semantic-dom-diff
Advanced tools
Comparing version 0.6.1 to 0.6.2
@@ -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 @@ |
{ | ||
"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() | ||
); | ||
} |
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
18559
312