From 5339fa3708aa72cd9231be3ced7a6a8be62b2d6f Mon Sep 17 00:00:00 2001 From: Yuri Pereira Constante Date: Sat, 30 Dec 2023 13:19:25 -0300 Subject: [PATCH] Use MapSet for self_closing_tags --- lib/floki/raw_html.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/floki/raw_html.ex b/lib/floki/raw_html.ex index beaba76a..56b74636 100644 --- a/lib/floki/raw_html.ex +++ b/lib/floki/raw_html.ex @@ -47,7 +47,7 @@ defmodule Floki.RawHTML do _ -> :noop end - self_closing_tags = self_closing_tags() + self_closing_tags = MapSet.new(self_closing_tags()) IO.iodata_to_binary(build_raw_html(html_tree, [], encoder, padding, self_closing_tags)) end @@ -143,7 +143,7 @@ defmodule Floki.RawHTML do ] defp close_open_tag(type, [], self_closing_tags) do - if type in self_closing_tags do + if MapSet.member?(self_closing_tags, type) do "/>" else ">" @@ -153,7 +153,7 @@ defmodule Floki.RawHTML do defp close_open_tag(_type, _children, _self_closing_tags), do: ">" defp close_end_tag(type, [], padding, self_closing_tags) do - if type in self_closing_tags do + if MapSet.member?(self_closing_tags, type) do [] else [leftpad(padding), "", line_ending(padding)]