Commit 677f3f0
committed
Fix hasSingleTagInsideElement method
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`.1 parent 2912276 commit 677f3f0
1 file changed
+11
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1477 | 1477 | | |
1478 | 1478 | | |
1479 | 1479 | | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
1480 | 1485 | | |
1481 | 1486 | | |
1482 | | - | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
1483 | 1492 | | |
1484 | 1493 | | |
1485 | 1494 | | |
1486 | 1495 | | |
1487 | | - | |
| 1496 | + | |
1488 | 1497 | | |
1489 | 1498 | | |
1490 | 1499 | | |
| |||
0 commit comments