Skip to content

Weird return type of XPath.match and XPath.first #353

Description

@tompng

XPath.match always returns an array, even if the evaluated value is not a nodeset.

REXML::XPath.match(REXML::Document.new, '1 + 2') #=> [3]
Nokogiri::XML.parse('<root/>').xpath('1+2') #=> 3

XPath.first returns non-nodeset value. first of non-nodeset value doesn't make sense.
ref: #342 (comment)

REXML::XPath.first(REXML::Document.new, '1 + 2') #=> 3

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions