1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef HTMLDataListOptionsCollection_h
6 #define HTMLDataListOptionsCollection_h
8 #include "core/html/HTMLCollection.h"
9 #include "core/html/HTMLOptionElement.h"
13 class HTMLDataListOptionsCollection : public HTMLCollection {
15 static PassRefPtrWillBeRawPtr<HTMLDataListOptionsCollection> create(ContainerNode& ownerNode, CollectionType type)
17 ASSERT_UNUSED(type, type == DataListOptions);
18 return adoptRefWillBeNoop(new HTMLDataListOptionsCollection(ownerNode));
21 HTMLOptionElement* item(unsigned offset) const { return toHTMLOptionElement(HTMLCollection::item(offset)); }
23 bool elementMatches(const HTMLElement&) const;
25 explicit HTMLDataListOptionsCollection(ContainerNode& ownerNode)
26 : HTMLCollection(ownerNode, DataListOptions, DoesNotOverrideItemAfter)
30 DEFINE_TYPE_CASTS(HTMLDataListOptionsCollection, LiveNodeListBase, collection, collection->type() == DataListOptions, collection.type() == DataListOptions);
32 inline bool HTMLDataListOptionsCollection::elementMatches(const HTMLElement& element) const
34 if (isHTMLOptionElement(element)) {
35 const HTMLOptionElement& option = toHTMLOptionElement(element);
36 if (!option.isDisabledFormControl() && !option.value().isEmpty())
44 #endif // HTMLDataListOptionsCollection_h