com.gargoylesoftware.htmlunit.ScriptResult Java Examples

The following examples show how to use com.gargoylesoftware.htmlunit.ScriptResult. 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: HtmlRadioButtonInput.java    From HtmlUnit-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the {@code checked} attribute.
 *
 * @param isChecked true if this element is to be selected
 * @return the page that occupies this window after setting checked status
 * It may be the same window or it may be a freshly loaded one.
 */
@Override
public Page setChecked(final boolean isChecked) {
    Page page = getPage();

    final boolean changed = isChecked() != isChecked;
    checkedState_ = isChecked;
    if (isChecked) {
        final HtmlForm form = getEnclosingForm();
        if (form != null) {
            form.setCheckedRadioButton(this);
        }
        else if (page != null && page.isHtmlPage()) {
            setCheckedForPage((HtmlPage) page);
        }
    }

    if (changed) {
        final ScriptResult scriptResult = fireEvent(Event.TYPE_CHANGE);
        if (scriptResult != null) {
            page = scriptResult.getNewPage();
        }
    }
    return page;
}
 
Example #2
Source File: HtmlForm.java    From htmlunit with Apache License 2.0 6 votes vote down vote up
/**
 * Resets this form to its initial values, returning the page contained by this form's window after the
 * reset. Note that the returned page may or may not be the same as the original page, based on JavaScript
 * event handlers, etc.
 *
 * @return the page contained by this form's window after the reset
 */
public Page reset() {
    final SgmlPage htmlPage = getPage();
    final ScriptResult scriptResult = fireEvent(Event.TYPE_RESET);
    if (ScriptResult.isFalse(scriptResult)) {
        return htmlPage.getWebClient().getCurrentWindow().getEnclosedPage();
    }

    for (final HtmlElement next : getHtmlElementDescendants()) {
        if (next instanceof SubmittableElement) {
            ((SubmittableElement) next).reset();
        }
    }

    return htmlPage;
}
 
Example #3
Source File: JSObject.java    From HtmlUnit-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Evaluates a JavaScript expression.
 * The expression is a string of JavaScript source code which will be evaluated in the context given by "this".
 *
 * @param expression the JavaScript expression
 * @return result Object
 * @throws JSException in case or error
 */
public Object eval(final String expression) throws JSException {
    if (LOG.isInfoEnabled()) {
        LOG.info("JSObject eval '" + expression + "'");
    }

    final Page page = Window_.getWebWindow().getEnclosedPage();
    if (page instanceof HtmlPage) {
        final HtmlPage htmlPage = (HtmlPage) page;
        final ScriptResult result = htmlPage.executeJavaScript(expression);
        final Object jsResult = result.getJavaScriptResult();
        if (jsResult instanceof ScriptableObject) {
            return new JSObject((ScriptableObject) jsResult);
        }
        if (jsResult instanceof ConsString) {
            return ((ConsString) jsResult).toString();
        }
        return jsResult;
    }
    return null;
}
 
Example #4
Source File: EventTarget.java    From HtmlUnit-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Executes the event on this object only (needed for instance for onload on (i)frame tags).
 * @param event the event
 * @return the result
 * @see #fireEvent(Event)
 */
public ScriptResult executeEventLocally(final Event event) {
    final EventListenersContainer eventListenersContainer = getEventListenersContainer();
    if (eventListenersContainer != null) {
        final Window window = getWindow();
        final Object[] args = new Object[] {event};

        // handlers declared as property on a node don't receive the event as argument for IE
        final Object[] propHandlerArgs = args;

        final Event previousEvent = window.getCurrentEvent();
        window.setCurrentEvent(event);
        try {
            return eventListenersContainer.executeListeners(event, args, propHandlerArgs);
        }
        finally {
            window.setCurrentEvent(previousEvent); // reset event
        }
    }
    return null;
}
 
