Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions lib/html_sanitize_ex/scrubber/html5.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 11 additions & 0 deletions test/html5_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,17 @@ defmodule HtmlSanitizeExScrubberHTML5Test do
assert input == full_html_sanitize(input)
end

test "does not strip details" do
input = """
<details name="foo" class="bar" open="open">
<summary>Details</summary>
Something small enough to escape casual notice.
</details>
"""

assert input == full_html_sanitize(input)
end

test "make sure a very long URI is truncated before capturing URI scheme" do
input =
"<img src='#{File.read!(Path.join(__DIR__, "html5_test_data_uri"))}'>"
Expand Down