DOMBuilder
Advanced tools
Comparing version 1.4.1 to 1.4.2
@@ -394,2 +394,8 @@ (function(__global__, undefined) | ||
{ | ||
// innerHTML is a special case, as we can use it to (perhaps | ||
// inadvisedly) to specify entire contents as a string. | ||
if (attr === "innerHTML") | ||
{ | ||
continue; | ||
} | ||
// Don't create attributes which wouldn't make sense in HTML mode - | ||
@@ -425,20 +431,27 @@ // they can be dealt with afet insertion using addEvents(). | ||
// Contents | ||
for (var i = 0, l = this.childNodes.length; i < l; i++) | ||
// If innerHTML was given, use it exclusively for the contents | ||
if ("innerHTML" in this.attributes) | ||
{ | ||
var node = this.childNodes[i]; | ||
if (node instanceof HTMLElement || node instanceof SafeString) | ||
parts.push(this.attributes.innerHTML); | ||
} | ||
else | ||
{ | ||
for (var i = 0, l = this.childNodes.length; i < l; i++) | ||
{ | ||
parts.push(node.toString(trackEvents)); | ||
var node = this.childNodes[i]; | ||
if (node instanceof HTMLElement || node instanceof SafeString) | ||
{ | ||
parts.push(node.toString(trackEvents)); | ||
} | ||
else if (node === "\u00A0") | ||
{ | ||
// Special case to convert these back to entities, | ||
parts.push(" "); | ||
} | ||
else | ||
{ | ||
// Coerce to string and escape | ||
parts.push(escapeHTML(""+node)); | ||
} | ||
} | ||
else if (node === "\u00A0") | ||
{ | ||
// Special case to convert these back to entities, | ||
parts.push(" "); | ||
} | ||
else | ||
{ | ||
// Coerce to string and escape | ||
parts.push(escapeHTML(""+node)); | ||
} | ||
} | ||
@@ -637,3 +650,3 @@ | ||
children = (argsLength == 2 && isArray(args[1]) | ||
? args[1] // (attributes, [child1, ...]) | ||
? args[1] // (attributes, [child1, ...]) | ||
: slice.call(args, 1)); // (attributes, child1, ...) | ||
@@ -652,3 +665,3 @@ } | ||
var DOMBuilder = { | ||
version: "1.4.1", | ||
version: "1.4.2", | ||
@@ -741,16 +754,19 @@ /** | ||
// Append children | ||
for (var i = 0, l = children.length; i < l; i++) | ||
// If content was set via innerHTML, we're done... | ||
if (!("innerHTML" in attributes)) | ||
{ | ||
var child = children[i]; | ||
if (child.nodeType) | ||
// ...otherwise, append children | ||
for (var i = 0, l = children.length; i < l; i++) | ||
{ | ||
el.appendChild(child); | ||
var child = children[i]; | ||
if (child.nodeType) | ||
{ | ||
el.appendChild(child); | ||
} | ||
else | ||
{ | ||
el.appendChild(document.createTextNode(""+child)); | ||
} | ||
} | ||
else | ||
{ | ||
el.appendChild(document.createTextNode(""+child)); | ||
} | ||
} | ||
return el; | ||
@@ -757,0 +773,0 @@ }, |
{ | ||
"name": "DOMBuilder", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "Builder library - generate HTML or DOM Elements (mostly) interchangeably", | ||
"keywords": ["DOM", "HTML", "builder", "fragments"], | ||
"tags": ["DOM", "HTML", "builder", "fragments"], | ||
"author": "Jonathan Buchanan <jonathan.buchanan@gmail.com> (https://github.com/insin)", | ||
"homepage": "http://readthedocs.org/docs/dombuilder/en/1.4.1/index.html", | ||
"homepage": "http://readthedocs.org/docs/dombuilder/en/1.4.2/index.html", | ||
"main": "./DOMBuilder.js", | ||
@@ -9,0 +9,0 @@ "files": ["./DOMBuilder.js"], |
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
28662
904