Skip to content

Conversation

@jtojnar
Copy link
Contributor

@jtojnar jtojnar commented Mar 16, 2024

It would fail for e.g. <div> <p>foo</p> </div>.

mozilla/readability uses children for the tag lookup, which return only elements. PHP does not have children property so b580cf2 mistakenly used childNodes instead, but that can return any node type.

Let’s filter the children ourselves.

Also add comments from mozilla/readability’s _hasSingleTagInsideElement.

Picked from #87

It would fail for e.g. `<div> <p>foo</p> </div>`.

mozilla/readability uses children for the tag lookup, which return only elements.
PHP does not have children property so b580cf2
mistakenly used `childNodes` instead, but that can return any node type.

Let’s filter the children ourselves.

Also add comments from mozilla/readability’s `_hasSingleTagInsideElement`.
@j0k3r j0k3r merged commit cb6b6ac into j0k3r:master Mar 19, 2024
@jtojnar jtojnar deleted the has-single-fix branch March 19, 2024 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants