diff --git a/src/definitions/modules/checkbox.js b/src/definitions/modules/checkbox.js index 0a7c472755..2ab47f7c63 100644 --- a/src/definitions/modules/checkbox.js +++ b/src/definitions/modules/checkbox.js @@ -502,10 +502,15 @@ $.fn.checkbox = function(parameters) { trigger: { change: function() { - module.verbose('Triggering change event from programmatic change'); - $input - .trigger('change') + var + events = document.createEvent('HTMLEvents'), + inputElement = $input[0] ; + if(inputElement) { + module.verbose('Triggering native change event'); + events.initEvent('change', false, true); + inputElement.dispatchEvent(events); + } } }, diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index b75eedfbbd..d4a2151cc3 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -1302,11 +1302,14 @@ $.fn.dropdown = function(parameters) { trigger: { change: function() { var - changeEvent = document.createEvent('HTMLEvents') + events = document.createEvent('HTMLEvents'), + inputElement = $input[0] ; - module.verbose('Triggering native change event'); - changeEvent.initEvent('change', false, true); - element.dispatchEvent(changeEvent); + if(inputElement) { + module.verbose('Triggering native change event'); + events.initEvent('change', false, true); + inputElement.dispatchEvent(events); + } } }, diff --git a/src/definitions/modules/search.js b/src/definitions/modules/search.js index 73308b434c..3031291c94 100644 --- a/src/definitions/modules/search.js +++ b/src/definitions/modules/search.js @@ -209,9 +209,7 @@ $.fn.search = function(parameters) { // search shortcuts if(keyCode == keys.escape) { module.verbose('Escape key pressed, blurring search field'); - $prompt - .trigger('blur') - ; + module.trigger.blur(); } if( module.is.visible() ) { if(keyCode == keys.enter) { @@ -311,6 +309,20 @@ $.fn.search = function(parameters) { } }, + trigger: { + blur: function() { + var + events = document.createEvent('HTMLEvents'), + promptElement = $prompt[0] + ; + if(promptElement) { + module.verbose('Triggering native blur event'); + events.initEvent('blur', false, true); + promptElement.dispatchEvent(events); + } + } + }, + get: { inputEvent: function() { var