Added new properties to easily check the node type#186
Merged
rushter merged 7 commits intorushter:masterfrom Nov 19, 2025
Merged
Added new properties to easily check the node type#186rushter merged 7 commits intorushter:masterfrom
rushter merged 7 commits intorushter:masterfrom
Conversation
…across the codebase** (rushter#187)
rushter
reviewed
Nov 18, 2025
rushter
reviewed
Nov 18, 2025
…_node` with `_is_node_type` helper methods for consistency
Contributor
Author
|
@rushter I changed it for the private method, please recheck the PR, 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.
Note
Added multiple new properties to
LexborNodefor better node type checks (is_element_node,is_text_node,is_comment_node,is_document_node).This pull request introduces a series of enhancements and additions to the
selectolaxlibrary, focusing on expanding the public API for bothLexborNodeandLexborHTMLParser, improving type hinting, and refining the development workflow. The changes include new properties and methods for node type checking, traversal, manipulation, and attribute access, as well as improvements to the linting process.API Enhancements for Node and Parser Classes:
LexborNodeinselectolax/lexbor.pyifor better node inspection, traversal, and manipulation, including node type checks (is_element_node,is_text_node, etc.), new traversal methods (traverse,iter), and manipulation methods (unwrap,unwrap_tags,merge_text_nodes,replace_with,insert_before,insert_after,insert_child,decompose,remove,strip_tags). Also added new attribute accessors (attributes,attrs,id,raw_value,text_content) and selector utilities (css,css_first,any_css_matches,css_matches,select). [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28]LexborHTMLParserinselectolax/lexbor.pyi, such asbody,head,tags,text,html,css, and multiple overloads forcss_first, improving the ability to query and interact with the parsed document. [1] [2] [3] [4] [5] [6]Type Hinting and Internal API Improvements:
_is_node_typeinLexborNodeinselectolax/lexbor.pxdto support node type checking logic.Developer Workflow Improvements:
Makefileto improve linting: now runsruff formatandruff check --fixto automatically format and fix style issues inselectolaxandtests, in addition to runningmypy.Type Stubs and Documentation:
selectolax/lexbor.pyi) for bothLexborNodeandLexborSelector, ensuring that type hints and docstrings are up-to-date and comprehensive for all new and existing methods. [1] [2]These changes significantly enhance the usability and introspection capabilities of the library, making it easier for developers to work with HTML nodes and documents programmatically.