Java Code Examples for com.gargoylesoftware.htmlunit.html.DomElement#getScriptableObject()

The following examples show how to use com.gargoylesoftware.htmlunit.html.DomElement#getScriptableObject() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Element.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the next element sibling.
 * @return the next element sibling
 */
@JsxGetter
public Element getNextElementSibling() {
    final DomElement child = getDomNodeOrDie().getNextElementSibling();
    if (child != null) {
        return (Element) child.getScriptableObject();
    }
    return null;
}
 
Example 2
Source File: Element.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the previous element sibling.
 * @return the previous element sibling
 */
@JsxGetter
public Element getPreviousElementSibling() {
    final DomElement child = getDomNodeOrDie().getPreviousElementSibling();
    if (child != null) {
        return (Element) child.getScriptableObject();
    }
    return null;
}
 
Example 3
Source File: Attr.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the owner element.
 * @return the owner element
 */
@JsxGetter
public Object getOwnerElement() {
    final DomElement parent = getDomNodeOrDie().getOwnerElement();
    if (parent != null) {
        return parent.getScriptableObject();
    }
    return null;
}
 
Example 4
Source File: CharacterData.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the next element sibling.
 * @return the next element sibling
 */
@JsxGetter({CHROME, FF, FF68, FF60})
public Element getNextElementSibling() {
    final DomElement child = getDomNodeOrDie().getNextElementSibling();
    if (child != null) {
        return (Element) child.getScriptableObject();
    }
    return null;
}
 
Example 5
Source File: CharacterData.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the previous element sibling.
 * @return the previous element sibling
 */
@JsxGetter({CHROME, FF, FF68, FF60})
public Element getPreviousElementSibling() {
    final DomElement child = getDomNodeOrDie().getPreviousElementSibling();
    if (child != null) {
        return (Element) child.getScriptableObject();
    }
    return null;
}
 
Example 6
Source File: HtmlUnitNekoDOMBuilder.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
private static void copyAttributes(final DomElement to, final XMLAttributes attrs) {
    final int length = attrs.getLength();
    for (int i = 0; i < length; i++) {
        final String attrName = attrs.getLocalName(i).toLowerCase(Locale.ROOT);
        if (to.getAttributes().getNamedItem(attrName) == null) {
            to.setAttribute(attrName, attrs.getValue(i));
            if (attrName.startsWith("on") && to.getPage().getWebClient().isJavaScriptEngineEnabled()
                    && to.getScriptableObject() instanceof HTMLBodyElement) {
                final HTMLBodyElement jsBody = to.getScriptableObject();
                jsBody.createEventHandlerFromAttribute(attrName, attrs.getValue(i));
            }
        }
    }
}
 
Example 7
Source File: Element.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the next element sibling.
 * @return the next element sibling
 */
@JsxGetter
public Element getNextElementSibling() {
    final DomElement child = getDomNodeOrDie().getNextElementSibling();
    if (child != null) {
        return (Element) child.getScriptableObject();
    }
    return null;
}
 
Example 8
Source File: Element.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the previous element sibling.
 * @return the previous element sibling
 */
@JsxGetter
public Element getPreviousElementSibling() {
    final DomElement child = getDomNodeOrDie().getPreviousElementSibling();
    if (child != null) {
        return (Element) child.getScriptableObject();
    }
    return null;
}
 
Example 9
Source File: Attr.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the owner element.
 * @return the owner element
 */
@JsxGetter
public Object getOwnerElement() {
    final DomElement parent = getDomNodeOrDie().getOwnerElement();
    if (parent != null) {
        return parent.getScriptableObject();
    }
    return null;
}
 
Example 10
Source File: CharacterData.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the next element sibling.
 * @return the next element sibling
 */
@JsxGetter({CHROME, FF})
public Element getNextElementSibling() {
    final DomElement child = getDomNodeOrDie().getNextElementSibling();
    if (child != null) {
        return (Element) child.getScriptableObject();
    }
    return null;
}
 
Example 11
Source File: CharacterData.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the previous element sibling.
 * @return the previous element sibling
 */
@JsxGetter({CHROME, FF})
public Element getPreviousElementSibling() {
    final DomElement child = getDomNodeOrDie().getPreviousElementSibling();
    if (child != null) {
        return (Element) child.getScriptableObject();
    }
    return null;
}
 
Example 12
Source File: Node.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the first element child.
 * @return the first element child
 */
protected Element getFirstElementChild() {
    final DomElement child = ((DomElement) getDomNodeOrDie()).getFirstElementChild();
    if (child != null) {
        return (Element) child.getScriptableObject();
    }
    return null;
}
 
Example 13
Source File: Node.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the last element child.
 * @return the last element child
 */
protected Element getLastElementChild() {
    final DomElement child = ((DomElement) getDomNodeOrDie()).getLastElementChild();
    if (child != null) {
        return (Element) child.getScriptableObject();
    }
    return null;
}