mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 00:08:39 +09:00
Preserve newlines in textarea placeholders
This commit is contained in:
parent
21daa1d5cb
commit
7ae2bd83b7
1 changed files with 5 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue