From: Mike Taylor Date: Wed, 26 Mar 2014 17:19:45 +0000 (+0000) Subject: The Perpage widget's promotion-function is now anonymous. X-Git-Tag: 1.0.0~1173 X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=commitdiff_plain;h=9017ef4e5a8c4a4d427ce5a8b7a02ee795d7c218 The Perpage widget's promotion-function is now anonymous. This feels strangely daring. It's very neat and concise, but may be wandering dangerously close to the line where elegance is bought at the price of incomprehensibility. --- diff --git a/src/mkws-widgets.js b/src/mkws-widgets.js index b29538e..b286705 100644 --- a/src/mkws-widgets.js +++ b/src/mkws-widgets.js @@ -289,7 +289,7 @@ function promoteToSort() { mkws.registerWidgetType('Sort', promoteToSort); -function promoteToPerpage() { +mkws.registerWidgetType('Perpage', function() { var that = this; $(this.node).change(function() { @@ -300,5 +300,4 @@ function promoteToPerpage() { } return false; }); -} -mkws.registerWidgetType('Perpage', promoteToPerpage); +});