Socket
Socket
Sign inDemoInstall

hyperx

Package Overview
Dependencies
Maintainers
26
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperx - npm Package Compare versions

Comparing version 2.5.0 to 2.5.1

13

example/react.js

@@ -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 @@ }

2

package.json
{
"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()
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc