Skip to content

Commit

Permalink
Remove placeholder/textarea check, use contentToUse instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Dail committed Oct 19, 2016
1 parent cb79db5 commit 331aa88
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/renderers/dom/shared/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,20 +461,6 @@ function isCustomComponent(tagName, props) {
return tagName.indexOf('-') >= 0 || props.is != null;
}

function shouldSetNodeTextContent(lazyTree, props, text) {
// TODO: Validate that text is allowed as a child of this node
var node = lazyTree.node;
// Avoid setting textContent on textareas when the text is empty
// and there is a placeholder. In IE11 setting textContent will cause
// the placeholder to not show within the textarea until it has been
// focused and blurred again.
// https://github.com/facebook/react/issues/6731#issuecomment-254874553
if (node.type === 'textarea' && props.placeholder && text === '') {
return false;
}
return true;
}

var globalIdCounter = 1;

/**
Expand Down Expand Up @@ -861,8 +847,13 @@ ReactDOMComponent.Mixin = {
var contentToUse =
CONTENT_TYPES[typeof props.children] ? props.children : null;
var childrenToUse = contentToUse != null ? null : props.children;
// TODO: Validate that text is allowed as a child of this node
if (contentToUse != null) {
if (shouldSetNodeTextContent(lazyTree, props, contentToUse)) {
// // Avoid setting textContent when the text is empty. In IE11 setting
// textContent on a text area will cause the placeholder to not
// show within the textarea until it has been focused and blurred again.
// https://github.com/facebook/react/issues/6731#issuecomment-254874553
if (contentToUse !== '') {
if (__DEV__) {
setAndValidateContentChildDev.call(this, contentToUse);
}
Expand Down

0 comments on commit 331aa88

Please sign in to comment.