min-documentx
Advanced tools
Comparing version 2.19.0 to 2.20.0
{ | ||
"name": "min-documentx", | ||
"version": "2.19.0", | ||
"version": "2.20.0", | ||
"description": "A minimal DOM implementation", | ||
"keywords": [], | ||
"author": "Raynos <raynos2@gmail.com>", | ||
"repository": "git://github.com/Javey/min-document.git", | ||
"repository": "git://github.com/Raynos/min-document.git", | ||
"main": "index", | ||
"homepage": "https://github.com/Javey/min-document", | ||
"homepage": "https://github.com/Raynos/min-document", | ||
"contributors": [ | ||
@@ -16,3 +16,3 @@ { | ||
"bugs": { | ||
"url": "https://github.com/Javey/min-document/issues", | ||
"url": "https://github.com/Raynos/min-document/issues", | ||
"email": "raynos2@gmail.com" | ||
@@ -19,0 +19,0 @@ }, |
@@ -49,3 +49,6 @@ module.exports = serializeNode | ||
if (key === "style" && (type === "string" && elem[key] || Object.keys(elem.style).length > 0)) { | ||
if (key === "style" && ( | ||
(type === "object" && Object.keys(elem.style).length > 0) || | ||
(type === "string" && elem.style) | ||
)) { | ||
return true | ||
@@ -55,3 +58,3 @@ } | ||
return elem.hasOwnProperty(key) && | ||
(type === "string" || type === "boolean" || type === "number") && | ||
(type === "string" || (type === "boolean" && elem[key]) || type === "number") && | ||
key !== "nodeName" && key !== "className" && key !== "tagName" && | ||
@@ -125,11 +128,3 @@ key !== "textContent" && key !== "innerText" && key !== "namespaceURI" && key !== "innerHTML" | ||
function escapeText(s) { | ||
var str = ''; | ||
if (typeof(s) === 'string') { | ||
str = s; | ||
} else if (s) { | ||
str = s.toString(); | ||
} | ||
return str | ||
return String(s) | ||
.replace(/&/g, "&") | ||
@@ -136,0 +131,0 @@ .replace(/</g, "<") |
@@ -204,5 +204,7 @@ var test = require("tape") | ||
div.setAttribute("data-number", 100) | ||
div.setAttribute("data-zero", 0) | ||
div.setAttribute("data-boolean", true) | ||
div.setAttribute("data-false", false) | ||
div.setAttribute("data-null", null) | ||
assert.equal(div.toString(), '<div data-number="100" data-boolean="true" data-null=""></div>') | ||
assert.equal(div.toString(), '<div data-number="100" data-zero="0" data-boolean="true" data-false="false" data-null="null"></div>') | ||
cleanup() | ||
@@ -212,2 +214,14 @@ assert.end() | ||
test("can handle non string property values", function(assert) { | ||
var div = document.createElement("div") | ||
div.id = 100 | ||
div.title = 0 | ||
div.contentEditable = true | ||
div.selected = false | ||
div.className = null | ||
assert.equal(div.toString(), '<div id="100" title="0" contentEditable="true"></div>') | ||
cleanup() | ||
assert.end() | ||
}) | ||
test("can serialize textarea correctly", function(assert) { | ||
@@ -214,0 +228,0 @@ var input = document.createElement("textarea") |
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
55200
1182
26