Browse Source

Modify use of $.proxy in checkbox

pull/1615/head
jlukic 9 years ago
parent
commit
74f3eebd57
2 changed files with 10 additions and 9 deletions
  1. 1
      RELEASE-NOTES.md
  2. 18
      src/definitions/modules/checkbox.js

1
RELEASE-NOTES.md

@ -11,6 +11,7 @@
**Code / Build** **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* - **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** - Remove use of deprecated `.size()` for `.length` across all modules
- **Modules** - Use of `$.proxy` swapped to native `function.call()` for performance gains
**Bugs** **Bugs**
- **Segment** - ``ui tabular menu`` now correctly aligns with attached segment when using fluid variation *Thanks @MohammadYounes* - **Segment** - ``ui tabular menu`` now correctly aligns with attached segment when using fluid variation *Thanks @MohammadYounes*

18
src/definitions/modules/checkbox.js

@ -62,13 +62,13 @@ $.fn.checkbox = function(parameters) {
if( module.is.checked() ) { if( module.is.checked() ) {
module.set.checked(); module.set.checked();
if(settings.fireOnInit) { if(settings.fireOnInit) {
$.proxy(settings.onChecked, $input.get())();
settings.onChecked.call($input.get());
} }
} }
else { else {
module.remove.checked(); module.remove.checked();
if(settings.fireOnInit) { if(settings.fireOnInit) {
$.proxy(settings.onUnchecked, $input.get())();
settings.onUnchecked.call($input.get());
} }
} }
module.observeChanges(); module.observeChanges();
@ -148,7 +148,7 @@ $.fn.checkbox = function(parameters) {
} }
if(!event.ctrlKey && key == keyCode.enter) { if(!event.ctrlKey && key == keyCode.enter) {
module.verbose('Enter key pressed, toggling checkbox'); module.verbose('Enter key pressed, toggling checkbox');
$.proxy(module.toggle, this)();
module.toggle.call(this);
event.preventDefault(); event.preventDefault();
} }
} }
@ -243,14 +243,14 @@ $.fn.checkbox = function(parameters) {
module.debug('Enabling checkbox functionality'); module.debug('Enabling checkbox functionality');
$module.removeClass(className.disabled); $module.removeClass(className.disabled);
$input.prop('disabled', false); $input.prop('disabled', false);
$.proxy(settings.onEnabled, $input.get())();
settings.onEnabled.call($input.get());
}, },
disable: function() { disable: function() {
module.debug('Disabling checkbox functionality'); module.debug('Disabling checkbox functionality');
$module.addClass(className.disabled); $module.addClass(className.disabled);
$input.prop('disabled', 'disabled'); $input.prop('disabled', 'disabled');
$.proxy(settings.onDisabled, $input.get())();
settings.onDisabled.call($input.get());
}, },
check: function() { check: function() {
@ -260,8 +260,8 @@ $.fn.checkbox = function(parameters) {
.trigger('change') .trigger('change')
; ;
module.set.checked(); 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() { uncheck: function() {
@ -271,8 +271,8 @@ $.fn.checkbox = function(parameters) {
.trigger('change') .trigger('change')
; ;
module.remove.checked(); 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) { toggle: function(event) {

Loading…
Cancel
Save