Example #5
Source File: EventTarget.java    From HtmlUnit-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Dispatches an event into the event system (standards-conformant browsers only). See
 * <a href="https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent">the Gecko
 * DOM reference</a> for more information.
 *
 * @param event the event to be dispatched
 * @return {@code false} if at least one of the event handlers which handled the event
 *         called <tt>preventDefault</tt>; {@code true} otherwise
 */
@JsxFunction
public boolean dispatchEvent(final Event event) {
    event.setTarget(this);
    final DomElement element = (DomElement) getDomNodeOrNull();
    ScriptResult result = null;
    if (event.getType().equals(MouseEvent.TYPE_CLICK)) {
        try {
            element.click(event, true);
        }
        catch (final IOException e) {
            throw Context.reportRuntimeError("Error calling click(): " + e.getMessage());
        }
    }
    else {
        result = fireEvent(event);
    }
    return !event.isAborted(result);
}
 
Example #6
Source File: DomElement.java    From htmlunit with Apache License 2.0 6 votes vote down vote up
/**
 * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br>
 *
 * Fires the event on the element. Nothing is done if JavaScript is disabled.
 * @param event the event to fire
 * @return the execution result, or {@code null} if nothing is executed
 */
public ScriptResult fireEvent(final Event event) {
    final WebClient client = getPage().getWebClient();
    if (!client.isJavaScriptEnabled()) {
        return null;
    }

    if (!handles(event)) {
        return null;
    }

    if (LOG.isDebugEnabled()) {
        LOG.debug("Firing " + event);
    }

    final EventTarget jsElt = getScriptableObject();
    final HtmlUnitContextFactory cf = ((JavaScriptEngine) client.getJavaScriptEngine()).getContextFactory();
    final ScriptResult result = cf.callSecured(cx -> jsElt.fireEvent(event), getHtmlPageOrNull());
    if (event.isAborted(result)) {
        preventDefault();
    }
    return result;
}
 
Example #7
Source File: EventListenersContainer.java    From HtmlUnit-Android with Apache License 2.0 6 votes vote down vote up
private ScriptResult executeEventHandler(final Event event, final Object[] propHandlerArgs) {
    final DomNode node = jsNode_.getDomNodeOrNull();
    // some event don't apply on all kind of nodes, for instance "blur"
    if (node != null && !node.handles(event)) {
        return null;
    }
    final Function handler = getEventHandler(event.getType());
    if (handler != null) {
        event.setCurrentTarget(jsNode_);
        final HtmlPage page = (HtmlPage) (node != null
                ? node.getPage()
                : jsNode_.getWindow().getWebWindow().getEnclosedPage());
        if (LOG.isDebugEnabled()) {
            LOG.debug("Executing " + event.getType() + " handler for " + node);
        }
        return page.executeJavaScriptFunction(handler, jsNode_,
                propHandlerArgs, page);
    }
    return null;
}
 
Example #8
Source File: EventListenersContainer.java    From HtmlUnit-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Executes bubbling listeners.
 * @param event the event
 * @param args arguments
 * @param propHandlerArgs handler arguments
 * @return the result
 */
public ScriptResult executeBubblingListeners(final Event event, final Object[] args,
        final Object[] propHandlerArgs) {
    ScriptResult result = null;

    // the handler declared as property if any (not on body, as handler declared on body goes to the window)
    final DomNode domNode = jsNode_.getDomNodeOrNull();
    if (!(domNode instanceof HtmlBody)) {
        result = executeEventHandler(event, propHandlerArgs);
        if (event.isPropagationStopped()) {
            return result;
        }
    }

    // the registered listeners (if any)
    final ScriptResult newResult = executeEventListeners(false, event, args);
    if (newResult != null) {
        result = newResult;
    }
    return result;
}
 
Example #9
Source File: HtmlInput.java    From HtmlUnit-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Executes the onchange script code for this element if this is appropriate.
 * This means that the element must have an onchange script, script must be enabled
 * and the change in the element must not have been triggered by a script.
 *
 * @param htmlElement the element that contains the onchange attribute
 * @return the page that occupies this window after this method completes (may or
 *         may not be the same as the original page)
 */
