RFR: 8185831: Pseudo selectors do not appear to work in Node.lookupAll() [v9]
Andy Goryachev
angorya at openjdk.org
Thu Oct 26 18:42:50 UTC 2023
On Mon, 23 Oct 2023 23:11:53 GMT, Sai Pradeep Dandem <duke at openjdk.org> wrote:
>> **Issue:**
>> Using pseudo classes in programmatic query using Node.lookupAll() or Node.lookup() gives unexpected results.
>>
>> **Cause:**
>> There is no check for checking the psuedo states matching in the applies() method of SimpleSelector.java. So checking for "applies()" alone is not sufficient in lookup() method.
>>
>> **Fix:**
>> Included an extra check for the psuedo states to match.
>
> Sai Pradeep Dandem has updated the pull request incrementally with two additional commits since the last revision:
>
> - Minor change
> - Updated documentation in regards with pseudo states lookup
modules/javafx.graphics/src/main/java/javafx/scene/Node.java line 1984:
> 1982: * a pseudo state "myPseudo", then to find all nodes with "myPseudo" state, the lookupAll method can be used as follows:
> 1983: * <code>scene.lookupAll(".myStyle:myPseudo");</code> or <code>scene.lookupAll(":myPseudo");</code>
> 1984: * </p>
Added explanation is very good! I would add one more thing - that if no pseudo class is specified by the lookup selector, the result will contain nodes with pseudo classes (that is, pseudo classes are ignored).
Minor note: should we be using {@code ... } instead of < code > ?
modules/javafx.graphics/src/main/java/javafx/scene/Node.java line 2005:
> 2003: * @param selector The Selector.
> 2004: * @param results The results.
> 2005: * @return List of matching nodes. The returned value can be null.
minor: I don't think we should capitalize text in @ param and @ return
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1245#discussion_r1373630223
PR Review Comment: https://git.openjdk.org/jfx/pull/1245#discussion_r1373632086
More information about the openjfx-dev
mailing list