Skip to content

Nokolexbor does not support node identity equality comparisons like Nokogiri does #27

@Judahmeek

Description

@Judahmeek

Describe the bug
Nokolexbor does not support leaf_elements.group_by(&:parent) like Nokogiri does.

The functionality difference seems like a purposeful performance tradeoff, so the actual bug may be in the lack of documentation, given that Nokolexbor is described as a drop-in replacement for Nokogiri.

I created a minimal Rspec example to demonstrate the breaking change.

For my use case, I found leaf_elements.group_by { |root| root.parent.to_s.hash + root.parent.element_children.size } to be an acceptable substitute.

Environment

  • OS: MacOS 26
  • Ruby version: 3.4.4
  • Nokolexbor version: 0.7.0

Additional context
I discovered this discrepancy while working on my technical screen application for SerpApi!
Hopefully, this issue helps me beat my competition. 😂

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions