Skip to content

Commit

Permalink
* if(this.callback) and README
Browse files Browse the repository at this point in the history
  • Loading branch information
termi committed Apr 14, 2012
1 parent 757eeb4 commit 425925b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,21 @@ document.addEventListener("click", DelegateListener(
//Using filter instead of callback
var editorController = {
copy : function() {},
past : function() {},
paste : function() {},
handler : function(node) {
swicth(node.getAttrubute("data-menu-event")) {
case "copy":
this.copy();
breal;
case "past":
this.copy();
breal;
return false;
}
var operation = node.getAttrubute("data-menu-event"),//"copy" or "paste" or null
function = operation && this[operation];

if(function) {
function.call(this, node);
return true;
}
}
}

document.addEventListener("click", DelegateListener(
editorController.handler.bind(editorController)
editorController.handler.bind(editorController),
function(){return false}
));
```
Expand Down
2 changes: 1 addition & 1 deletion __COMPILE/DelegateListener.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion __SRC/DelegateListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ DelegateListener.prototype.handleEvent = function(event) {
}


result = this.callback.call(this.context || stopElement, event);
if(this.callback)result = this.callback.call(this.context || stopElement, event);
} while(result !== false && elem != stopElement && (elem = elem.parentNode));

return result;
Expand Down

0 comments on commit 425925b

Please sign in to comment.