HTML API: Ensure set_modifiable_text includes TEXTAREA leading newlines.#11062
HTML API: Ensure set_modifiable_text includes TEXTAREA leading newlines.#11062sirreal wants to merge 25 commits intoWordPress:trunkfrom
Conversation
@todo split into data provider
…et-mod-html-leading-newlines-textarea
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
…et-mod-html-leading-newlines-textarea
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Detect cases where
::set_modifiable_text()would omit a leading newline from its input and adjust accordingly. This is done by adding an additional leading newline (that is ignored by HTML parsers) in case a leading newline is detected in the input.This follows the HTML parsing rules for TEXTAREA elements that ignores a single
U+000A LINE FEEDcharacter immediately following the open tag. It also respects the guidelines on newline normalization, so aU+000D CARRIAGE RETURNalso triggers the extra newline.This PR only handles TEXTAREA, where the
::set_modifiable_text()behavior is simpler. See #10879 (review).This is a partial fix for the ticket and is extracted from #10879.
Trac ticket: https://core.trac.wordpress.org/ticket/64609