dom-serializer
Advanced tools
Comparing version 0.0.1 to 0.1.0
22
index.js
@@ -98,12 +98,5 @@ /* | ||
wbr: true, | ||
//common self closing svg elements | ||
path: true, | ||
circle: true, | ||
ellipse: true, | ||
line: true, | ||
rect: true, | ||
use: true | ||
}; | ||
var render = module.exports = function(dom, opts) { | ||
@@ -136,2 +129,5 @@ if (!Array.isArray(dom) && !dom.cheerio) dom = [dom]; | ||
function renderTag(elem, opts) { | ||
// Handle SVG | ||
if (elem.name === "svg") opts = {decodeEntities: opts.decodeEntities, xmlMode: true}; | ||
var tag = '<' + elem.name, | ||
@@ -145,4 +141,4 @@ attribs = formatAttrs(elem.attribs, opts); | ||
if ( | ||
opts.xmlMode && | ||
(!elem.children || elem.children.length === 0) | ||
opts.xmlMode | ||
&& (!elem.children || elem.children.length === 0) | ||
) { | ||
@@ -152,3 +148,5 @@ tag += '/>'; | ||
tag += '>'; | ||
tag += render(elem.children, opts); | ||
if (elem.children) { | ||
tag += render(elem.children, opts); | ||
} | ||
@@ -160,4 +158,2 @@ if (!singleTag[elem.name] || opts.xmlMode) { | ||
return tag; | ||
@@ -164,0 +160,0 @@ } |
{ | ||
"name": "dom-serializer", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "render dom nodes to string", | ||
@@ -16,2 +16,5 @@ "author": "Felix Boehm <me@feedic.com>", | ||
"main": "./index.js", | ||
"files": [ | ||
"index.js" | ||
], | ||
"dependencies": { | ||
@@ -22,11 +25,13 @@ "domelementtype": "~1.1.1", | ||
"devDependencies": { | ||
"mocha": "*", | ||
"cheerio": "*", | ||
"expect.js": "~0.3.1", | ||
"jshint": "~2.3.0", | ||
"lodash": "~2.4.1", | ||
"jshint": "~2.3.0", | ||
"cheerio": "*" | ||
"mocha": "*", | ||
"xyz": "0.4.x" | ||
}, | ||
"scripts": { | ||
"test": "mocha test.js" | ||
} | ||
}, | ||
"license": "MIT" | ||
} |
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
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
0
5136
6
3
152