Skip to content

Commit

Permalink
* README
Browse files Browse the repository at this point in the history
  • Loading branch information
termi committed Apr 14, 2012
1 parent 7cd80db commit 757eeb4
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions README.md
Expand Up @@ -10,16 +10,37 @@ It coudth be found in https://gist.github.com/2369850
//Filtering by class
document.addEventListener("click", new DelegateListener(".player", callback))
//Filtering by attribute value
document.addEventListener("click", new DelegateListener({"data-event" : "click"}, callback))
document.addEventListener("click", DelegateListener({"data-event" : "click"}, callback))
//Filtering by attribute exists
document.addEventListener("click", new DelegateListener({"data-is-menu" : void 0}, callback))
document.addEventListener("click", DelegateListener({"data-is-menu" : void 0}, callback))
//Filtering by custom filter
document.addEventListener("click", new DelegateListener(
document.addEventListener("click", DelegateListener(
function(node) {
return node.contains(someOtherNode);
},
callback)
)

//Using filter instead of callback
var editorController = {
copy : function() {},
past : function() {},
handler : function(node) {
swicth(node.getAttrubute("data-menu-event")) {
case "copy":
this.copy();
breal;
case "past":
this.copy();
breal;
return false;
}
}
}

document.addEventListener("click", DelegateListener(
editorController.handler.bind(editorController)
));
```

## Licence
Expand Down

0 comments on commit 757eeb4

Please sign in to comment.