You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Go back to excluding fields in element_text. Remove full LazyHTML.text (#273)
What changed?
=============
Commits 37bc521 (released in 0.8.3) and d19c6cf (released in 0.9.0)
tried to improve what was `HTML.inner_text` to be more coherent in text
parsing (i.e. what is `Html.element_text` vs `Html.text`). But in doing
so, we introduced regressions from the behavior we had in 0.8.2.
This commit goes back to behavior that more closely matches 0.8.2 by
making `Html.element_text` (what `inner_text` is now called) to always
include text inside nested tags (with the exception of `select` and
`textarea` if they aren't the top-level tag in the query). And we no
longer use `LazyHTML.text` at all -- since that doesnt' seem to exclude
newlines the same way we were doing so in our internal parsing.
Copy file name to clipboardExpand all lines: lib/phoenix_test/html.ex
+2-7Lines changed: 2 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -13,10 +13,6 @@ defmodule PhoenixTest.Html do
13
13
LazyHTML.from_fragment(html)
14
14
end
15
15
16
-
deftext(%LazyHTML{}=element)do
17
-
LazyHTML.text(element)
18
-
end
19
-
20
16
defelement_text(%LazyHTML{}=element)do
21
17
element
22
18
|>LazyHTML.to_tree(skip_whitespace_nodes: true)
@@ -25,8 +21,7 @@ defmodule PhoenixTest.Html do
25
21
|>normalize_whitespace()
26
22
end
27
23
28
-
# combination of tags listed in "Text Content" and "Inline Text Semantics" in https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements
29
-
@text_tags~w[a abbr b bdo blockquote br cite code dfn dd div dl dt em i figcaption figure hr kbd li mark menu ol p pre q rp rt s samp small span strong sub sup time u ul var wbr]
0 commit comments