mojolicious / mojo

:sparkles: Mojolicious - Perl real-time web framework
https://mojolicious.org
Artistic License 2.0
2.67k stars 580 forks source link

Add new method to `$dom`, `$dom->each_text` and test it #2068

Closed tcheukueppo closed 1 year ago

tcheukueppo commented 1 year ago

Hello,

Summary

  1. New $dom method $dom->each_text: which returns text content of every descendant node in a list.
  2. Tests on $dom->each_text.

Motivation

I'd like to have this feature to be table to perform context sensitive parsing on the text content of a given tag(with all it descendant in the most frequent cases) without interference with contents of other tags(which is something that $dom->all_text does not provide), I'm totally aware of $dom->text but that do require me to walk through the $dom data structure and use css selectors which is quite tedious.

tcheukueppo commented 1 year ago

Previous PR automatically got removed after reseting to your latest commit.