Current section

86 Versions

Jump to

Compare versions

7 files changed
+46 additions
-31 deletions
  @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7 7
8 8 ## [Unreleased][unreleased]
9 9
10 + ## [0.34.1] - 2023-02-11
11 +
12 + ### Fixed
13 +
14 + - Fix pseudo-class ":not" selector parsing halting point.
15 + This is a fix for when a "pseudo-class" ":not" that contains an attribute selector is
16 + followed by another selector. This is an example: "a:not([class]), div".
17 +
18 + - Ignore decimal numeric char ref when number is negative.
19 +
10 20 ## [0.34.0] - 2022-11-03
11 21
12 22 ### Added
  @@ -633,7 +643,8 @@ of the parent element inside HTML.
633 643
634 644 - Elixir version requirement from "~> 1.0.0" to ">= 1.0.0".
635 645
636 - [unreleased]: https://github.com/philss/floki/compare/v0.34.0...HEAD
646 + [unreleased]: https://github.com/philss/floki/compare/v0.34.1...HEAD
647 + [0.34.1]: https://github.com/philss/floki/compare/v0.34.0...v0.34.1
637 648 [0.34.0]: https://github.com/philss/floki/compare/v0.33.1...v0.34.0
638 649 [0.33.1]: https://github.com/philss/floki/compare/v0.33.0...v0.33.1
639 650 [0.33.0]: https://github.com/philss/floki/compare/v0.32.1...v0.33.0
  @@ -18,11 +18,11 @@
18 18 <<"lib/floki/selector/functional.ex">>,
19 19 <<"lib/floki/selector/tokenizer.ex">>,
20 20 <<"lib/floki/selector/attribute_selector.ex">>,
21 - <<"lib/floki/selector/combinator.ex">>,<<"lib/floki/selector/parser.ex">>,
22 - <<"lib/floki/selector/pseudo_class.ex">>,<<"lib/floki/traversal.ex">>,
23 - <<"lib/floki/selector.ex">>,<<"lib/floki/entities.ex">>,
24 - <<"lib/floki/entities">>,<<"lib/floki/entities/codepoints.ex">>,
25 - <<"lib/floki/raw_html.ex">>,<<"lib/floki.ex">>,
21 + <<"lib/floki/selector/combinator.ex">>,
22 + <<"lib/floki/selector/pseudo_class.ex">>,<<"lib/floki/selector/parser.ex">>,
23 + <<"lib/floki/traversal.ex">>,<<"lib/floki/entities">>,
24 + <<"lib/floki/entities/codepoints.ex">>,<<"lib/floki/raw_html.ex">>,
25 + <<"lib/floki/selector.ex">>,<<"lib/floki/entities.ex">>,<<"lib/floki.ex">>,
26 26 <<"src/floki_selector_lexer.xrl">>,<<"src/floki_mochi_html.erl">>,
27 27 <<"src/floki.gleam">>,<<"mix.exs">>,<<"README.md">>,<<"LICENSE">>,
28 28 <<"CODE_OF_CONDUCT.md">>,<<"CONTRIBUTING.md">>,<<"CHANGELOG.md">>]}.
  @@ -33,4 +33,4 @@
33 33 {<<"Sponsor">>,<<"https://github.com/sponsors/philss">>}]}.
34 34 {<<"name">>,<<"floki">>}.
35 35 {<<"requirements">>,[]}.
36 - {<<"version">>,<<"0.34.0">>}.
36 + {<<"version">>,<<"0.34.1">>}.
  @@ -502,7 +502,7 @@ defmodule Floki do
502 502
503 503 """
504 504
505 - @spec text(html_tree | binary) :: binary
505 + @spec text(html_tree | html_node | binary) :: binary
506 506
507 507 def text(html, opts \\ [deep: true, js: false, style: true, sep: ""]) do
508 508 cleaned_html_tree =
  @@ -12,8 +12,13 @@ defmodule Floki.Entities do
12 12 <<"&#", numeric::binary>> ->
13 13 case extract_byte_from_num_charref(numeric) do
14 14 {:ok, number} ->
15 - {:ok, {_, unicode_number}} = Floki.HTML.NumericCharref.to_unicode_number(number)
16 - {:ok, <<unicode_number::utf8>>}
15 + case Floki.HTML.NumericCharref.to_unicode_number(number) do
16 + {:ok, {_, unicode_number}} ->
17 + {:ok, <<unicode_number::utf8>>}
18 +
19 + {:error, {:negative_number, _}} ->
20 + {:error, :not_found}
21 + end
17 22
18 23 :error ->
19 24 {:error, :not_found}
  @@ -104,5 +104,8 @@ defmodule Floki.HTML.NumericCharref do
104 104 {:ok, {:list_of_errors, number}}
105 105 end
106 106
107 - def to_unicode_number(number), do: {:ok, {:unicode, number}}
107 + def to_unicode_number(number) when is_integer(number) and number >= 0,
108 + do: {:ok, {:unicode, number}}
109 +
110 + def to_unicode_number(number), do: {:error, {:negative_number, number}}
108 111 end
Loading more files…