react-faux-dom
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "react-faux-dom", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"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", |
@@ -246,2 +246,20 @@ var React = require('react') | ||
// These NS methods are called by things like D3 if it spots a namespace. | ||
// Like xlink:href. I don't care about namespaces, so these functions have NS aliases created. | ||
var namespaceMethods = [ | ||
'setAttribute', | ||
'getAttribute', | ||
'getAttributeNode', | ||
'removeAttribute', | ||
'getElementsByTagName', | ||
'getElementById' | ||
] | ||
namespaceMethods.forEach(function (name) { | ||
var fn = Element.prototype[name] | ||
Element.prototype[name + 'NS'] = function () { | ||
return fn.apply(this, Array.prototype.slice.call(arguments, 1)) | ||
} | ||
}) | ||
module.exports = Element |
@@ -134,1 +134,10 @@ var test = require('tape') | ||
}) | ||
test('NS methods behave the same', function (t) { | ||
var el = mk() | ||
.attr('xlink:href', 'localhost') | ||
.node() | ||
t.plan(1) | ||
t.equal(el.getAttributeNS('xlink', 'href'), 'localhost') | ||
}) |
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
17702
417