当前位置: 首页>>代码示例>>C++>>正文


C++ HTMLSelectElement::add方法代码示例

本文整理汇总了C++中HTMLSelectElement::add方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLSelectElement::add方法的具体用法?C++ HTMLSelectElement::add怎么用?C++ HTMLSelectElement::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTMLSelectElement的用法示例。


在下文中一共展示了HTMLSelectElement::add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: add

void HTMLOptionsCollection::add(PassRefPtr<HTMLOptionElement> element, int index, ExceptionState& exceptionState)
{
    HTMLOptionElement* newOption = element.get();

    if (!newOption) {
        exceptionState.throwTypeError("The element provided was not an HTMLOptionElement.");
        return;
    }

    if (index < -1) {
        exceptionState.throwDOMException(IndexSizeError, "The index provided (" + String::number(index) + ") is less than -1.");
        return;
    }

    HTMLSelectElement* select = toHTMLSelectElement(ownerNode());

    if (index == -1 || unsigned(index) >= length())
        select->add(newOption, 0, exceptionState);
    else
        select->add(newOption, toHTMLOptionElement(item(index)), exceptionState);

    ASSERT(!exceptionState.hadException());
}
开发者ID:,项目名称:,代码行数:23,代码来源:

示例2: add

void HTMLOptionsCollection::add(PassRefPtr<HTMLOptionElement> element, int index, ExceptionCode &ec)
{
    HTMLOptionElement* newOption = element.get();

    if (!newOption) {
        ec = TYPE_MISMATCH_ERR;
        return;
    }

    if (index < -1) {
        ec = INDEX_SIZE_ERR;
        return;
    }

    ec = 0;
    HTMLSelectElement* select = static_cast<HTMLSelectElement*>(m_base.get());

    if (index == -1 || unsigned(index) >= length())
        select->add(newOption, 0, ec);
    else
        select->add(newOption, static_cast<HTMLOptionElement*>(item(index)), ec);

    ASSERT(ec == 0);
}
开发者ID:pk-codebox-evo,项目名称:remixos-usb-tool,代码行数:24,代码来源:HTMLOptionsCollection.cpp

示例3: addCallback

static v8::Handle<v8::Value> addCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.HTMLSelectElement.add");
    HTMLSelectElement* imp = V8HTMLSelectElement::toNative(args.Holder());
    ExceptionCode ec = 0;
    {
    EXCEPTION_BLOCK(HTMLElement*, element, V8HTMLElement::HasInstance(args[0]) ? V8HTMLElement::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0);
    EXCEPTION_BLOCK(HTMLElement*, before, V8HTMLElement::HasInstance(args[1]) ? V8HTMLElement::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0);
    imp->add(element, before, ec);
    if (UNLIKELY(ec))
        goto fail;
    return v8::Handle<v8::Value>();
    }
    fail:
    V8Proxy::setDOMException(ec);
    return v8::Handle<v8::Value>();
}
开发者ID:Treeeater,项目名称:chrome_bindings,代码行数:17,代码来源:V8HTMLSelectElement.cpp

示例4: jsHTMLSelectElementPrototypeFunctionAdd

EncodedJSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionAdd(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
        return throwVMTypeError(exec);
    JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
    ExceptionCode ec = 0;
    HTMLElement* element(toHTMLElement(exec->argument(0)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    HTMLElement* before(toHTMLElement(exec->argument(1)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());

    imp->add(element, before, ec);
    setDOMException(exec, ec);
    return JSValue::encode(jsUndefined());
}
开发者ID:13W,项目名称:phantomjs,代码行数:19,代码来源:JSHTMLSelectElement.cpp


注:本文中的HTMLSelectElement::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。