Checking in keeda@hotpop.com's fix for bug 179461. Partially implement IE's select.options.add() method. No support for the optional second argument yet. r=caillon@returnzero.com, sr=jst@netscape.com

This commit is contained in:
jst%netscape.com 2002-11-20 22:36:36 +00:00
Родитель 2970b8921a
Коммит 447d7e11ca
2 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -100,12 +100,13 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNSHTMLOptionCollection interface, can't use the macro
// NS_DECL_NSIDOMNSHTMLOPTIONLIST here since GetLength() is defined
// in mode than one interface
// NS_DECL_NSIDOMNSHTMLOPTIONCOLLECTION here since GetLength() is
// defined in more than one interface
NS_IMETHOD SetLength(PRUint32 aLength);
NS_IMETHOD GetSelectedIndex(PRInt32* aSelectedIndex);
NS_IMETHOD SetSelectedIndex(PRInt32 aSelectedIndex);
NS_IMETHOD SetOption(PRInt32 aIndex, nsIDOMHTMLOptionElement* aOption);
NS_IMETHOD Add(nsIDOMHTMLOptionElement* aOption);
// nsIDOMHTMLCollection interface
NS_DECL_NSIDOMHTMLCOLLECTION
@ -2396,6 +2397,13 @@ nsHTMLOptionCollection::NamedItem(const nsAString& aName,
return rv;
}
NS_IMETHODIMP
nsHTMLOptionCollection::Add(nsIDOMHTMLOptionElement *aOption)
{
nsCOMPtr<nsIDOMNode> ret;
return mSelect->AppendChild(aOption, getter_AddRefs(ret));
}
nsresult
nsHTMLOptionCollection::InsertElementAt(nsIDOMHTMLOptionElement* aOption,
PRInt32 aIndex)

Просмотреть файл

@ -51,4 +51,9 @@ interface nsIDOMNSHTMLOptionCollection : nsISupports
[noscript] void setOption(in long index,
in nsIDOMHTMLOptionElement option);
// The following exists to give us partial compatibility with the
// add method as it exists in IE (we don't yet support the second
// argument)
void add(in nsIDOMHTMLOptionElement option);
};