diff --git a/.gitignore b/.gitignore index 631cb6f..a94638c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules/ -reports/ \ No newline at end of file +reports/ +.idea diff --git a/Gruntfile.js b/Gruntfile.js index d45846f..8e39860 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -7,21 +7,21 @@ module.exports = function(grunt) { options: { separator: '\n\n', stripBanners: true, - banner: '// <%= pkg.name %> <%= pkg.version %> | (c) <%= grunt.template.today("yyyy") %> Ryan Niemeyer | http://www.opensource.org/licenses/mit-license\n' + banner: '// knockout-delegatedEvents <%= pkg.version %> | (c) <%= grunt.template.today("yyyy") %> Ryan Niemeyer | http://www.opensource.org/licenses/mit-license\n' }, dist: { src: "src/*.js", - dest: 'build/<%= pkg.name %>.js' + dest: 'build/knockout-delegatedEvents.js' } }, uglify: { options: { stripBanners: true, - banner: '// <%= pkg.name %> <%= pkg.version %> | (c) <%= grunt.template.today("yyyy") %> Ryan Niemeyer | http://www.opensource.org/licenses/mit-license\n' + banner: '// knockout-delegatedEvents <%= pkg.version %> | (c) <%= grunt.template.today("yyyy") %> Ryan Niemeyer | http://www.opensource.org/licenses/mit-license\n' }, build: { - src: 'build/<%= pkg.name %>.js', - dest: 'build/<%= pkg.name %>.min.js' + src: 'build/knockout-delegatedEvents.js', + dest: 'build/knockout-delegatedEvents.min.js' } }, jshint: { @@ -63,4 +63,4 @@ module.exports = function(grunt) { // Default task(s). grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'jasmine']); -}; \ No newline at end of file +}; diff --git a/build/knockout-delegatedEvents.js b/build/knockout-delegatedEvents.js index 8fe7d1c..ab1f2cd 100644 --- a/build/knockout-delegatedEvents.js +++ b/build/knockout-delegatedEvents.js @@ -1,4 +1,4 @@ -// knockout-delegatedEvents 0.6.0 | (c) 2015 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license +// knockout-delegatedEvents 0.6.1 | (c) 2015 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license ;(function(factory) { //CommonJS if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { diff --git a/build/knockout-delegatedEvents.min.js b/build/knockout-delegatedEvents.min.js index 5ac3778..62952a1 100644 --- a/build/knockout-delegatedEvents.min.js +++ b/build/knockout-delegatedEvents.min.js @@ -1,2 +1,2 @@ -// knockout-delegatedEvents 0.6.0 | (c) 2015 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license +// knockout-delegatedEvents 0.6.1 | (c) 2015 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license !function(a){"function"==typeof require&&"object"==typeof exports&&"object"==typeof module?a(require("knockout"),exports):"function"==typeof define&&define.amd?define(["knockout","exports"],a):a(ko,ko.actions={})}(function(a,b){function c(b,c,d,e){for(var f="data-"+e+"-parent";c&&1===c.nodeType&&!c.disabled&&!c.hasAttribute(f);)c=c!==d?c.parentNode:null;if(c){var g=c.getAttribute(f),h="true"===g?b:b[g];return h&&"function"==typeof h?{method:h,element:c,owner:a.dataFor(d)}:void 0}}function d(b,c,d){for(var e,f,g,h,k="data-"+d,l=i+d,m=j+d,n="data-"+d+"-parent";!e&&b&&b!==c;)1!==b.nodeType||b.disabled||(g?(e=a.utils.domData.get(b,m),e&&(e="true"===g?e:e[g],f=a.dataFor(b))):(e=b.getAttribute(k)||a.utils.domData.get(b,l),e||(g=b.getAttribute(n),g&&(h=b)))),e||(b=b.parentNode);return e?{method:e,element:h||b,owner:f}:void 0}function e(c,d,e,f){return function(g){var h=f(g.target||g.srcElement,d,c);if(h){var i,j,k,l,m,n,o=h.element,p=h.method,q=h.owner;if(p){if(j=a.contextFor(o)){for(;o&&o!==d;){if(o.disabled)return;o=o.parentNode}i=j.$data,"string"==typeof p?(p in b?(m=b[p],m&&(k="function"==typeof m?m:m.action,q=m.owner||i)):i&&i[p]&&"function"==typeof i[p]&&(k=i[p],q=i),k||(l=a.utils.arrayFirst(j.$parents,function(a){return a[p]&&"function"==typeof a[p]}),k=l&&l[p],q=l)):"function"==typeof p&&(k=p,q=q||i)}k&&(n="submit"===c?k.call(i,g.target):k.call(q,i,g),n!==!0&&(g.preventDefault?g.preventDefault():g.returnValue=!1),e!==!0&&(g.cancelBubble=!0,"function"==typeof g.stopPropagation&&g.stopPropagation()))}}}}function f(a,b){return a+b.substr(0,1).toUpperCase()+b.slice(1)}function g(b,c){a.bindingHandlers[b]||(a.bindingHandlers[b]={init:function(b,d){var e=d();a.utils.domData.set(b,c,e)}})}function h(a){g(f("delegated",a),i+a),g(f("delegatedParent",a),j+a)}var i="ko_delegated_",j="ko_delegated_parent_";a.bindingHandlers.delegatedHandler={init:function(b,c,g){var i=a.utils.unwrapObservable(c())||[];"string"==typeof i&&(i=[i]),a.utils.arrayForEach(i,function(c){var i=g.get(f("delegated",c+"Bubble"))===!0;h(c),a.utils.registerEventHandler(b,c,e(c,b,i,d))})}},a.bindingHandlers.delegatedParentHandler={init:function(b,d,g){var h=a.utils.unwrapObservable(d());a.utils.objectForEach(h,function(d){var i=g.get(f("delegated",d+"Bubble"))===!0;a.utils.registerEventHandler(b,d,e(d,b,i,c.bind(null,h[d])))})}}}); \ No newline at end of file diff --git a/package.json b/package.json index e87e117..10772f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "knockout-delegated-events", - "version": "0.6.0", + "version": "0.6.1", "description": "A simple and flexible plugin to do declarative event delegation in Knockout.js", "repository": { "type": "git",