mirror of
https://github.com/symfony/symfony-docs.git
synced 2026-03-24 00:32:14 +01:00
[Frontend] Correct escape type for HTML attribute example
This commit is contained in:
@@ -38,13 +38,13 @@ Fetch this in JavaScript:
|
||||
const user = JSON.parse(userRating.dataset.user);
|
||||
|
||||
There is no size limit for the value of the ``data-*`` attributes, so you can
|
||||
store any content. In Twig, use the ``html_attr`` escaping strategy to avoid messing
|
||||
store any content. In Twig, use the ``html`` escaping strategy to avoid messing
|
||||
with HTML attributes. For example, if your ``User`` object has some ``getProfileData()``
|
||||
method that returns an array, you could do the following:
|
||||
|
||||
.. code-block:: html+twig
|
||||
|
||||
<div data-user-profile="{{ app.user ? app.user.profileData|json_encode|e('html_attr') }}">
|
||||
<div data-user-profile="{{ app.user ? app.user.profileData|json_encode|e('html') }}">
|
||||
<!-- ... -->
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user