static void valueAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
    HTMLOptionElement* imp = V8HTMLOptionElement::toNative(info.Holder());
    V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value);
    imp->setValue(v);
    return;
}
Пример #2
0
static void valueAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
    INC_STATS("DOM.HTMLOptionElement.value._set");
    HTMLOptionElement* imp = V8HTMLOptionElement::toNative(info.Holder());
    V8Parameter<WithNullCheck> v = value;
    imp->setValue(v);
    return;
}
JSObject* JSHTMLOptionElementConstructor::construct(ExecState* exec, const List& args)
{
    int exception = 0;
    RefPtr<Element> el(m_doc->createElement("option", exception));
    HTMLOptionElement* opt = 0;
    if (el) {
        opt = static_cast<HTMLOptionElement*>(el.get());
        int sz = args.size();
        RefPtr<Text> text = m_doc->createTextNode("");
        opt->appendChild(text, exception);
        if (exception == 0 && sz > 0)
            text->setData(args[0]->toString(exec), exception);
        if (exception == 0 && sz > 1)
            opt->setValue(args[1]->toString(exec));
        if (exception == 0 && sz > 2)
            opt->setDefaultSelected(args[2]->toBoolean(exec));
        if (exception == 0 && sz > 3)
            opt->setSelected(args[3]->toBoolean(exec));
    }

    setDOMException(exec, exception);
    return static_cast<JSObject*>(toJS(exec, opt));
}
void setJSHTMLOptionElementValue(ExecState* exec, JSObject* thisObject, JSValue value)
{
    JSHTMLOptionElement* castedThisObj = static_cast<JSHTMLOptionElement*>(thisObject);
    HTMLOptionElement* imp = static_cast<HTMLOptionElement*>(castedThisObj->impl());
    imp->setValue(valueToStringWithNullCheck(exec, value));
}