Skip to content

Commit 7e9d14e

Browse files
author
spicychickensauce
committed
Remove equals?
1 parent 8669e1d commit 7e9d14e

File tree

4 files changed

+1
-31
lines changed

4 files changed

+1
-31
lines changed

c_src/lazy_html.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -852,12 +852,6 @@ std::uint64_t num_nodes(ErlNifEnv *env, ExLazyHTML ex_lazy_html) {
852852

853853
FINE_NIF(num_nodes, 0);
854854

855-
bool equals(ErlNifEnv *env, ExLazyHTML html_a, ExLazyHTML html_b) {
856-
return (html_a.resource->document_ref == html_b.resource->document_ref &&
857-
html_a.resource->nodes == html_b.resource->nodes);
858-
}
859-
FINE_NIF(equals, 0);
860-
861855
std::vector<fine::Term> tag(ErlNifEnv *env, ExLazyHTML ex_lazy_html) {
862856
auto values = std::vector<fine::Term>();
863857

lib/lazy_html.ex

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -528,29 +528,6 @@ defmodule LazyHTML do
528528
LazyHTML.NIF.tag(lazy_html)
529529
end
530530

531-
@doc """
532-
Returns true if the lazy_html is selecting the same nodes starting from the same document.
533-
534-
## Examples
535-
536-
iex> lazy_html = LazyHTML.from_fragment(~S|<div><span id="a">Hello</span></div>|)
537-
iex> a = LazyHTML.query(lazy_html, "#a")
538-
iex> b = LazyHTML.query(lazy_html, "div > span")
539-
iex> LazyHTML.equals?(a, b)
540-
true
541-
542-
Note that if the lazy_htmls are created separately, they are never equal:
543-
544-
iex> html_a = LazyHTML.from_fragment(~S|<div>hello</div>|)
545-
iex> html_b = LazyHTML.from_fragment(~S|<div>hello</div>|)
546-
iex> LazyHTML.equals?(html_a, html_b)
547-
false
548-
"""
549-
@spec equals?(t(), t()) :: boolean()
550-
def equals?(html_a, html_b) do
551-
LazyHTML.NIF.equals(html_a, html_b)
552-
end
553-
554531
@doc ~S"""
555532
Escapes the given string to make a valid HTML text.
556533

lib/lazy_html/nif.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ defmodule LazyHTML.NIF do
2929
def tag(_lazy_html), do: err!()
3030
def nodes(_lazy_html), do: err!()
3131
def num_nodes(_lazy_html), do: err!()
32-
def equals(_lazy_html_a, _lazy_html_b), do: err!()
3332

3433
defp err!(), do: :erlang.nif_error(:not_loaded)
3534
end

test/lazy_html_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ defmodule LazyHTMLTest do
333333
assert path == "div:nth-child(1) > div:nth-child(2) > span:nth-child(1)"
334334

335335
span2 = LazyHTML.query(lazy_html, path)
336-
assert LazyHTML.equals?(span, span2)
336+
assert LazyHTML.text(span) == LazyHTML.text(span2)
337337
end
338338
end
339339

0 commit comments

Comments
 (0)