From: Jörn Zaefferer Date: Thu, 28 Jul 2011 19:55:38 +0000 (+0200) Subject: Widget delegation: Small if-simplify refactoring X-Git-Tag: 1.9m6~91^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0ff3396e8853d1858db56e4ad7552f87c09e5504;p=jquery-ui.git Widget delegation: Small if-simplify refactoring --- diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index d154185d5..a66b8a54a 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -322,10 +322,10 @@ $.Widget.prototype = { var match = event.match( /^(\w+)\s*(.*)$/ ), eventName = match[1] + "." + instance.widgetName, selector = match[2]; - if ( selector === '' ) { - element.bind( eventName, handlerProxy ); - } else { + if ( selector ) { element.delegate( selector, eventName, handlerProxy ); + } else { + element.bind( eventName, handlerProxy ); } }); },