Java Code Examples for com.gargoylesoftware.htmlunit.html.HtmlScript#executeScriptIfNeeded()

The following examples show how to use com.gargoylesoftware.htmlunit.html.HtmlScript#executeScriptIfNeeded() . 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: HTMLScriptElement.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the {@code text} property.
 * @param text the {@code text} property
 */
@JsxSetter
public void setText(final String text) {
    final HtmlElement htmlElement = getDomNodeOrDie();
    htmlElement.removeAllChildren();
    final DomNode textChild = new DomText(htmlElement.getPage(), text);
    htmlElement.appendChild(textChild);

    final HtmlScript tmpScript = (HtmlScript) htmlElement;
    tmpScript.executeScriptIfNeeded();
}
 
Example 2
Source File: HTMLScriptElement.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
/**
 * Overwritten for special IE handling.
 *
 * @param childObject the node to add to this node
 * @return the newly added child node
 */
@Override
public Object appendChild(final Object childObject) {
    final HtmlScript tmpScript = (HtmlScript) getDomNodeOrDie();
    final boolean wasEmpty = tmpScript.getFirstChild() == null;
    final Object result = super.appendChild(childObject);

    if (wasEmpty) {
        tmpScript.executeScriptIfNeeded();
    }
    return result;
}
 
Example 3
Source File: HTMLScriptElement.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the {@code text} property.
 * @param text the {@code text} property
 */
@JsxSetter
public void setText(final String text) {
    final HtmlElement htmlElement = getDomNodeOrDie();
    htmlElement.removeAllChildren();
    final DomNode textChild = new DomText(htmlElement.getPage(), text);
    htmlElement.appendChild(textChild);

    final HtmlScript tmpScript = (HtmlScript) htmlElement;
    tmpScript.executeScriptIfNeeded();
}
 
Example 4
Source File: HTMLScriptElement.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Overwritten for special IE handling.
 *
 * @param childObject the node to add to this node
 * @return the newly added child node
 */
@Override
public Object appendChild(final Object childObject) {
    final HtmlScript tmpScript = (HtmlScript) getDomNodeOrDie();
    final boolean wasEmpty = tmpScript.getFirstChild() == null;
    final Object result = super.appendChild(childObject);

    if (wasEmpty) {
        tmpScript.executeScriptIfNeeded();
    }
    return result;
}