Skip to content

Commit 0364132

Browse files
committed
add harder test to fix other bug
1 parent 355364f commit 0364132

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

lib/floki/raw_html.ex

+9-9
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,8 @@ defmodule Floki.RawHTML do
133133
self_closing_tags,
134134
line_ending
135135
) do
136-
curr_encoder =
137-
case type do
138-
"script" -> @no_encoder
139-
"style" -> @no_encoder
140-
"title" -> @no_encoder
141-
_ -> encoder
142-
end
143-
144136
open_tag_content = [
145-
tag_with_attrs(type, attrs, children, pad, curr_encoder, self_closing_tags),
137+
tag_with_attrs(type, attrs, children, pad, encoder, self_closing_tags),
146138
line_ending
147139
]
148140

@@ -156,6 +148,14 @@ defmodule Floki.RawHTML do
156148
_ ->
157149
children = List.wrap(children)
158150

151+
curr_encoder =
152+
case type do
153+
"script" -> @no_encoder
154+
"style" -> @no_encoder
155+
"title" -> @no_encoder
156+
_ -> encoder
157+
end
158+
159159
build_raw_html(
160160
children,
161161
acc,

test/floki_test.exs

+2-2
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ defmodule FlokiTest do
450450
</head>
451451
<body>
452452
<div>
453-
<style>
453+
<style data-attrs-test="{&quot;event&quot;:&quot;buggy software&quot;,&quot;properties&quot;:{&quot;_builderButtonEvent&quot;:true}}">
454454
</style>
455455
<a data-attrs-event="{&quot;event&quot;:&quot;buggy software&quot;,&quot;properties&quot;:{&quot;_builderButtonEvent&quot;:true}}">
456456
Next
@@ -464,7 +464,7 @@ defmodule FlokiTest do
464464
document!(
465465
html_body(~S"""
466466
<div>
467-
<style>
467+
<style data-attrs-test="{&quot;event&quot;:&quot;buggy software&quot;,&quot;properties&quot;:{&quot;_builderButtonEvent&quot;:true}}">
468468
</style>
469469
<a data-attrs-event="{&quot;event&quot;:&quot;buggy software&quot;,&quot;properties&quot;:{&quot;_builderButtonEvent&quot;:true}}">
470470
Next

0 commit comments

Comments
 (0)