diff --git a/lib/html_sanitize_ex/scrubber/html5.ex b/lib/html_sanitize_ex/scrubber/html5.ex index fb1e3a0..eb45fa6 100644 --- a/lib/html_sanitize_ex/scrubber/html5.ex +++ b/lib/html_sanitize_ex/scrubber/html5.ex @@ -278,6 +278,35 @@ defmodule HtmlSanitizeEx.Scrubber.HTML5 do "translate" ]) + Meta.allow_tag_with_these_attributes("details", [ + "accesskey", + "autocapitalize", + "autofocus", + "class", + "contenteditable", + "dir", + "draggable", + "hidden", + "id", + "inert", + "inputmode", + "is", + "itemid", + "itemprop", + "itemref", + "itemscope", + "itemtype", + "lang", + "name", + "open", + "slot", + "spellcheck", + "style", + "tabindex", + "title", + "translate" + ]) + Meta.allow_tag_with_these_attributes("div", [ "accesskey", "class", diff --git a/test/html5_test.exs b/test/html5_test.exs index 9bd9662..c3f69c3 100644 --- a/test/html5_test.exs +++ b/test/html5_test.exs @@ -125,6 +125,17 @@ defmodule HtmlSanitizeExScrubberHTML5Test do assert input == full_html_sanitize(input) end + test "does not strip details" do + input = """ +
+ Details + Something small enough to escape casual notice. +
+ """ + + assert input == full_html_sanitize(input) + end + test "make sure a very long URI is truncated before capturing URI scheme" do input = ""