本文整理汇总了C++中HTMLCollection::type方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLCollection::type方法的具体用法?C++ HTMLCollection::type怎么用?C++ HTMLCollection::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLCollection
的用法示例。
在下文中一共展示了HTMLCollection::type方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isMatchingElement
inline bool isMatchingElement(const HTMLCollection& htmlCollection, Element& element)
{
CollectionType type = htmlCollection.type();
if (!element.isHTMLElement() && !(type == DocAll || type == NodeChildren || type == WindowNamedItems))
return false;
switch (type) {
case DocImages:
return element.hasTagName(imgTag);
case DocScripts:
return element.hasTagName(scriptTag);
case DocForms:
return element.hasTagName(formTag);
case TableTBodies:
return element.hasTagName(tbodyTag);
case TRCells:
return element.hasTagName(tdTag) || element.hasTagName(thTag);
case TSectionRows:
return element.hasTagName(trTag);
case SelectOptions:
return element.hasTagName(optionTag);
case SelectedOptions:
return element.hasTagName(optionTag) && toHTMLOptionElement(element).selected();
case DataListOptions:
if (element.hasTagName(optionTag)) {
HTMLOptionElement& option = toHTMLOptionElement(element);
if (!option.isDisabledFormControl() && !option.value().isEmpty())
return true;
}
return false;
case MapAreas:
return element.hasTagName(areaTag);
case DocApplets:
return element.hasTagName(appletTag) || (element.hasTagName(objectTag) && toHTMLObjectElement(element).containsJavaApplet());
case DocEmbeds:
return element.hasTagName(embedTag);
case DocLinks:
return (element.hasTagName(aTag) || element.hasTagName(areaTag)) && element.fastHasAttribute(hrefAttr);
case DocAnchors:
return element.hasTagName(aTag) && element.fastHasAttribute(nameAttr);
case DocAll:
case NodeChildren:
return true;
case DocumentNamedItems:
return static_cast<const DocumentNameCollection&>(htmlCollection).nodeMatches(&element);
case WindowNamedItems:
return static_cast<const WindowNameCollection&>(htmlCollection).nodeMatches(&element);
case FormControls:
case TableRows:
break;
}
ASSERT_NOT_REACHED();
return false;
}
示例2: nameGetter
JSValue JSHTMLCollection::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
{
JSHTMLCollection* collection = jsCast<JSHTMLCollection*>(asObject(slotBase));
const AtomicString& name = propertyNameToAtomicString(propertyName);
HTMLCollection* impl = collection->impl();
#if ENABLE(MICRODATA)
if (impl->type() == ItemProperties)
return toJS(exec, collection->globalObject(), static_cast<HTMLPropertiesCollection*>(impl)->propertyNodeList(name));
#endif
return toJS(exec, collection->globalObject(), impl->namedItem(name));
}
示例3: toDocumentNameCollection
static inline bool isMatchingHTMLElement(const HTMLCollection& htmlCollection, const HTMLElement& element)
{
switch (htmlCollection.type()) {
case DocImages:
return element.hasTagName(imgTag);
case DocScripts:
return element.hasTagName(scriptTag);
case DocForms:
return element.hasTagName(formTag);
case DocumentNamedItems:
return toDocumentNameCollection(htmlCollection).elementMatches(element);
case TableTBodies:
return element.hasTagName(tbodyTag);
case TRCells:
return element.hasTagName(tdTag) || element.hasTagName(thTag);
case TSectionRows:
return element.hasTagName(trTag);
case SelectOptions:
return toHTMLOptionsCollection(htmlCollection).elementMatches(element);
case SelectedOptions:
return isHTMLOptionElement(element) && toHTMLOptionElement(element).selected();
case DataListOptions:
return toHTMLDataListOptionsCollection(htmlCollection).elementMatches(element);
case MapAreas:
return element.hasTagName(areaTag);
case DocApplets:
return isHTMLObjectElement(element) && toHTMLObjectElement(element).containsJavaApplet();
case DocEmbeds:
return element.hasTagName(embedTag);
case DocLinks:
return (element.hasTagName(aTag) || element.hasTagName(areaTag)) && element.fastHasAttribute(hrefAttr);
case DocAnchors:
return element.hasTagName(aTag) && element.fastHasAttribute(nameAttr);
case ClassCollectionType:
case TagCollectionType:
case HTMLTagCollectionType:
case DocAll:
case NodeChildren:
case FormControls:
case TableRows:
case WindowNamedItems:
case NameNodeListType:
case RadioNodeListType:
case RadioImgNodeListType:
case LabelsNodeListType:
ASSERT_NOT_REACHED();
}
return false;
}
示例4: ENABLE
v8::Handle<v8::Value> V8HTMLCollection::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
return v8Undefined();
if (info.Holder()->HasRealNamedCallbackProperty(name))
return v8Undefined();
HTMLCollection* imp = V8HTMLCollection::toNative(info.Holder());
#if ENABLE(MICRODATA)
if (imp->type() == ItemProperties) {
if (!static_cast<HTMLPropertiesCollection*>(imp)->hasNamedItem(toWebCoreAtomicString(name)))
return v8Undefined();
RefPtr<PropertyNodeList> item = static_cast<HTMLPropertiesCollection*>(imp)->propertyNodeList(toWebCoreAtomicString(name));
if (!item)
return v8Undefined();
return toV8(item.release(), info.Holder(), info.GetIsolate());
}
#endif
Node* item = imp->namedItem(toWebCoreAtomicString(name));
if (!item)
return v8Undefined();
return toV8(item, info.Holder(), info.GetIsolate());
}
示例5: isMatchingElement
template <> inline bool isMatchingElement(const HTMLCollection& htmlCollection, const Element& element)
{
CollectionType type = htmlCollection.type();
// These collections apply to any kind of Elements, not just HTMLElements.
switch (type) {
case DocAll:
case NodeChildren:
return true;
case ClassCollectionType:
return static_cast<const ClassCollection&>(htmlCollection).elementMatches(element);
case TagCollectionType:
return static_cast<const TagCollection&>(htmlCollection).elementMatches(element);
case HTMLTagCollectionType:
return static_cast<const HTMLTagCollection&>(htmlCollection).elementMatches(element);
default:
break;
}
// The following only applies to HTMLElements.
if (!element.isHTMLElement())
return false;
switch (type) {
case DocImages:
return element.hasLocalName(imgTag);
case DocScripts:
return element.hasLocalName(scriptTag);
case DocForms:
return element.hasLocalName(formTag);
case TableTBodies:
return element.hasLocalName(tbodyTag);
case TRCells:
return element.hasLocalName(tdTag) || element.hasLocalName(thTag);
case TSectionRows:
return element.hasLocalName(trTag);
case SelectOptions:
return element.hasLocalName(optionTag);
case SelectedOptions:
return element.hasLocalName(optionTag) && toHTMLOptionElement(element).selected();
case DataListOptions:
if (element.hasLocalName(optionTag)) {
const HTMLOptionElement& option = toHTMLOptionElement(element);
if (!option.isDisabledFormControl() && !option.value().isEmpty())
return true;
}
return false;
case MapAreas:
return element.hasLocalName(areaTag);
case DocApplets:
return element.hasLocalName(appletTag) || (element.hasLocalName(objectTag) && toHTMLObjectElement(element).containsJavaApplet());
case DocEmbeds:
return element.hasLocalName(embedTag);
case DocLinks:
return (element.hasLocalName(aTag) || element.hasLocalName(areaTag)) && element.fastHasAttribute(hrefAttr);
case DocAnchors:
return element.hasLocalName(aTag) && element.fastHasAttribute(nameAttr);
case ClassCollectionType:
case TagCollectionType:
case HTMLTagCollectionType:
case DocAll:
case NodeChildren:
case FormControls:
case DocumentNamedItems:
case TableRows:
case WindowNamedItems:
case NameNodeListType:
case RadioNodeListType:
case RadioImgNodeListType:
case LabelsNodeListType:
ASSERT_NOT_REACHED();
}
return false;
}