Skip to content

Commit

Permalink
Change ReactID.ATTR_NAME to "data-reactid"
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jeffmo authored and zpao committed Jun 26, 2013
1 parent 9ceaff7 commit 67cf44e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/core/ReactID.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

var invariant = require('invariant');
var ReactMount = require('ReactMount');
var ATTR_NAME = 'id';
var ATTR_NAME = 'data-reactid';
var nodeCache = {};

/**
Expand Down Expand Up @@ -97,7 +97,6 @@ function getNode(id) {
}

return nodeCache[id] =
document.getElementById(id) || // TODO Quit using getElementById.
ReactMount.findReactRenderedDOMNodeSlow(id);
}

Expand Down
7 changes: 3 additions & 4 deletions src/core/ReactMount.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ function getReactRootID(container) {
*
* ReactMount.renderComponent(component, $('container'));
*
* TODO Update this comment when ReactID.ATTR_NAME changes.
* <div id="container"> <-- Supplied `container`.
* <div id=".reactRoot[3]"> <-- Rendered reactRoot of React component.
* // ...
* <div id="container"> <-- Supplied `container`.
* <div data-reactid=".reactRoot[3]"> <-- Rendered reactRoot of React
* // ... component.
* </div>
* </div>
*
Expand Down

0 comments on commit 67cf44e

Please sign in to comment.