static Page executeOnChangeHandlerIfAppropriate(final HtmlElement htmlElement) {
    final SgmlPage page = htmlElement.getPage();

    final AbstractJavaScriptEngine<?> engine = htmlElement.getPage().getWebClient().getJavaScriptEngine();
    if (engine.isScriptRunning()) {
        return page;
    }
    final ScriptResult scriptResult = htmlElement.fireEvent(Event.TYPE_CHANGE);

    if (page.getWebClient().containsWebWindow(page.getEnclosingWindow())) {
        // may be itself or a newly loaded one
        return page.getEnclosingWindow().getEnclosedPage();
    }

    if (scriptResult != null) {
        // current window doesn't exist anymore
        return scriptResult.getNewPage();
    }

    return page;
}
 
Example #10
Source File: HtmlRadioButtonInput.java    From htmlunit with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the {@code checked} attribute.
 *
 * @param isChecked true if this element is to be selected
 * @return the page that occupies this window after setting checked status
 * It may be the same window or it may be a freshly loaded one.
 */
@Override
public Page setChecked(final boolean isChecked) {
    Page page = getPage();

    final boolean changed = isChecked() != isChecked;
    checkedState_ = isChecked;
    if (isChecked) {
        final HtmlForm form = getEnclosingForm();
        if (form != null) {
            form.setCheckedRadioButton(this);
        }
        else if (page != null && page.isHtmlPage()) {
            setCheckedForPage((HtmlPage) page);
        }
    }

    if (changed) {
        final ScriptResult scriptResult = fireEvent(Event.TYPE_CHANGE);
        if (scriptResult != null) {
            page = page.getEnclosingWindow().getWebClient().getCurrentWindow().getEnclosedPage();
        }
    }
    return page;
}
 
Example #11
Source File: HtmlInput.java    From htmlunit with Apache License 2.0 6 votes vote down vote up
/**
 * Executes the onchange script code for this element if this is appropriate.
 * This means that the element must have an onchange script, script must be enabled
 * and the change in the element must not have been triggered by a script.
 *
 * @param htmlElement the element that contains the onchange attribute
 * @return the page that occupies this window after this method completes (may or
 *         may not be the same as the original page)
 */
static Page executeOnChangeHandlerIfAppropriate(final HtmlElement htmlElement) {
    final SgmlPage page = htmlElement.getPage();

    final AbstractJavaScriptEngine<?> engine = htmlElement.getPage().getWebClient().getJavaScriptEngine();
    if (engine.isScriptRunning()) {
        return page;
    }
    final ScriptResult scriptResult = htmlElement.fireEvent(Event.TYPE_CHANGE);

    if (page.getWebClient().containsWebWindow(page.getEnclosingWindow())) {
        // may be itself or a newly loaded one
        return page.getEnclosingWindow().getEnclosedPage();
    }

    if (scriptResult != null) {
        // current window doesn't exist anymore
        return page.getWebClient().getCurrentWindow().getEnclosedPage();
    }

    return page;
}
 
Example #12
Source File: HtmlPage.java    From HtmlUnit-Android with Apache License 2.0 6 votes vote down vote up
private boolean isOnbeforeunloadAccepted(final HtmlPage page, final Event event, final ScriptResult result) {
    if (event.getType().equals(Event.TYPE_BEFORE_UNLOAD)) {
        final boolean ie = hasFeature(JS_CALL_RESULT_IS_LAST_RETURN_VALUE);
        final String message = getBeforeUnloadMessage(event, result, ie);
        if (message != null) {
            final OnbeforeunloadHandler handler = getWebClient().getOnbeforeunloadHandler();
            if (handler == null) {
                LOG.warn("document.onbeforeunload() returned a string in event.returnValue,"
                        + " but no onbeforeunload handler installed.");
            }
            else {
                return handler.handleEvent(page, message);
            }
        }
    }
    return true;
}
 
