Search in sources :

Example 6 with SimpleRange

use of com.gargoylesoftware.htmlunit.html.impl.SimpleRange in project htmlunit by HtmlUnit.

the class Selection method selectAllChildren.

/**
 * Adds all the children of the specified node to the selection. The previous selection is lost.
 * @param parentNode all children of parentNode will be selected; parentNode itself is not part of the selection
 */
@JsxFunction
public void selectAllChildren(final Node parentNode) {
    final List<Range> ranges = getRanges();
    ranges.clear();
    final SimpleRange rg = new SimpleRange(parentNode.getDomNodeOrDie());
    ranges.add(rg);
    if (rg.getCollapsed()) {
        type_ = TYPE_CARET;
    } else {
        type_ = TYPE_RANGE;
    }
}
Also used : SimpleRange(com.gargoylesoftware.htmlunit.html.impl.SimpleRange) Range(org.w3c.dom.ranges.Range) SimpleRange(com.gargoylesoftware.htmlunit.html.impl.SimpleRange) JsxFunction(com.gargoylesoftware.htmlunit.javascript.configuration.JsxFunction)

Aggregations

SimpleRange (com.gargoylesoftware.htmlunit.html.impl.SimpleRange)6 JsxFunction (com.gargoylesoftware.htmlunit.javascript.configuration.JsxFunction)3 DomNode (com.gargoylesoftware.htmlunit.html.DomNode)2 HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)2 Range (org.w3c.dom.ranges.Range)2 AlertHandler (com.gargoylesoftware.htmlunit.AlertHandler)1 BrowserVersion (com.gargoylesoftware.htmlunit.BrowserVersion)1 CollectingAlertHandler (com.gargoylesoftware.htmlunit.CollectingAlertHandler)1 MockWebConnection (com.gargoylesoftware.htmlunit.MockWebConnection)1 SgmlPage (com.gargoylesoftware.htmlunit.SgmlPage)1 WebClient (com.gargoylesoftware.htmlunit.WebClient)1 HtmlInput (com.gargoylesoftware.htmlunit.html.HtmlInput)1 SelectableTextInput (com.gargoylesoftware.htmlunit.html.impl.SelectableTextInput)1 JsxSetter (com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter)1 HTMLDocument (com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDocument)1 HTMLElement (com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement)1 ArrayList (java.util.ArrayList)1 ScriptableObject (net.sourceforge.htmlunit.corejs.javascript.ScriptableObject)1