本文整理汇总了C++中HTMLOptionsCollection::add方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLOptionsCollection::add方法的具体用法?C++ HTMLOptionsCollection::add怎么用?C++ HTMLOptionsCollection::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLOptionsCollection
的用法示例。
在下文中一共展示了HTMLOptionsCollection::add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setDOMException
void V8HTMLOptionsCollection::addMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
{
if (!V8HTMLOptionElement::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))) {
setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
return;
}
HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(args.Holder());
HTMLOptionElement* option = V8HTMLOptionElement::toNative(v8::Handle<v8::Object>(v8::Handle<v8::Object>::Cast(args[0])));
ExceptionCode ec = 0;
if (args.Length() < 2)
imp->add(option, ec);
else {
bool ok;
V8TRYCATCH_VOID(int, index, toInt32(args[1], ok));
if (!ok)
ec = TYPE_MISMATCH_ERR;
else
imp->add(option, index, ec);
}
if (!ec)
return;
setDOMException(ec, args.GetIsolate());
}
示例2: setDOMException
v8::Handle<v8::Value> V8HTMLOptionsCollection::addCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLOptionsCollection.add()");
if (!V8HTMLOptionElement::HasInstance(args[0]))
return setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(args.Holder());
HTMLOptionElement* option = V8HTMLOptionElement::toNative(v8::Handle<v8::Object>(v8::Handle<v8::Object>::Cast(args[0])));
ExceptionCode ec = 0;
if (args.Length() < 2)
imp->add(option, ec);
else {
bool ok;
v8::TryCatch try_catch;
int index = toInt32(args[1], ok);
if (try_catch.HasCaught())
return v8::Undefined();
if (!ok)
ec = TYPE_MISMATCH_ERR;
else
imp->add(option, index, ec);
}
if (ec)
return setDOMException(ec, args.GetIsolate());
return v8::Undefined();
}
示例3: add
JSValue JSHTMLOptionsCollection::add(ExecState* exec)
{
HTMLOptionsCollection* imp = static_cast<HTMLOptionsCollection*>(impl());
HTMLOptionElement* option = toHTMLOptionElement(exec->argument(0));
ExceptionCode ec = 0;
if (exec->argumentCount() < 2)
imp->add(option, ec);
else {
int index = exec->argument(1).toInt32(exec);
if (exec->hadException())
return jsUndefined();
imp->add(option, index, ec);
}
setDOMException(exec, ec);
return jsUndefined();
}
示例4: add
JSValue JSHTMLOptionsCollection::add(ExecState* exec, const ArgList& args)
{
HTMLOptionsCollection* imp = static_cast<HTMLOptionsCollection*>(impl());
HTMLOptionElement* option = toHTMLOptionElement(args.at(0));
ExceptionCode ec = 0;
if (args.size() < 2)
imp->add(option, ec);
else {
bool ok;
int index = args.at(1).toInt32(exec, ok);
if (exec->hadException())
return jsUndefined();
if (!ok)
ec = TYPE_MISMATCH_ERR;
else
imp->add(option, index, ec);
}
setDOMException(exec, ec);
return jsUndefined();
}
示例5: add
JSValue JSHTMLOptionsCollection::add(ExecState* exec)
{
HTMLOptionsCollection* imp = static_cast<HTMLOptionsCollection*>(impl());
HTMLOptionElement* option = toHTMLOptionElement(exec->argument(0));
ExceptionCode ec = 0;
if (exec->argumentCount() < 2)
imp->add(option, ec);
else {
bool ok;
int index = finiteInt32Value(exec->argument(1), exec, ok);
if (exec->hadException())
return jsUndefined();
if (!ok)
ec = TYPE_MISMATCH_ERR;
else
imp->add(option, index, ec);
}
setDOMException(exec, ec);
return jsUndefined();
}
示例6: exceptionState
void V8HTMLOptionsCollection::addMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "add", "HTMLOptionsCollection", info.Holder(), info.GetIsolate());
if (!V8HTMLOptionElement::hasInstance(info[0], info.GetIsolate())) {
exceptionState.throwTypeError("The element provided was not an HTMLOptionElement.");
} else {
HTMLOptionsCollection* impl = V8HTMLOptionsCollection::toNative(info.Holder());
HTMLOptionElement* option = V8HTMLOptionElement::toNative(v8::Handle<v8::Object>(v8::Handle<v8::Object>::Cast(info[0])));
if (info.Length() < 2) {
impl->add(option, exceptionState);
} else {
int index = toInt32(info[1], exceptionState);
if (exceptionState.throwIfNeeded())
return;
impl->add(option, index, exceptionState);
}
}
exceptionState.throwIfNeeded();
}
示例7: exceptionState
void V8HTMLOptionsCollection::addMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "add", "HTMLOptionsCollection", info.Holder(), info.GetIsolate());
if (!V8HTMLOptionElement::hasInstance(info[0], info.GetIsolate(), worldType(info.GetIsolate()))) {
exceptionState.throwTypeError("The element provided was not an HTMLOptionElement.");
} else {
HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(info.Holder());
HTMLOptionElement* option = V8HTMLOptionElement::toNative(v8::Handle<v8::Object>(v8::Handle<v8::Object>::Cast(info[0])));
if (info.Length() < 2) {
imp->add(option, exceptionState);
} else {
bool ok;
V8TRYCATCH_VOID(int, index, toInt32(info[1], ok));
if (!ok)
exceptionState.throwTypeError("The index provided could not be interpreted as an integer.");
else
imp->add(option, index, exceptionState);
}
}
exceptionState.throwIfNeeded();
}