Skip to content

Commit efb5222

Browse files
committed
Interactivity API: Consolidate the data-wp-html documentation.
1 parent 6391b99 commit efb5222

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

‎src/wp-includes/interactivity-api/class-wp-interactivity-api.php‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,8 +1541,6 @@ private static function get_dangerous_html( $value ): ?string {
15411541
/**
15421542
* Processes the default `data-wp-html` entry using an inert comment.
15431543
*
1544-
* Declines incompatible directives, targets that cannot hold content, and
1545-
* unregistered values with a notice. Null values and ignored entries are silent.
15461544
* Notices identify the host tag as plain text for error-message sanitization.
15471545
*
15481546
* When the value is a registered token, this method does not insert its HTML

‎src/wp-includes/interactivity-api/interactivity-api.php‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ function wp_interactivity_get_element(): ?array {
188188
* inserted HTML are not processed, and the inserted HTML is not checked for
189189
* balanced tags. Inside a `template` with `data-wp-each`, the directive renders
190190
* once per item, with that item in context, and the rendered items keep their
191-
* usual `data-wp-each-child` markings. The directive does not accept an HTML
192-
* string directly.
191+
* usual `data-wp-each-child` markings.
193192
*
194193
* When the directive declines to render, the element keeps its content as a
195194
* fallback and is processed as it would be without `data-wp-html`. Only a
@@ -216,12 +215,12 @@ function wp_interactivity_get_element(): ?array {
216215
* The client boundary:
217216
*
218217
* The directive does not write tokens or HTML to the data the Interactivity API
219-
* prints, or to context attributes, and `data-wp-html` stays on the element.
220-
* Strings held in state are still printed, so HTML kept in state, as in the
221-
* example below, is visible to the client. A token placed in state serializes
222-
* as an empty object: it carries neither its registered HTML nor its trust.
223-
* Evaluating a derived state getter can record the path of that getter in the
224-
* printed data, even if the directive then declines to render.
218+
* prints, or to context attributes. Strings held in state are still printed,
219+
* so HTML kept in state, as in the example below, is visible to the client. A
220+
* token placed in state serializes as an empty object: it carries neither its
221+
* registered HTML nor its trust. Evaluating a derived state getter can record
222+
* the path of that getter in the printed data, even if the directive then
223+
* declines to render.
225224
*
226225
* The server never gives the client trust: the client has to create its own
227226
* token, with `asDangerousHTML()` from `@wordpress/interactivity`, in a client

0 commit comments

Comments
 (0)