magic-virtual-element
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -5,4 +5,12 @@ var toStyle = require('to-style').string | ||
var type = require('component-type') | ||
var slice = require('sliced') | ||
module.exports = function (t, attributes, children) { | ||
// Account for JSX putting the children as multiple arguments. | ||
// This is essentially just the ES6 rest param | ||
if (arguments.length > 2 && Array.isArray(arguments[2]) === false) { | ||
children = slice(arguments, 2) | ||
} | ||
var node = element(t, attributes, children) | ||
@@ -9,0 +17,0 @@ |
{ | ||
"name": "magic-virtual-element", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"repository": "dekujs/magic-virtual-element", | ||
@@ -20,2 +20,3 @@ "description": "Build virtual tree elements with magic attributes", | ||
"component-type": "^1.1.0", | ||
"sliced": "^1.0.1", | ||
"to-style": "^1.3.3", | ||
@@ -22,0 +23,0 @@ "virtual-element": "^1.1.0" |
@@ -8,3 +8,3 @@ /** | ||
test('magic attributes', ({ equal, end, ok }) => { | ||
test('magic attributes', ({equal, end, ok}) => { | ||
var node | ||
@@ -37,2 +37,10 @@ | ||
ok(node.attributes.style === 'border-width: 1px') | ||
}) | ||
test.only('jsx compatiblity', ({equal, end}) => { | ||
var child1 = element('div') | ||
var child2 = element('div') | ||
var node = element('div', null, child1, child2) | ||
equal(node.children.length,2, 'children are spread') | ||
end() | ||
}) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
26662
724
0
5
+ Addedsliced@^1.0.1
+ Addedsliced@1.0.1(transitive)