本文整理汇总了C++中HTMLFormElement::getNamedElements方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLFormElement::getNamedElements方法的具体用法?C++ HTMLFormElement::getNamedElements怎么用?C++ HTMLFormElement::getNamedElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLFormElement
的用法示例。
在下文中一共展示了HTMLFormElement::getNamedElements方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nameGetter
JSValuePtr JSHTMLFormElement::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
{
HTMLFormElement* form = static_cast<HTMLFormElement*>(static_cast<JSHTMLElement*>(asObject(slot.slotBase()))->impl());
Vector<RefPtr<Node> > namedItems;
form->getNamedElements(propertyName, namedItems);
if (namedItems.size() == 1)
return toJS(exec, namedItems[0].get());
if (namedItems.size() > 1)
return new (exec) JSNamedNodesCollection(exec, namedItems);
return jsUndefined();
}
示例2: nameGetter
JSValue JSHTMLFormElement::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
{
JSHTMLElement* jsForm = static_cast<JSHTMLFormElement*>(asObject(slot.slotBase()));
HTMLFormElement* form = static_cast<HTMLFormElement*>(jsForm->impl());
Vector<RefPtr<Node> > namedItems;
form->getNamedElements(propertyName, namedItems);
if (namedItems.isEmpty())
return jsUndefined();
if (namedItems.size() == 1)
return toJS(exec, namedItems[0].get());
// FIXME: HTML5 specifies that this should be a RadioNodeList.
return toJS(exec, jsForm->globalObject(), StaticNodeList::adopt(namedItems).get());
}
示例3: nameGetter
JSValue JSHTMLFormElement::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
{
JSHTMLElement* jsForm = jsCast<JSHTMLFormElement*>(asObject(slotBase));
HTMLFormElement* form = toHTMLFormElement(jsForm->impl());
Vector<RefPtr<Node> > namedItems;
form->getNamedElements(propertyNameToAtomicString(propertyName), namedItems);
if (namedItems.isEmpty())
return jsUndefined();
if (namedItems.size() == 1)
return toJS(exec, jsForm->globalObject(), namedItems[0].get());
// FIXME: HTML5 specifies that this should be a RadioNodeList.
return toJS(exec, jsForm->globalObject(), StaticNodeList::adopt(namedItems).get());
}