Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Register items on collection owning element

  • Loading branch information...
commit 5d6d8c93bedf34a1580ec7be0cfd0cac2ea2637d 1 parent beab211
@ilinsky ilinsky authored
View
30 ample/languages/xul/elements/radio.js
@@ -51,36 +51,6 @@ cXULElement_radio.handlers = {
}
}
}
- },
- "DOMNodeInsertedIntoDocument": function(oEvent) {
- for (var oElement = this; oElement; oElement = oElement.parentNode)
- if (oElement instanceof cXULElement_radiogroup)
- break;
- if (oElement) {
- oElement.items.$add(this);
- this.group = oElement;
- //
- if (this.attributes["selected"] == "true") {
- oElement.selectedIndex = oElement.items.length - 1;
- oElement.selectedItem = this;
- }
- }
- },
- "DOMNodeRemovedFromDocument": function(oEvent) {
- for (var oElement = this; oElement; oElement = oElement.parentNode)
- if (oElement instanceof cXULElement_radiogroup)
- break;
- if (oElement) {
- if (this.attributes["selected"] == "true") {
- if (oElement.selectedItem == this) {
- oElement.selectedIndex =-1;
- oElement.selectedItem = null;
- }
- }
- //
- oElement.items.$remove(this);
- this.group = null;
- }
}
};
View
24 ample/languages/xul/elements/radiogroup.js
@@ -49,6 +49,30 @@ cXULElement_radiogroup.handlers = {
}
}
}
+ },
+ "DOMNodeInserted": function(oEvent) {
+ if (oEvent.target instanceof cXULElement_radio) {
+ this.items.$add(oEvent.target);
+ oEvent.target.group = this;
+ //
+ if (oEvent.target.attributes["selected"] == "true") {
+ this.selectedIndex = this.items.length - 1;
+ this.selectedItem = oEvent.target;
+ }
+ }
+ },
+ "DOMNodeRemoved": function(oEvent) {
+ if (oEvent.target instanceof cXULElement_radio) {
+ //
+ if (oEvent.target.attributes["selected"] == "true") {
+ if (this.selectedItem == oEvent.target) {
+ this.selectedIndex =-1;
+ this.selectedItem = null;
+ }
+ }//
+ oEvent.target.group = null;
+ this.items.$remove(oEvent.target);
+ }
}
};

0 comments on commit 5d6d8c9

Please sign in to comment.
Something went wrong with that request. Please try again.