From 74f3eebd571242cb3af57999f0f3218973ec2937 Mon Sep 17 00:00:00 2001 From: jlukic Date: Thu, 8 Jan 2015 17:38:43 -0500 Subject: [PATCH] Modify use of $.proxy in checkbox --- RELEASE-NOTES.md | 1 + src/definitions/modules/checkbox.js | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index a622f8ed3..4ba1dc928 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -11,6 +11,7 @@ **Code / Build** - **Build** - `Dist/` files now have file permissions `644` by default. Can adjust in `semantic.json`. You will need to run `npm install` to add the new gulp-chmod dependency *Thanks @PeterDaveHello* - **Modules** - Remove use of deprecated `.size()` for `.length` across all modules +- **Modules** - Use of `$.proxy` swapped to native `function.call()` for performance gains **Bugs** - **Segment** - ``ui tabular menu`` now correctly aligns with attached segment when using fluid variation *Thanks @MohammadYounes* diff --git a/src/definitions/modules/checkbox.js b/src/definitions/modules/checkbox.js index df5054d2f..39e4a8a3b 100644 --- a/src/definitions/modules/checkbox.js +++ b/src/definitions/modules/checkbox.js @@ -62,13 +62,13 @@ $.fn.checkbox = function(parameters) { if( module.is.checked() ) { module.set.checked(); if(settings.fireOnInit) { - $.proxy(settings.onChecked, $input.get())(); + settings.onChecked.call($input.get()); } } else { module.remove.checked(); if(settings.fireOnInit) { - $.proxy(settings.onUnchecked, $input.get())(); + settings.onUnchecked.call($input.get()); } } module.observeChanges(); @@ -148,7 +148,7 @@ $.fn.checkbox = function(parameters) { } if(!event.ctrlKey && key == keyCode.enter) { module.verbose('Enter key pressed, toggling checkbox'); - $.proxy(module.toggle, this)(); + module.toggle.call(this); event.preventDefault(); } } @@ -243,14 +243,14 @@ $.fn.checkbox = function(parameters) { module.debug('Enabling checkbox functionality'); $module.removeClass(className.disabled); $input.prop('disabled', false); - $.proxy(settings.onEnabled, $input.get())(); + settings.onEnabled.call($input.get()); }, disable: function() { module.debug('Disabling checkbox functionality'); $module.addClass(className.disabled); $input.prop('disabled', 'disabled'); - $.proxy(settings.onDisabled, $input.get())(); + settings.onDisabled.call($input.get()); }, check: function() { @@ -260,8 +260,8 @@ $.fn.checkbox = function(parameters) { .trigger('change') ; module.set.checked(); - $.proxy(settings.onChange, $input.get())(); - $.proxy(settings.onChecked, $input.get())(); + settings.onChange.call($input.get()); + settings.onChecked.call($input.get()); }, uncheck: function() { @@ -271,8 +271,8 @@ $.fn.checkbox = function(parameters) { .trigger('change') ; module.remove.checked(); - $.proxy(settings.onChange, $input.get())(); - $.proxy(settings.onUnchecked, $input.get())(); + settings.onChange.call($input.get()); + settings.onUnchecked.call($input.get()); }, toggle: function(event) {