Skip to content

Commit 2ef09f4

Browse files
authored
Update v0.38.0 changelog item for breaking changes (#634)
While upgrading deps from 0.37.1, we've noticed some breakages in test due to need to parse the HTML string first. Update the changelog to explicitly reflect this.
1 parent f107531 commit 2ef09f4

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

CHANGELOG.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,28 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
5454
* `attribute/2` - removed clause
5555
* `filter_out/2` - removed clause
5656

57+
- HTML must be parsed before searching. Functions like `Floki.find/2`,
58+
`Floki.attribute/2`, and other HTML manipulation functions **no longer work
59+
directly with HTML strings**. The HTML must be parsed first using
60+
`Floki.parse_fragment/2` or `Floki.parse_document/2`.
61+
62+
Before:
63+
64+
```elixir
65+
html = "<div class='foobar'><p>Hello</p></div>"
66+
Floki.find(html, "p")
67+
Floki.attribute(html, "div", "class")
68+
```
69+
70+
After:
71+
72+
```elixir
73+
html = "<div class='foobar'><p>Hello</p></div>"
74+
parsed_html = Floki.parse_fragment!(html)
75+
Floki.find(parsed_html, "p")
76+
Floki.attribute(parsed_html, "div", "class")
77+
```
78+
5779
## [0.37.1] - 2025-03-22
5880

5981
### Fixed
@@ -213,7 +235,7 @@ usage of memory for `find/2`, for example.
213235

214236
### Fixed
215237

216-
- Fix find of elements by classes that contain colons. This is useful for when
238+
- Fix find of elements by classes that contain colons. This is useful for when
217239
people are trying to find elements that contain Tailwind classes.
218240
Thanks [@viniciusmuller](https://github.com/viniciusmuller).
219241

@@ -251,7 +273,7 @@ usage of memory for `find/2`, for example.
251273
### Fixed
252274

253275
- Allow attribute values to not be escaped. This fixes `Floki.raw_html/2` when used with the
254-
option `encode: false`. Thanks [@juanazam](https://github.com/juanazam).
276+
option `encode: false`. Thanks [@juanazam](https://github.com/juanazam).
255277
- Fix `traverse_and_update/3` spec. Thanks [@WLSF](https://github.com/WLSF).
256278

257279
### Changed

0 commit comments

Comments
 (0)