Commit 8687acf
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 38870cd commit 8687acf
1 file changed
+12
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1469 | 1469 | | |
1470 | 1470 | | |
1471 | 1471 | | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
1472 | 1477 | | |
1473 | 1478 | | |
1474 | | - | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
1475 | 1484 | | |
1476 | 1485 | | |
1477 | 1486 | | |
1478 | | - | |
| 1487 | + | |
| 1488 | + | |
1479 | 1489 | | |
1480 | 1490 | | |
1481 | 1491 | | |
| |||
0 commit comments