Example #13
Source File: EventTarget.java    From htmlunit with Apache License 2.0 6 votes vote down vote up
/**
 * Dispatches an event into the event system (standards-conformant browsers only). See
 * <a href="https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent">the Gecko
 * DOM reference</a> for more information.
 *
 * @param event the event to be dispatched
 * @return {@code false} if at least one of the event handlers which handled the event
 *         called <tt>preventDefault</tt>; {@code true} otherwise
 */
@JsxFunction
public boolean dispatchEvent(final Event event) {
    event.setTarget(this);
    final DomElement element = (DomElement) getDomNodeOrNull();
    ScriptResult result = null;
    if (event.getType().equals(MouseEvent.TYPE_CLICK)) {
        try {
            element.click(event, event.isShiftKey(), event.isCtrlKey(), event.isAltKey(), true);
        }
        catch (final IOException e) {
            throw Context.reportRuntimeError("Error calling click(): " + e.getMessage());
        }
    }
    else {
        result = fireEvent(event);
    }
    return !event.isAborted(result);
}
 
Example #14
Source File: HtmlPage.java    From HtmlUnit-Android with Apache License 2.0 6 votes vote down vote up
private static String getBeforeUnloadMessage(final Event event, final ScriptResult result, final boolean ie) {
    String message = null;
    if (event.getReturnValue() != Undefined.instance) {
        if (!ie || event.getReturnValue() != null || result == null || result.getJavaScriptResult() == null
                || result.getJavaScriptResult() == Undefined.instance) {
            message = Context.toString(event.getReturnValue());
        }
    }
    else {
        if (result != null) {
            if (ie) {
                if (result.getJavaScriptResult() != Undefined.instance) {
                    message = Context.toString(result.getJavaScriptResult());
                }
            }
            else if (result.getJavaScriptResult() != null
                    && result.getJavaScriptResult() != Undefined.instance) {
                message = Context.toString(result.getJavaScriptResult());
            }
        }
    }
    return message;
}
 
Example #15
Source File: JSObject.java    From htmlunit with Apache License 2.0 6 votes vote down vote up
/**
 * Evaluates a JavaScript expression.
 * The expression is a string of JavaScript source code which will be evaluated in the context given by "this".
 *
 * @param expression the JavaScript expression
 * @return result Object
 * @throws JSException in case or error
 */
public Object eval(final String expression) throws JSException {
    if (LOG.isInfoEnabled()) {
        LOG.info("JSObject eval '" + expression + "'");
    }

    final Page page = Window_.getWebWindow().getEnclosedPage();
    if (page instanceof HtmlPage) {
        final HtmlPage htmlPage = (HtmlPage) page;
        final ScriptResult result = htmlPage.executeJavaScript(expression);
        final Object jsResult = result.getJavaScriptResult();
        if (jsResult instanceof ScriptableObject) {
            return new JSObject((ScriptableObject) jsResult);
        }
        if (jsResult instanceof ConsString) {
            return ((ConsString) jsResult).toString();
        }
        return jsResult;
    }
    return null;
}
 
Example #16
Source File: HtmlForm.java    From HtmlUnit-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Resets this form to its initial values, returning the page contained by this form's window after the
 * reset. Note that the returned page may or may not be the same as the original page, based on JavaScript
 * event handlers, etc.
 *
 * @return the page contained by this form's window after the reset
 */
public Page reset() {
    final SgmlPage htmlPage = getPage();
    final ScriptResult scriptResult = fireEvent(Event.TYPE_RESET);
    if (ScriptResult.isFalse(scriptResult)) {
        return scriptResult.getNewPage();
    }

    for (final HtmlElement next : getHtmlElementDescendants()) {
        if (next instanceof SubmittableElement) {
            ((SubmittableElement) next).reset();
        }
    }

    return htmlPage;
}
 
Example #17
Source File: HtmlCheckBoxInput.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected ScriptResult doClickFireClickEvent(final Event event) {
    if (!hasFeature(EVENT_ONCHANGE_AFTER_ONCLICK)) {
        executeOnChangeHandlerIfAppropriate(this);
    }

    return super.doClickFireClickEvent(event);
}
 
