Skip to content

Commit e9aecfb

Browse files
committed
Merge branch '7.4' into 8.0
* 7.4: Add missing config formats Example of allowed element with attributes disallowed
2 parents 13d6543 + 605e9d2 commit e9aecfb

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

html_sanitizer.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,8 @@ attributes from the `W3C Standard Proposal`_ are allowed.
314314
img: 'src'
315315
# allow the <h1> element with all safe attributes
316316
h1: '*'
317+
# allow the <div> element with no attributes
318+
div: []
317319
318320
.. code-block:: xml
319321
@@ -343,9 +345,12 @@ attributes from the `W3C Standard Proposal`_ are allowed.
343345
</framework:allow-element>
344346
345347
<!-- allow the <h1> element with all safe attributes -->
346-
<framework:allow-element name="img">
348+
<framework:allow-element name="h1">
347349
<framework:attribute>*</framework:attribute>
348350
</framework:allow-element>
351+
352+
<!-- allow the <div> element with no attributes -->
353+
<framework:allow-element name="div"/>
349354
</framework:sanitizer>
350355
</framework:html-sanitizer>
351356
</framework:config>
@@ -367,6 +372,9 @@ attributes from the `W3C Standard Proposal`_ are allowed.
367372
368373
// allow the <h1> element with all safe attributes
369374
->allowElement('h1', '*')
375+
376+
// allow the <div> element with no attributes
377+
->allowElement('div', [])
370378
;
371379
};
372380
@@ -385,6 +393,9 @@ attributes from the `W3C Standard Proposal`_ are allowed.
385393
386394
// allow the <h1> element with all safe attributes
387395
->allowElement('h1')
396+
397+
// allow the <div> element with no attributes
398+
->allowElement('div', [])
388399
);
389400
390401
Block and Drop Elements

0 commit comments

Comments
 (0)