Cleanup console.* uses

* Stop doing `global.console && ...`
* Make sure all uses are behind `__DEV__` checks so they get stripped out
This commit is contained in:
Paul O'Shannessy
2013-07-12 15:42:25 -07:00
committed by Paul O’Shannessy
parent eee3980749
commit ac84652e50
3 changed files with 14 additions and 10 deletions
+1 -1
View File
@@ -902,7 +902,7 @@ var ReactCompositeComponent = {
*/
autoBind: function(method) {
if (__DEV__) {
console.warn && console.warn(
console.warn(
'React.autoBind() is now deprecated. All React component methods ' +
'are auto bound by default, so React.autoBind() is a no-op. It ' +
'will be removed in the next version of React'
+7 -5
View File
@@ -320,11 +320,13 @@ var ReactInstanceHandles = {
}
}
global.console && console.error && console.error(
'Error while invoking `findComponentRoot` with the following ' +
'ancestor node:',
ancestorNode
);
if (__DEV__) {
console.error(
'Error while invoking `findComponentRoot` with the following ' +
'ancestor node:',
ancestorNode
);
}
invariant(
false,
'findComponentRoot(..., %s): Unable to find element. This probably ' +
+6 -4
View File
@@ -53,10 +53,12 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
// TODO (yungsters): Remove support for children content in <textarea>.
var children = this.props.children;
if (children != null) {
console.warn(
'Use the `defaultValue` or `value` props instead of setting children ' +
'on <textarea>.'
);
if (__DEV__) {
console.warn(
'Use the `defaultValue` or `value` props instead of setting ' +
'children on <textarea>.'
);
}
invariant(
defaultValue == null,
'If you supply `defaultValue` on a <textarea>, do not pass children.'