From bdcbcce6c902af674e49eceb74f5fdb112df3504 Mon Sep 17 00:00:00 2001 From: Manolo Carrasco Date: Wed, 13 Jul 2011 15:11:22 +0000 Subject: [PATCH] fix xpath when tag is omitted --- .../google/gwt/query/client/impl/SelectorEngineCssToXPath.java | 2 +- .../com/google/gwt/query/rebind/SelectorGeneratorsTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineCssToXPath.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineCssToXPath.java index cca6f751..4ed673f6 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineCssToXPath.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineCssToXPath.java @@ -153,7 +153,7 @@ public class SelectorEngineCssToXPath extends SelectorEngineImpl { ":(first)", "[1]", ":(last)", "[last()]", // put '*' when tag is omitted - "(^|\\|)(\\[)", "$1*$2", + "(^|\\|[\\./]*)(\\[)", "$1*$2", // Replace escaped dots and spaces "%S%"," ", "%P%",".", diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/rebind/SelectorGeneratorsTest.java b/gwtquery-core/src/test/java/com/google/gwt/query/rebind/SelectorGeneratorsTest.java index d336cd76..a66f328b 100644 --- a/gwtquery-core/src/test/java/com/google/gwt/query/rebind/SelectorGeneratorsTest.java +++ b/gwtquery-core/src/test/java/com/google/gwt/query/rebind/SelectorGeneratorsTest.java @@ -89,7 +89,7 @@ public class SelectorGeneratorsTest extends GWTTestCase { assertEquals(".//a[@href and (@lang) and (@class)]", sel.css2Xpath("a[href][lang][class]")); - assertEquals(".//*[@checked='checked']|*[not(@disabled)]|*[@disabled]", + assertEquals(".//*[@checked='checked']|.//*[not(@disabled)]|.//*[@disabled]", sel.css2Xpath(":checked, :enabled, :disabled")); assertEquals(".//table[contains(string(.),'String With | @ ~= Space Points.s and Hash#es')]", -- 2.39.5