Fix up ordering issues in radiogroups. Bug 226549, r=neil, sr=alecf

git-svn-id: svn://10.0.0.236/trunk@149959 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu 2003-12-03 04:40:03 +00:00
parent 42b7fba800
commit 73ca76a361

View File

@ -185,14 +185,19 @@
]]>
</body>
</method>
<field name="mRadioChildren">[]</field>
<field name="mRadioChildren">null</field>
<method name="_getRadioChildren">
<parameter name="aNode">this</parameter>
<parameter name="aNode" />
<body>
<![CDATA[
if (aNode) {
if (aNode == this && this.mRadioChildren)
if (!aNode)
aNode = this;
if (aNode == this) {
if (this.mRadioChildren)
return this.mRadioChildren;
else
this.mRadioChildren = new Array();
}
else if (aNode.localName == "radio") {
this.mRadioChildren[this.mRadioChildren.length++] = aNode;
return this.mRadioChildren;
@ -201,7 +206,6 @@
return this.mRadioChildren;
for (var i = 0; i < aNode.childNodes.length; ++i)
this._getRadioChildren(aNode.childNodes[i]);
}
return this.mRadioChildren;
]]>
</body>
@ -343,16 +347,18 @@
<implementation implements="nsIDOMXULSelectControlItemElement, nsIAccessibleProvider">
<constructor>
<![CDATA[
var parent = this.radioGroup;
parent.mRadioChildren[parent.mRadioChildren.length++] = this;
// Just clear out the parent's cached list of radio children
this.radioGroup.mRadioChildren = null;
]]>
</constructor>
<destructor>
<![CDATA[
var parent = this.radioGroup;
for (var i = 0; i < parent.mRadioChildren.length; ++i) {
if (parent.mRadioChildren[i] == this) {
parent.mRadioChildren.slice(i, i);
var radioList = this.radioGroup.mRadioChildren;
if (!radioList)
return;
for (var i = 0; i < radioList.length; ++i) {
if (radioList[i] == this) {
radioList.splice(i, 1);
return;
}
}