Introducing the ability to skip empty text nodes in LexborNode!#187
Merged
rushter merged 13 commits intorushter:masterfrom Nov 20, 2025
Merged
Introducing the ability to skip empty text nodes in LexborNode!#187rushter merged 13 commits intorushter:masterfrom
LexborNode!#187rushter merged 13 commits intorushter:masterfrom
Conversation
… in `node` implementation
…eter; update docstrings accordingly. Add `is_empty_text_node` property.
…or in `text`, `iter`, and `traverse` methods
…se` methods; adjust logic and docstrings accordingly
…logic and adding text content assertions
… inspection; remove unused `Iterator` import
…natures in type stubs for consistency; add minor formatting adjustments
…e redundant blank lines.
…er; update related methods and tests for consistency.
… add minor formatting adjustments in `node.pxi`
Owner
|
Thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request enhances the
LexborNodeAPI in selectolax by introducing the ability to skip empty text nodes intraversal,iter,text, and by adding a property to check for empty text nodes. These changes improve control over HTML parsing, especially when handling whitespace or empty nodes. The update also includes expanded documentation and tests to ensure the new behaviors are correct.API Enhancements for Skipping Empty Text Nodes:
skip_emptyparameter to thetext,iter, andtraversemethods inLexborNode, allowing users to exclude empty text nodes (as determined bylxb_dom_node_is_empty) from results. [1] [2] [3] [4] [5] [6] [7] [8] [9]lxb_dom_node_is_emptyfunction for use in Python code.New Property for Node Emptiness:
is_empty_text_nodeproperty onLexborNode, providing a convenient way to check if a node is a text node and considered empty by the underlying DOM implementation. [1] [2]Documentation and Usability Improvements:
text,iter, andtraversemethods to clearly describe new parameters and behaviors, improving developer understanding and usability. [1] [2] [3] [4] [5] [6]__iter__and__next__methods for better iterator protocol support.Testing:
skip_emptyflag intext,iter, andtraversemethods, and to check theis_empty_text_nodeproperty.