var DomHandler = require("domhandler").Handler,
    DomUtils = require("domhandler").Utils,
    CSSselect = require("CSSselect");

function Handler(options){
	if(!(this instanceof Handler)) return new Handler(options);
	var that = this;
	DomHandler.call(this, function(dom){
		that.emit("dom", dom);
	}, options, function(elem){
		that.emit("element", elem);
	});
}

require("util").inherits(Handler, require("events").EventEmitter);
Object.getOwnPropertyNames(DomHandler.prototype).forEach(function(name){
	Handler.prototype[name] = DomHandler.prototype[name];
});

Handler.prototype.select = function(selector, cb){
	if(typeof selector === "string"){
		selector = CSSselect.parse(selector);
	}

	this.on("element", function(elem){
		if(selector(elem)) cb(elem);
	});
};

Handler.prototype.remove = function(selector){
	this.select(selector, DomUtils.removeElement);
};

module.exports = Handler;
@@ -693,37 +693,17 @@
 %0A%09%7D%0A
-%0A%09this.on(%22element%22, 
+%09
 function
 (ele
@@ -690,32 +690,39 @@
 r);%0A%09%7D%0A%09function
+ onElem
 (elem)%7B%0A%09%09if(sel
@@ -746,17 +746,60 @@
 lem);%0A%09%7D
-)
+%0A%09this.on(%22element%22, onElem);%0A%09return onElem
 ;%0A%7D;%0A%0AHa
@@ -844,16 +844,23 @@
 ctor)%7B%0A%09
+return 
 this.sel

return listening function in #select and #remove