@samitouri / QOS-React-2 / commits / e0dbca1168

Don't break if no attribute value

Fixes the transformation of things like `<button disabled>`.

Ben Alpert committed Feb 18, 2014 at 18:09 UTC e0dbca116887ff93e2093be54fb8cb72aad9de74
2 files changed +4 -2
npm-jsx_whitespace_transformer/package.json
+1 -1
@@ -1,7 +1,7 @@
1 {
2 "name": "jsx_whitespace_transformer",
3 "description": "A utility to update your JSX to behave identically in React 0.8 and React 0.9.",
4 - "version": "1.0.0",
4 + "version": "1.0.1",
5 "main": "run.js",
6 "dependencies": {
7 "esprima-fb": "~2001.1001.0-dev-harmony-fb",
npm-jsx_whitespace_transformer/transforms/react.js
+3 -1
@@ -20,7 +20,9 @@ var utils = require('jstransform/src/utils');
20
21 function visitReactTag(traverse, object, path, state) {
22 object.attributes.forEach(function(attr, index) {
23 - traverse(attr.value, path, state);
23 + if (attr.value) {
24 + traverse(attr.value, path, state);
25 + }
26 });
27
28 object.children.forEach(function(child, index) {