nsIDOMHTMLOptionsCollection.idl 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "nsIDOMHTMLElement.idl"
  6. #include "nsIDOMHTMLCollection.idl"
  7. interface nsIDOMHTMLOptionElement;
  8. interface nsIDOMHTMLSelectElement;
  9. /**
  10. * The nsIDOMHTMLOptionsCollection interface is the interface to a
  11. * collection of [X]HTML option elements.
  12. *
  13. * This interface is trying to follow the DOM Level 2 HTML specification:
  14. * http://www.w3.org/TR/DOM-Level-2-HTML/
  15. *
  16. * with changes from the work-in-progress WHATWG HTML specification:
  17. * http://www.whatwg.org/specs/web-apps/current-work/
  18. */
  19. // Introduced in DOM Level 2:
  20. [uuid(4173cc53-30f6-4d12-a770-981ba53164e2)]
  21. interface nsIDOMHTMLOptionsCollection : nsISupports
  22. {
  23. attribute unsigned long length;
  24. // raises(DOMException) on setting
  25. // FIXME item should just be inherited from nsIDOMHTMLCollection
  26. nsIDOMNode item(in unsigned long index);
  27. // FIXME namedItem (and getNamedItem) should return a NodeList if there are
  28. // multiple matching items
  29. nsIDOMNode namedItem(in DOMString name);
  30. attribute long selectedIndex;
  31. [noscript] void setOption(in unsigned long index,
  32. in nsIDOMHTMLOptionElement option);
  33. [noscript] readonly attribute nsIDOMHTMLSelectElement select;
  34. // This add method implementation means the following
  35. // since IDL doesn't support overloading.
  36. // void add(in nsIDOMHTMLOptionElement,
  37. // [optional] in nsIDOMHTMLOptionElement)
  38. // void add(in nsIDOMHTMLOptionElement, in long)
  39. void add(in nsIDOMHTMLOptionElement option,
  40. [optional] in nsIVariant before);
  41. void remove(in long index);
  42. };