function XssTest::testFilterNormalizedHtml5

Same name in other branches
  1. 10 core/tests/Drupal/Tests/Component/Utility/XssTest.php \Drupal\Tests\Component\Utility\XssTest::testFilterNormalizedHtml5()

Checks that escaped HTML embedded in an attribute is not filtered.

See also

\Drupal\Component\Utility\HtmlSerializerRules

File

core/tests/Drupal/Tests/Component/Utility/XssTest.php, line 616

Class

XssTest
XSS Filtering tests.

Namespace

Drupal\Tests\Component\Utility

Code

public function testFilterNormalizedHtml5() : void {
    $input = '<span data-caption="foo &lt;em&gt;bar&lt;/em&gt;"></span>';
    $this->assertEquals($input, Xss::filter(Html::normalize($input), [
        'span',
    ]));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.