Search in sources :

Example 11 with ICSSSelectorItem

use of org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorItem in project webtools.sourceediting by eclipse.

the class CSSSelectorTest method testSelector10.

public void testSelector10() {
    ICSSSelectorList list = createSelectorList("#myid");
    checkSelectorList(list, "#myid", 1, 0);
    ICSSSelector selector;
    ICSSSelectorItem item;
    selector = list.getSelector(0);
    checkSelector(selector, "#myid", 1, 10000, 0);
    item = selector.getItem(0);
    checkSimpleSelector(item, "", true, 0, 0, 1, 0);
    checkSimpleSelectorIDs(item, new String[] { "myid" });
}
Also used : ICSSSelectorList(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorList) ICSSSelector(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector) ICSSSelectorItem(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorItem)

Example 12 with ICSSSelectorItem

use of org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorItem in project webtools.sourceediting by eclipse.

the class CSSSelectorTest method testSelector36.

public void testSelector36() {
    ICSSSelectorList list = createSelectorList("H3.1x3#4t2");
    checkSelectorList(list, "H3.1x3#4t2", 1, 1);
    ICSSSelector selector;
    ICSSSelectorItem item;
    selector = list.getSelector(0);
    checkSelector(selector, "H3.1x3#4t2", 1, 10101, 1);
    item = selector.getItem(0);
    checkSimpleSelector(item, "H3", false, 0, 1, 1, 0);
    checkSimpleSelectorClasses(item, new String[] { "1x3" });
    checkSimpleSelectorIDs(item, new String[] { "4t2" });
}
Also used : ICSSSelectorList(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorList) ICSSSelector(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector) ICSSSelectorItem(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorItem)

Example 13 with ICSSSelectorItem

use of org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorItem in project webtools.sourceediting by eclipse.

the class CSSSelectorTest method testSelector16.

public void testSelector16() {
    ICSSSelectorList list = createSelectorList("DIV OL>LI P");
    checkSelectorList(list, "DIV OL > LI P", 1, 0);
    ICSSSelector selector;
    ICSSSelectorItem item;
    selector = list.getSelector(0);
    checkSelector(selector, "DIV OL > LI P", 7, 4, 0);
    item = selector.getItem(0);
    checkSimpleSelector(item, "DIV", false, 0, 0, 0, 0);
    item = selector.getItem(1);
    checkSelectorCombinator(item, " ", ICSSSelectorCombinator.DESCENDANT);
    item = selector.getItem(2);
    checkSimpleSelector(item, "OL", false, 0, 0, 0, 0);
    item = selector.getItem(3);
    checkSelectorCombinator(item, ">", ICSSSelectorCombinator.CHILD);
    item = selector.getItem(4);
    checkSimpleSelector(item, "LI", false, 0, 0, 0, 0);
    item = selector.getItem(5);
    checkSelectorCombinator(item, " ", ICSSSelectorCombinator.DESCENDANT);
    item = selector.getItem(6);
    checkSimpleSelector(item, "P", false, 0, 0, 0, 0);
}
Also used : ICSSSelectorList(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorList) ICSSSelector(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector) ICSSSelectorItem(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorItem)

Example 14 with ICSSSelectorItem

use of org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorItem in project webtools.sourceediting by eclipse.

the class CSSSelectorTest method testSelector12.

public void testSelector12() {
    ICSSSelectorList list = createSelectorList("H1 EM");
    checkSelectorList(list, "H1 EM", 1, 0);
    ICSSSelector selector;
    ICSSSelectorItem item;
    selector = list.getSelector(0);
    checkSelector(selector, "H1 EM", 3, 2, 0);
    item = selector.getItem(0);
    checkSimpleSelector(item, "H1", false, 0, 0, 0, 0);
    item = selector.getItem(1);
    checkSelectorCombinator(item, " ", ICSSSelectorCombinator.DESCENDANT);
    item = selector.getItem(2);
    checkSimpleSelector(item, "EM", false, 0, 0, 0, 0);
}
Also used : ICSSSelectorList(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorList) ICSSSelector(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector) ICSSSelectorItem(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorItem)

Example 15 with ICSSSelectorItem

use of org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorItem in project webtools.sourceediting by eclipse.

the class CSSSelectorTest method testSelector40.

// Bug 221504: whitespace preceding a selector separator was causing selectors
// to be merged
public void testSelector40() {
    ICSSSelectorList list = createSelectorList("h1.fix , h2.fix, h3.fix , div#container");
    checkSelectorList(list, "h1.fix, h2.fix, h3.fix, div#container", 4, 0);
    ICSSSelector selector;
    ICSSSelectorItem item;
    selector = list.getSelector(0);
    checkSelector(selector, "h1.fix", 1, 101, 0);
    item = selector.getItem(0);
    checkSimpleSelector(item, "h1", false, 0, 1, 0, 0);
    checkSimpleSelectorClasses(item, new String[] { "fix" });
    selector = list.getSelector(1);
    checkSelector(selector, "h2.fix", 1, 101, 0);
    item = selector.getItem(0);
    checkSimpleSelector(item, "h2", false, 0, 1, 0, 0);
    checkSimpleSelectorClasses(item, new String[] { "fix" });
    selector = list.getSelector(2);
    checkSelector(selector, "h3.fix", 1, 101, 0);
    item = selector.getItem(0);
    checkSimpleSelector(item, "h3", false, 0, 1, 0, 0);
    checkSimpleSelectorClasses(item, new String[] { "fix" });
    selector = list.getSelector(3);
    checkSelector(selector, "div#container", 1, 10001, 0);
    item = selector.getItem(0);
    checkSimpleSelector(item, "div", false, 0, 0, 1, 0);
    checkSimpleSelectorIDs(item, new String[] { "container" });
}
Also used : ICSSSelectorList(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorList) ICSSSelector(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector) ICSSSelectorItem(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorItem)

Aggregations

ICSSSelectorItem (org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorItem)47 ICSSSelector (org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector)42 ICSSSelectorList (org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorList)41 ICSSSimpleSelector (org.eclipse.wst.css.core.internal.provisional.document.ICSSSimpleSelector)6 Iterator (java.util.Iterator)4 ICSSSelectorCombinator (org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorCombinator)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Element (org.w3c.dom.Element)1