Rename TYPE_SYMBOL to REACT_ELEMENT_TYPE

See D2454031 for context.
This commit is contained in:
Greg Perkins
2015-09-28 14:11:40 -07:00
parent c512603a8c
commit c9320142ec
2 changed files with 5 additions and 5 deletions
@@ -17,7 +17,7 @@ var assign = require('Object.assign');
// The Symbol used to tag the ReactElement type. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
var TYPE_SYMBOL =
var REACT_ELEMENT_TYPE =
(typeof Symbol === 'function' && Symbol.for && Symbol.for('react.element')) ||
0xeac7;
@@ -59,7 +59,7 @@ if (__DEV__) {
var ReactElement = function(type, key, ref, self, source, owner, props) {
var element = {
// This tag allow us to uniquely identify this as a React Element
$$typeof: TYPE_SYMBOL,
$$typeof: REACT_ELEMENT_TYPE,
// Built-in properties that belong on the element
type: type,
@@ -289,7 +289,7 @@ ReactElement.isValidElement = function(object) {
return (
typeof object === 'object' &&
object !== null &&
object.$$typeof === TYPE_SYMBOL
object.$$typeof === REACT_ELEMENT_TYPE
);
};
@@ -327,14 +327,14 @@ describe('ReactElement', function() {
// Rudimentary polyfill
// Once all jest engines support Symbols natively we can swap this to test
// WITH native Symbols by default.
var TYPE_SYMBOL = function() {}; // fake Symbol
var REACT_ELEMENT_TYPE = function() {}; // fake Symbol
var OTHER_SYMBOL = function() {}; // another fake Symbol
global.Symbol = function(name) {
return OTHER_SYMBOL;
};
global.Symbol.for = function(key) {
if (key === 'react.element') {
return TYPE_SYMBOL;
return REACT_ELEMENT_TYPE;
}
return OTHER_SYMBOL;
};