function XssTest::providerTestAttributes
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/Utility/XssTest.php \Drupal\Tests\Component\Utility\XssTest::providerTestAttributes()
- 8.9.x core/tests/Drupal/Tests/Component/Utility/XssTest.php \Drupal\Tests\Component\Utility\XssTest::providerTestAttributes()
- 10 core/tests/Drupal/Tests/Component/Utility/XssTest.php \Drupal\Tests\Component\Utility\XssTest::providerTestAttributes()
Data provider for testFilterXssAdminNotNormalized().
File
-
core/
tests/ Drupal/ Tests/ Component/ Utility/ XssTest.php, line 496
Class
- XssTest
- XSS Filtering tests.
Namespace
Drupal\Tests\Component\UtilityCode
public static function providerTestAttributes() {
return [
[
'<img src="http://example.com/foo.jpg" title="Example: title" alt="Example: alt" class="md:block">',
'<img src="http://example.com/foo.jpg" title="Example: title" alt="Example: alt" class="md:block">',
'Image tag with alt and title attribute',
[
'img',
],
],
[
'<a href="https://www.drupal.org/" rel="dc:publisher">Drupal</a>',
'<a href="https://www.drupal.org/" rel="dc:publisher">Drupal</a>',
'Link tag with rel attribute',
[
'a',
],
],
[
'<span property="dc:subject">Drupal 8: The best release ever.</span>',
'<span property="dc:subject">Drupal 8: The best release ever.</span>',
'Span tag with property attribute',
[
'span',
],
],
[
'<img src="http://example.com/foo.jpg" data-caption="Drupal 8: The best release ever.">',
'<img src="http://example.com/foo.jpg" data-caption="Drupal 8: The best release ever.">',
'Image tag with data attribute',
[
'img',
],
],
[
'<a data-a2a-url="foo"></a>',
'<a data-a2a-url="foo"></a>',
'Link tag with numeric data attribute',
[
'a',
],
],
[
'<img src= onmouseover="script(\'alert\');">',
'<img>',
'Image tag with malformed SRC',
[
'img',
],
],
[
'Body"></iframe><img/src="x"/onerror="alert(document.domain)"/><"',
'Body"><img /><"',
'Image tag with malformed SRC',
[
'img',
],
],
[
'<img/src="x"/onerror="alert(document.domain)"/>',
'<img />',
'Image tag with malformed SRC',
[
'img',
],
],
[
'<del datetime="1789-08-22T12:30:00.1-04:00">deleted text</del>',
'<del datetime="1789-08-22T12:30:00.1-04:00">deleted text</del>',
'Del with datetime attribute',
[
'del',
],
],
[
'<ins datetime="1986-01-28 11:38:00.010">inserted text</ins>',
'<ins datetime="1986-01-28 11:38:00.010">inserted text</ins>',
'Ins with datetime attribute',
[
'ins',
],
],
[
'<time datetime="1978-11-19T05:00:00Z">#DBD</time>',
'<time datetime="1978-11-19T05:00:00Z">#DBD</time>',
'Time with datetime attribute',
[
'time',
],
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.