Example #18
Source File: HtmlRadioButtonInput.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected ScriptResult doClickFireClickEvent(final Event event) {
    if (!hasFeature(EVENT_ONCHANGE_AFTER_ONCLICK)) {
        executeOnChangeHandlerIfAppropriate(this);
    }

    return super.doClickFireClickEvent(event);
}
 
Example #19
Source File: AnalysisResult.java    From warnings-ng-plugin with MIT License 5 votes vote down vote up
/**
 * Checks if the trendChart is visible on the Page.
 *
 * @param elementId
 *         id of the Chart we want to return.
 *
 * @return TrendChart as JSON String.
 */
public String getTrendChartById(final String elementId) {
    Object result = this.executeScript(String.format(
            "delete(window.Array.prototype.toJSON) \n"
                    + "return JSON.stringify(echarts.getInstanceByDom(document.getElementById(\"%s\")).getOption())",
            elementId));
    ScriptResult scriptResult = new ScriptResult(result);

    return scriptResult.getJavaScriptResult().toString();
}
 
Example #20
Source File: DomElement.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Simulates the specified mouse event, returning the page which this element's window contains after the event.
 * The returned page may or may not be the same as the original page, depending on JavaScript event handlers, etc.
 *
 * @param eventType the mouse event type to simulate
 * @param shiftKey {@code true} if SHIFT is pressed during the mouse event
 * @param ctrlKey {@code true} if CTRL is pressed during the mouse event
 * @param altKey {@code true} if ALT is pressed during the mouse event
 * @param button the button code, must be {@link MouseEvent#BUTTON_LEFT}, {@link MouseEvent#BUTTON_MIDDLE}
 *        or {@link MouseEvent#BUTTON_RIGHT}
 * @return the page which this element's window contains after the event
 */
private Page doMouseEvent(final String eventType, final boolean shiftKey, final boolean ctrlKey,
    final boolean altKey, final int button) {
    final SgmlPage page = getPage();

    final ScriptResult scriptResult;
    final Event event;
    if (MouseEvent.TYPE_CONTEXT_MENU.equals(eventType)
            && getPage().getWebClient().getBrowserVersion().hasFeature(EVENT_ONCLICK_USES_POINTEREVENT)) {
        event = new PointerEvent(this, eventType, shiftKey, ctrlKey, altKey, button);
    }
    else {
        event = new MouseEvent(this, eventType, shiftKey, ctrlKey, altKey, button);
    }
    scriptResult = fireEvent(event);

    final Page currentPage;
    if (scriptResult == null) {
        currentPage = page;
    }
    else {
        currentPage = scriptResult.getNewPage();
    }

    final boolean mouseOver = !MouseEvent.TYPE_MOUSE_OUT.equals(eventType);
    if (mouseOver_ != mouseOver) {
        mouseOver_ = mouseOver;

        final SimpleScriptable scriptable = getScriptableObject();
        scriptable.getWindow().clearComputedStyles();
    }

    return currentPage;
}
 
Example #21
Source File: HTMLIFrameElement.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public ScriptResult executeEventLocally(final Event event) {
    if (Event.TYPE_LOAD != event.getType()
            || !isAttachedToPageDuringOnload_ || getBrowserVersion().hasFeature(JS_IFRAME_ALWAYS_EXECUTE_ONLOAD)) {
        return super.executeEventLocally(event);
    }
    return null;
}
 
Example #22
Source File: EventListenersContainer.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Executes listeners.
 *
 * @param event the event
 * @param args the arguments
 * @param propHandlerArgs handler arguments
 * @return the result
 */
ScriptResult executeListeners(final Event event, final Object[] args, final Object[] propHandlerArgs) {
    // the registered capturing listeners (if any)
    event.setEventPhase(Event.CAPTURING_PHASE);
    ScriptResult result = executeEventListeners(true, event, args);
    if (event.isPropagationStopped()) {
        return result;
    }

    // the handler declared as property (if any)
    event.setEventPhase(Event.AT_TARGET);
    ScriptResult newResult = executeEventHandler(event, propHandlerArgs);
    if (newResult != null) {
        result = newResult;
    }
    if (event.isPropagationStopped()) {
        return result;
    }

    // the registered bubbling listeners (if any)
    event.setEventPhase(Event.BUBBLING_PHASE);
    newResult = executeEventListeners(false, event, args);
    if (newResult != null) {
        result = newResult;
    }

    return result;
}
 
Example #23
Source File: DomElement.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br>
 *
 * Fires the event on the element. Nothing is done if JavaScript is disabled.
 * @param event the event to fire
 * @return the execution result, or {@code null} if nothing is executed
 */
public ScriptResult fireEvent(final Event event) {
    final WebClient client = getPage().getWebClient();
    if (!client.getOptions().isJavaScriptEnabled()) {
        return null;
    }

    if (!handles(event)) {
        return null;
    }

    if (LOG.isDebugEnabled()) {
        LOG.debug("Firing " + event);
    }
    final EventTarget jsElt = (EventTarget) getScriptableObject();
    final ContextAction action = new ContextAction() {
        @Override
        public Object run(final Context cx) {
            return jsElt.fireEvent(event);
        }
    };

    final ContextFactory cf = ((JavaScriptEngine) client.getJavaScriptEngine()).getContextFactory();
    final ScriptResult result = (ScriptResult) cf.call(action);
    if (event.isAborted(result)) {
        preventDefault();
    }
    return result;
}
 
Example #24
Source File: HtmlPage.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
private ScriptResult executeJavaScriptFunction(final Function function, final Scriptable thisObject,
        final Object[] args, final DomNode htmlElementScope) {

    final JavaScriptEngine engine = (JavaScriptEngine) getWebClient().getJavaScriptEngine();
    final Object result = engine.callFunction(this, function, thisObject, args, htmlElementScope);

    return new ScriptResult(result, getWebClient().getCurrentWindow().getEnclosedPage());
}
 
Example #25
Source File: Window.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public boolean dispatchEvent(final Event event) {
    event.setTarget(this);
    final ScriptResult result = fireEvent(event);
    return !event.isAborted(result);
}
 
Example #26
Source File: WebSocket.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
private void fire(final Event evt) {
    evt.setTarget(this);
    evt.setParentScope(getParentScope());
    evt.setPrototype(getPrototype(evt.getClass()));

    final JavaScriptEngine engine
        = (JavaScriptEngine) containingPage_.getWebClient().getJavaScriptEngine();
    engine.getContextFactory().call(new ContextAction() {
        @Override
        public ScriptResult run(final Context cx) {
            return executeEventLocally(evt);
        }
    });
}
 
Example #27
Source File: HtmlPage.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
private ScriptResult executeJavaScriptFunction(final Function function, final Scriptable thisObject,
        final Object[] args, final DomNode htmlElementScope) {

    final JavaScriptEngine engine = (JavaScriptEngine) getWebClient().getJavaScriptEngine();
    final Object result = engine.callFunction(this, function, thisObject, args, htmlElementScope);

    return new ScriptResult(result);
}
 
Example #28
Source File: Window.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public boolean dispatchEvent(final Event event) {
    event.setTarget(this);
    final ScriptResult result = fireEvent(event);
    return !event.isAborted(result);
}
 
Example #29
Source File: HtmlRadioButtonInput.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected ScriptResult doClickFireClickEvent(final Event event) {
    if (!hasFeature(EVENT_ONCHANGE_AFTER_ONCLICK)) {
        executeOnChangeHandlerIfAppropriate(this);
    }

    return super.doClickFireClickEvent(event);
}
 
Example #30
Source File: HtmlCheckBoxInput.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected ScriptResult doClickFireClickEvent(final Event event) {
    if (!hasFeature(EVENT_ONCHANGE_AFTER_ONCLICK)) {
        executeOnChangeHandlerIfAppropriate(this);
    }

    return super.doClickFireClickEvent(event);
}