Don't break if no attribute value

Fixes the transformation of things like `<button disabled>`.
This commit is contained in:
Ben Alpert
2014-02-18 18:10:46 -08:00
parent 792d8aca86
commit e0dbca1168
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "jsx_whitespace_transformer",
"description": "A utility to update your JSX to behave identically in React 0.8 and React 0.9.",
"version": "1.0.0",
"version": "1.0.1",
"main": "run.js",
"dependencies": {
"esprima-fb": "~2001.1001.0-dev-harmony-fb",
+3 -1
View File
@@ -20,7 +20,9 @@ var utils = require('jstransform/src/utils');
function visitReactTag(traverse, object, path, state) {
object.attributes.forEach(function(attr, index) {
traverse(attr.value, path, state);
if (attr.value) {
traverse(attr.value, path, state);
}
});
object.children.forEach(function(child, index) {