Comparing version 2.5.0 to 2.5.1
@@ -19,2 +19,11 @@ var React = require('react') | ||
// use custom components by doing `<${Component}>` | ||
function FancyTable (props) { | ||
return hx` | ||
<table class=fancy> | ||
${props.children} | ||
</table> | ||
` | ||
} | ||
var title = 'world' | ||
@@ -34,4 +43,6 @@ var wow = [1,2,3] | ||
<table>${frag}</table> | ||
<${FancyTable}> | ||
${frag} | ||
</${FancyTable}> | ||
</div>` | ||
console.log(toString(tree)) |
@@ -268,2 +268,3 @@ var attrToProp = require('hyperscript-attribute-to-property') | ||
else if (x && typeof x === 'object') return x | ||
else if (x === null || x === undefined) return x | ||
else return concat('', x) | ||
@@ -270,0 +271,0 @@ } |
{ | ||
"name": "hyperx", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"description": "tagged template string virtual dom builder", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -77,1 +77,37 @@ var test = require('tape') | ||
}) | ||
test('null and undefined attributes', function (t) { | ||
var tree = hx`<div onclick="alert(1)" onmouseenter=${undefined} onmouseleave=${null}></div>` | ||
t.equal(vdom.create(tree).toString(), `<div onclick="alert(1)"></div>`) | ||
t.end() | ||
}) | ||
test('undefined (with quotes) attribute value is evaluated', function (t) { | ||
var tree = hx`<div foo='undefined'></div>` | ||
t.equal(vdom.create(tree).toString(), `<div foo="undefined"></div>`) | ||
t.end() | ||
}) | ||
test('null (with quotes) attribute value is evaluated', function (t) { | ||
var tree = hx`<div foo='null'></div>` | ||
t.equal(vdom.create(tree).toString(), `<div foo="null"></div>`) | ||
t.end() | ||
}) | ||
test('undefined (without quotes) attribute value is evaluated', function (t) { | ||
var tree = hx`<div foo=undefined></div>` | ||
t.equal(vdom.create(tree).toString(), `<div foo="undefined"></div>`) | ||
t.end() | ||
}) | ||
test('null (without quotes) attribute value is evaluated', function (t) { | ||
var tree = hx`<div foo=null></div>` | ||
t.equal(vdom.create(tree).toString(), `<div foo="null"></div>`) | ||
t.end() | ||
}) | ||
test('null is ignored and adjacent attribute is evaluated', function (t) { | ||
var tree = hx`<div foo=${null} t></div>` | ||
t.equal(vdom.create(tree).toString(), `<div t="t"></div>`) | ||
t.end() | ||
}) |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
38963
999
1