Skip to content

Find method not able to specify starting find from 1 level below #189

@HongyiFu

Description

@HongyiFu

Expected behavior and actual behavior:

In jQuery, you can do $el.find("> div") to match only div elements 1 level below current. Following from this, if we write $el.find("> div > p"), we can match <p> elements that are grandchildren of the current element.

This doesn't seem possible with jOOX, as this stacktrace is produced.

Exception in thread "main" org.joox.selector.ScannerException: Bad input!
    at org.joox.selector.Scanner.scan (Scanner.java:1889)
    at org.joox.selector CSS2XPath.css2xpath (CSS2XPath.java:51)
    at org.joox.Impl.find (Impl.java:488)
    at org.joox.Impl.find (Impl.java:81)

Are there any alternatives to do this other than chaining children method $el.children('div').children('p')?

Steps to reproduce the problem:

As above $el.find("> div > p")

Versions:

  • jOOX: 2.0.0
  • Java: 17

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions