Skip to content

Commit

Permalink
feat: disable <select> elements on change (#133)
Browse files Browse the repository at this point in the history
* feat: disable <select> elements on change

* linting
  • Loading branch information
KonnorRogers authored Sep 25, 2021
1 parent db8ba61 commit fccbb00
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/elementDisabler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ export function ElementDisabler (): MrujsPluginInterface {
}

function queries (): EventQueryInterface[] {
const { formSubmitSelector, linkClickSelector, buttonClickSelector } = window.mrujs.querySelectors
const { formSubmitSelector, linkClickSelector, buttonClickSelector, inputChangeSelector } = window.mrujs.querySelectors

return [
{ event: 'click', selectors: [buttonClickSelector.selector, linkClickSelector.selector] },
{ event: 'ajax:send', selectors: [formSubmitSelector.selector] }
{ event: 'ajax:send', selectors: [formSubmitSelector.selector] },
{ event: 'change', selectors: [inputChangeSelector.selector] }
]
}

Expand Down
5 changes: 3 additions & 2 deletions src/elementEnabler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ export function ElementEnabler (): MrujsPluginInterface {
}

function queries (): EventQueryInterface[] {
const { formSubmitSelector, buttonDisableSelector, linkDisableSelector } = window.mrujs.querySelectors
const { formSubmitSelector, buttonDisableSelector, linkDisableSelector, inputChangeSelector } = window.mrujs.querySelectors

const selectors = [linkDisableSelector.selector, buttonDisableSelector.selector, formSubmitSelector.selector]
const selectors = [linkDisableSelector.selector, buttonDisableSelector.selector,
formSubmitSelector.selector, inputChangeSelector.selector]
return [
{ event: AJAX_EVENTS.ajaxComplete, selectors: selectors },
{ event: AJAX_EVENTS.ajaxStopped, selectors: selectors }
Expand Down

0 comments on commit fccbb00

Please sign in to comment.