summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@wolfbeast.com>2019-02-19 21:20:29 +0100
committerGitHub <noreply@github.com>2019-02-19 21:20:29 +0100
commitc7585afb94921239aefbaf88f35f19cb17a75db5 (patch)
tree66d006e771c6c3d53195f79d1cb6ff26b6035fcf
parent3029dee77bd01e867bc3c7e49bfd14c1484581bb (diff)
parentb1e78d1db168584a9fbef8f30cb76ca826323b4f (diff)
downloadUXP-c7585afb94921239aefbaf88f35f19cb17a75db5.tar
UXP-c7585afb94921239aefbaf88f35f19cb17a75db5.tar.gz
UXP-c7585afb94921239aefbaf88f35f19cb17a75db5.tar.lz
UXP-c7585afb94921239aefbaf88f35f19cb17a75db5.tar.xz
UXP-c7585afb94921239aefbaf88f35f19cb17a75db5.zip
Merge pull request #979 from JustOff/PR_textarea_placeholders
Preserve newlines in textarea placeholders
-rw-r--r--dom/html/nsTextEditorState.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/dom/html/nsTextEditorState.cpp b/dom/html/nsTextEditorState.cpp
index 0b4cb1920..25be6016c 100644
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -2255,7 +2255,11 @@ nsTextEditorState::UpdatePlaceholderText(bool aNotify)
nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
content->GetAttr(kNameSpaceID_None, nsGkAtoms::placeholder, placeholderValue);
- nsContentUtils::RemoveNewlines(placeholderValue);
+ if (mTextCtrlElement->IsTextArea()) { // <textarea>s preserve newlines...
+ nsContentUtils::PlatformToDOMLineBreaks(placeholderValue);
+ } else { // ...<input>s don't
+ nsContentUtils::RemoveNewlines(placeholderValue);
+ }
NS_ASSERTION(mPlaceholderDiv->GetFirstChild(), "placeholder div has no child");
mPlaceholderDiv->GetFirstChild()->SetText(placeholderValue, aNotify);
}