Skip to content

Support Node#pointer_id#24

Merged
zyc9012 merged 1 commit into
serpapi:masterfrom
takahashim:add-pointer_id
Jun 26, 2026
Merged

Support Node#pointer_id#24
zyc9012 merged 1 commit into
serpapi:masterfrom
takahashim:add-pointer_id

Conversation

@takahashim

Copy link
Copy Markdown
Contributor

This PR adds Nokolexbor::Node#pointer_id, which returns the underlying C node pointer as an Integer.

Example

require "nokolexbor"

doc = Nokolexbor::HTML("<div id='x'><p>hi</p></div>")

n1 = doc.at_css("#x")
n2 = doc.at_css("#x")

n1.pointer_id == n2.pointer_id   # => true
n1.pointer_id.class              # => Integer

Compatibility

This PR adds Node#pointer_id, matching Nokogiri::XML::Node#pointer_id.
Both return an Integer derived from the underlying C node pointer, so the same C node yields the same pointer_id.

@zyc9012 zyc9012 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @takahashim 👍 LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants