Skip to content

Commit aeca150

Browse files
committed
% unifiy
1 parent 1d50c58 commit aeca150

File tree

2 files changed

+22
-33
lines changed

2 files changed

+22
-33
lines changed

src/main/javacc/CSS3Parser.jj

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,39 +1652,28 @@ Selector negation_arg() :
16521652
Object o;
16531653
}
16541654
{
1655-
(
1656-
simpleSel = elementName()
1657-
|
1658-
c = hash(null, false)
1659-
|
1660-
c = _class(null, false)
1661-
|
1662-
c = attrib(null, false)
1663-
|
1664-
(
1655+
(
1656+
simpleSel = elementName() { return simpleSel; }
1657+
|
1658+
(
1659+
{ simpleSel = new ElementSelector(null, createLocator(token)); }
1660+
c = hash(null, false)
1661+
| c = _class(null, false)
1662+
| c = attrib(null, false)
1663+
| (
16651664
o = pseudo(null, false)
16661665
{ if (o instanceof Condition)
16671666
{ c = (Condition) o;
16681667
} else {
1669-
pseudoElementSel = (SimpleSelector) o;
1670-
negationArg = new DescendantSelector(null, pseudoElementSel);
1668+
return new DescendantSelector(null, (SimpleSelector) o);
16711669
}
16721670
}
16731671
)
1674-
)
1675-
1676-
{
1677-
if (negationArg != null) {
1678-
return negationArg;
1679-
}
1680-
1681-
if (simpleSel != null) {
1682-
return simpleSel;
1683-
}
1684-
1685-
simpleSel = new ConditionalSelector(simpleSel, c);
1686-
return simpleSel;
1687-
}
1672+
)
1673+
)
1674+
{
1675+
return new ConditionalSelector(simpleSel, c);
1676+
}
16881677
}
16891678

16901679
//

src/test/java/com/gargoylesoftware/css/parser/CSS3ParserTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2421,7 +2421,7 @@ public void not() throws Exception {
24212421

24222422
// hash
24232423
selectors = createSelectors("input:not(#test)");
2424-
Assert.assertEquals("input:not(#test)", selectors.item(0).toString());
2424+
Assert.assertEquals("input:not(*#test)", selectors.item(0).toString());
24252425

24262426
// class
24272427
selectors = createSelectors("input:not(.home)");
@@ -2515,7 +2515,7 @@ public void not_universal() throws Exception {
25152515
@Test
25162516
public void not_hash() throws Exception {
25172517
final SelectorList selectors = createSelectors("p:not( #test)");
2518-
Assert.assertEquals("p:not(#test)", selectors.item(0).toString());
2518+
Assert.assertEquals("p:not(*#test)", selectors.item(0).toString());
25192519

25202520
Assert.assertEquals(1, selectors.getLength());
25212521
final Selector selector = selectors.item(0);
@@ -2528,7 +2528,7 @@ public void not_hash() throws Exception {
25282528
Assert.assertEquals(ConditionType.PSEUDO_CLASS_CONDITION, condition.getConditionType());
25292529

25302530
final PseudoClassCondition pseudo = (PseudoClassCondition) condition;
2531-
Assert.assertEquals("not(#test)", pseudo.getValue());
2531+
Assert.assertEquals("not(*#test)", pseudo.getValue());
25322532
}
25332533

25342534
/**
@@ -2632,13 +2632,13 @@ public void twoPseudo() throws Exception {
26322632
Assert.assertEquals("input:foo(test):before", selectors.item(0).toString());
26332633

26342634
selectors = createSelectors("input:not(#test):not(#rest)");
2635-
Assert.assertEquals("input:not(#test):not(#rest)", selectors.item(0).toString());
2635+
Assert.assertEquals("input:not(*#test):not(*#rest)", selectors.item(0).toString());
26362636

26372637
selectors = createSelectors("input:not(#test):nth-child(even)");
2638-
Assert.assertEquals("input:not(#test):nth-child(even)", selectors.item(0).toString());
2638+
Assert.assertEquals("input:not(*#test):nth-child(even)", selectors.item(0).toString());
26392639

26402640
selectors = createSelectors("input:not(#test):before");
2641-
Assert.assertEquals("input:not(#test):before", selectors.item(0).toString());
2641+
Assert.assertEquals("input:not(*#test):before", selectors.item(0).toString());
26422642
}
26432643

26442644
/**
@@ -2662,7 +2662,7 @@ public void pseudoElementsErrors() throws Exception {
26622662

26632663
// pseudo element not at end
26642664
checkErrorSelector("input:before:not(#test)",
2665-
"Duplicate pseudo class \":not(#test)\" or pseudo class \":not(#test)\" not at end.");
2665+
"Duplicate pseudo class \":not(*#test)\" or pseudo class \":not(*#test)\" not at end.");
26662666
checkErrorSelector("input:before[type='file']",
26672667
"Error in attribute selector. (Invalid token \"type\". Was expecting: <S>.)");
26682668
checkErrorSelector("input:before.styleClass", "Error in class selector. (Invalid token \"\". "

0 commit comments

Comments
 (0)