/*
 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

module html {

    interface [
        JSGenerateToNativeObject,
        CustomIndexedSetter
    ] HTMLOptionsCollection : HTMLCollection {
                 attribute long selectedIndex;
                 attribute [Custom] unsigned long length
                        setter raises (DOMException);

        [Custom] void add(in [Optional=DefaultIsUndefined] HTMLOptionElement option, 
                          in [Optional] unsigned long index)
             raises (DOMException);
        [Custom] void remove(in [Optional=DefaultIsUndefined] unsigned long index);

#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
        Node item(in unsigned long index); 
        Node namedItem(in DOMString name); 
#endif
    };

}
