Пример #1
0
JSValue* JSHTMLInputElementPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
{
    if (!thisObj->inherits(&JSHTMLInputElement::info))
      return throwError(exec, TypeError);

    HTMLInputElement* imp = static_cast<HTMLInputElement*>(static_cast<JSHTMLInputElement*>(thisObj)->impl());

    switch (id) {
    case JSHTMLInputElement::BlurFuncNum: {

        imp->blur();
        return jsUndefined();
    }
    case JSHTMLInputElement::FocusFuncNum: {

        imp->focus();
        return jsUndefined();
    }
    case JSHTMLInputElement::SelectFuncNum: {

        imp->select();
        return jsUndefined();
    }
    case JSHTMLInputElement::ClickFuncNum: {

        imp->click();
        return jsUndefined();
    }
    }
    return 0;
}
Пример #2
0
JSValue JSC_HOST_CALL jsHTMLInputElementPrototypeFunctionClick(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSHTMLInputElement::s_info))
        return throwError(exec, TypeError);
    JSHTMLInputElement* castedThisObj = static_cast<JSHTMLInputElement*>(asObject(thisValue));
    HTMLInputElement* imp = static_cast<HTMLInputElement*>(castedThisObj->impl());

    imp->click();
    return jsUndefined();
}
Пример #3
0
void HTMLFormElement::submitClick()
{
    bool submitFound = false;
    for (unsigned i = 0; i < formElements.size(); ++i) {
        if (formElements[i]->hasLocalName(inputTag)) {
            HTMLInputElement *element = static_cast<HTMLInputElement *>(formElements[i]);
            if (element->isSuccessfulSubmitButton() && element->renderer()) {
                submitFound = true;
                element->click(false);
                break;
            }
        }
    }
    if (!submitFound) // submit the form without a submit or image input
        prepareSubmit();
}