@samitouri / QOS-React-2 / commits / 67cf44e7c1
Fork 0

The library for web and native user interfaces.

Change ReactID.ATTR_NAME to "data-reactid"

This final change is what we've all been waiting for. Note that it no longer makes sense to use `document.getElementById` in `getNode`, because that only ever worked with "id" attributes.

CommitSyncScript committed Jun 26, 2013 at 14:29 UTC 67cf44e7c18e068e3f39462b7ac7149eee58d3e5
2 files changed +4 -6
src/core/ReactID.js
+1 -2
@@ -21,7 +21,7 @@
21
22 var invariant = require('invariant');
23 var ReactMount = require('ReactMount');
24 -var ATTR_NAME = 'id';
24 +var ATTR_NAME = 'data-reactid';
25 var nodeCache = {};
26
27 /**
@@ -97,7 +97,6 @@ function getNode(id) {
97 }
98
99 return nodeCache[id] =
100 - document.getElementById(id) || // TODO Quit using getElementById.
100 ReactMount.findReactRenderedDOMNodeSlow(id);
101 }
102
src/core/ReactMount.js
+3 -4
@@ -55,10 +55,9 @@ function getReactRootID(container) {
55 *
56 * ReactMount.renderComponent(component, $('container'));
57 *
58 - * TODO Update this comment when ReactID.ATTR_NAME changes.
59 - * <div id="container"> <-- Supplied `container`.
60 - * <div id=".reactRoot[3]"> <-- Rendered reactRoot of React component.
61 - * // ...
58 + * <div id="container"> <-- Supplied `container`.
59 + * <div data-reactid=".reactRoot[3]"> <-- Rendered reactRoot of React
60 + * // ... component.
61 * </div>
62 * </div>
63 *