htmljs-parser
Advanced tools
Comparing version 2.8.0 to 2.8.1
@@ -135,2 +135,3 @@ exports.createNotifiers = function(parser, listeners) { | ||
var newAttr = { | ||
default: attr.default, | ||
name: attr.name, | ||
@@ -137,0 +138,0 @@ value: attr.value, |
@@ -41,3 +41,3 @@ { | ||
}, | ||
"version": "2.8.0" | ||
"version": "2.8.1" | ||
} |
@@ -5,9 +5,20 @@ 'use strict'; | ||
function attributesToString(attributes, includeLiteralValues) { | ||
if (!attributes || attributes.length === 0) { | ||
var len = attributes && attributes.length || 0; | ||
if (!len) { | ||
return ''; | ||
} | ||
return ' ' + attributes.map(function(attr) { | ||
var result = attr.name; | ||
var i = 0; | ||
var result = ""; | ||
var attr = attributes[0]; | ||
if (attr.default) { | ||
i = 1; | ||
result = attributeAssignmentToString(attr, includeLiteralValues); | ||
} | ||
for (;i < len; i++) { | ||
attr = attributes[i]; | ||
result += " " + attr.name; | ||
if (attr.argument) { | ||
@@ -17,16 +28,24 @@ result += '(' + attr.argument.value + ')'; | ||
if (attr.value) { | ||
result += '=' + attr.value; | ||
} else if (!attr.argument) { | ||
result += '=(EMPTY)'; | ||
} | ||
result += attributeAssignmentToString(attr, includeLiteralValues); | ||
} | ||
if (includeLiteralValues) { | ||
result += '[Literal: ' + (attr.hasOwnProperty('literalValue') ? JSON.stringify(attr.literalValue) : '(empty)') + ']'; | ||
} | ||
return result; | ||
// return '[' + result + ']'; | ||
}).join(' '); | ||
return result; | ||
} | ||
function attributeAssignmentToString(attr, includeLiteralValues) { | ||
var result = ""; | ||
if (attr.value) { | ||
result += '=' + attr.value; | ||
} else if (!attr.argument) { | ||
result += '=(EMPTY)'; | ||
} | ||
if (includeLiteralValues) { | ||
result += '[Literal: ' + (attr.hasOwnProperty('literalValue') ? JSON.stringify(attr.literalValue) : '(empty)') + ']'; | ||
} | ||
return result; | ||
} | ||
class RootNode { | ||
@@ -33,0 +52,0 @@ constructor() { |
Sorry, the diff of this file is too big to display
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
3976
260792
996