1/*
2 * Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB.  If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21[
22    CustomIndexedSetter,
23] interface HTMLSelectElement : HTMLElement {
24    [Reflect] attribute boolean autofocus;
25    [Reflect] attribute boolean disabled;
26    readonly attribute HTMLFormElement form;
27    attribute boolean multiple;
28    [Reflect] attribute DOMString name;
29    [Reflect] attribute boolean required;
30    attribute long size;
31
32    readonly attribute DOMString type;
33
34    readonly attribute HTMLOptionsCollection options;
35#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
36    // DOM Level 2 changes type of length attribute to unsigned long,
37    // for compatibility we keep DOM Level 1 definition.
38    readonly attribute long length;
39#else
40    [SetterRaisesException] attribute unsigned long length;
41#endif
42    getter Node item(unsigned long index);
43    Node namedItem([Default=Undefined] optional DOMString name);
44    [ObjCLegacyUnnamedParameters, RaisesException] void add([Default=Undefined] optional HTMLElement element,
45                            [Default=Undefined] optional HTMLElement before);
46#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
47    // In JavaScript, we support both option index and option object parameters.
48    // As of this writing this cannot be auto-generated.
49    [Custom] void remove(/* indexOrOption */);
50#else
51    [ImplementedAs=removeByIndex] void remove(long index);
52#endif
53    readonly attribute HTMLCollection selectedOptions;
54    attribute long selectedIndex;
55    [TreatNullAs=NullString] attribute DOMString value;
56
57    readonly attribute boolean willValidate;
58    readonly attribute ValidityState validity;
59    readonly attribute DOMString validationMessage;
60    boolean checkValidity();
61    void setCustomValidity([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error);
62
63    readonly attribute NodeList labels;
64};
65