Skip to content
Browse files

Merge branch 'master' of https://github.com/clientside/amplesdk into …

…kbdemo
  • Loading branch information...
2 parents 0fc6c20 + 59bdf13 commit a28bdd08d28a72e2fb824c29f17e0f3de8946996 @h6w committed
Showing with 8 additions and 11 deletions.
  1. +8 −11 ample/languages/xul/managers/oXULCommandDispatcher.js
View
19 ample/languages/xul/managers/oXULCommandDispatcher.js
@@ -8,20 +8,17 @@
*/
cXULElement.prototype.doCommand = function() {
- var oCommand;
- if (this instanceof cXULElement_command)
- oCommand = this;
- else {
- var sCommand = this.attributes.command;
- if (sCommand) {
- var oElement = this.ownerDocument.getElementById(sCommand);
- if (oElement && oElement instanceof cXULElement_command)
- oCommand = oElement;
- }
+ var oCommand = this,
+ sCommand = this.attributes.command;
+ // If element is not command and if it has command attribute
+ if (!(this instanceof cXULElement_command) && sCommand) {
+ oCommand = this.ownerDocument.getElementById(sCommand);
+ if (!(oCommand instanceof cXULElement_command))
+ oCommand = null;
}
+ // Fire Event on command element
if (oCommand) {
- // Fire Event on command element
var oEvent = this.ownerDocument.createEvent("CustomEvent");
oEvent.initCustomEvent("command", true, true, null);
oCommand.dispatchEvent(oEvent);

0 comments on commit a28bdd0

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