react-faux-dom
Advanced tools
Comparing version 1.0.7 to 1.1.0
{ | ||
"name": "react-faux-dom", | ||
"version": "1.0.7", | ||
"version": "1.1.0", | ||
"description": "DOM like data structure to be mutated by D3 et al, then rendered to React elements", | ||
@@ -5,0 +5,0 @@ "main": "src/ReactFauxDOM.js", |
@@ -206,3 +206,4 @@ var React = require('react') | ||
index = index || 0 | ||
var props = this.props | ||
var props = clone(this.props) | ||
props.style = clone(props.style) | ||
@@ -214,10 +215,9 @@ function uniqueKey () { | ||
if (typeof props.key === 'undefined') { | ||
props = clone(props) | ||
props.key = uniqueKey() | ||
delete props.style.setProperty | ||
delete props.style.getProperty | ||
delete props.style.removeProperty | ||
} | ||
delete props.style.setProperty | ||
delete props.style.getProperty | ||
delete props.style.removeProperty | ||
return React.createElement(this.nodeName, props, this.text || this.children.map(function (el, i) { | ||
@@ -224,0 +224,0 @@ if (el instanceof Element) { |
@@ -43,3 +43,3 @@ var test = require('tape') | ||
test('pre-built React elements elements are rendered into the tree', function (t) { | ||
test('pre-built React elements are rendered into the tree', function (t) { | ||
var el = mk().node() | ||
@@ -57,1 +57,9 @@ var sub = mk() | ||
}) | ||
test('toReact does not mutate the state', function (t) { | ||
var el = mk().node() | ||
t.plan(2) | ||
t.equal(typeof el.props.style.setProperty, 'function') | ||
el.toReact() | ||
t.equal(typeof el.props.style.setProperty, 'function') | ||
}) |
@@ -38,1 +38,12 @@ var test = require('tape') | ||
}) | ||
test('when using a key the style object is still cleaned', function (t) { | ||
var el = mk().node() | ||
el.setAttribute('key', 'test') | ||
el.style.backgroundColor = 'red' | ||
var r = el.toReact() | ||
t.plan(3) | ||
t.equal(typeof r.props.style.setProperty, 'undefined') | ||
t.equal(typeof r.props.style.getProperty, 'undefined') | ||
t.equal(typeof r.props.style.removeProperty, 'undefined') | ||
}) |
20504
500