-
Notifications
You must be signed in to change notification settings - Fork 11
SSR: Add wp-html
and wp-text
attribute directive processors
#170
Conversation
wp-text
attribute directive processor
@luisherranz Looking at #118 (comment), I'm wondering how (if?) One thing that comes to mind is escaping. Should |
You can't escape the HTML of <?php
wp_store( array(
'state' => array(
'myPlugin' => array(
'html' => get_some_raw_html_from_somewhere(),
),
),
) );
?>
<div data-wp-html="state.myPlugin.html">Default content</div> I am not an expert on the matter, but By the way, should we be more explicit about the risks of EDIT: I've added that question to the list of decisions that need to be made of the Tracking Issue. |
Ah, makes sense! 😅 So I guess I'll add escaping to
Maybe 🤔 Close enough to React, I guess. |
9f0c237
to
bbc790f
Compare
5457d8b
to
054c579
Compare
5da7778
to
ecf23f4
Compare
wp-text
attribute directive processorwp-html
and wp-text
attribute directive processors
Opening this for review, now that #169 is in 😊 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me! ✅
Just adding one missing require_once
, and it's ready to go. 😄
Oh, nevermind, I didn't notice it was already addressed.
Thank you @DAreRodz! I'll rebase to change the prefix to |
Based on #169.
Per my understanding (and the discussion below), their only difference is that
wp-html
can contain HTML that is used unescaped, whereaswp-text
escapes its value before rendering it.