diff options
author | carson <carson@leaddyno.com> | 2022-02-17 06:53:20 -0700 |
---|---|---|
committer | carson <carson@leaddyno.com> | 2022-02-17 06:53:20 -0700 |
commit | 67b4fb2042d7d08409d31851872d2f9edbbc760c (patch) | |
tree | a1fd2d85d429834d8e0bd8ef7a33e6e202162a2b /dist/htmx.js | |
parent | 78c8abb34ad868201cb28700e426ca07620eed9c (diff) | |
download | htmx-67b4fb2042d7d08409d31851872d2f9edbbc760c.tar.gz htmx-67b4fb2042d7d08409d31851872d2f9edbbc760c.zip |
gen dist
Diffstat (limited to 'dist/htmx.js')
-rw-r--r-- | dist/htmx.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/dist/htmx.js b/dist/htmx.js index 1652986c..20484637 100644 --- a/dist/htmx.js +++ b/dist/htmx.js @@ -61,6 +61,7 @@ return (function () { disableSelector: "[hx-disable], [data-hx-disable]", useTemplateFragments: false, scrollBehavior: 'smooth', + defaultFocusScroll: false, }, parseInterval:parseInterval, _:internalEval, @@ -2060,9 +2061,13 @@ return (function () { var values = {}; var formValues = {}; var errors = []; + var internalData = getInternalData(elt); - // only validate when form is directly submitted and novalidate is not set + // only validate when form is directly submitted and novalidate or formnovalidate are not set var validate = matches(elt, 'form') && elt.noValidate !== true; + if (internalData.lastButtonClicked) { + validate = validate && internalData.lastButtonClicked.formNoValidate !== true; + } // for a non-GET include the closest form if (verb !== 'get') { @@ -2073,7 +2078,6 @@ return (function () { processInputValue(processed, values, errors, elt, validate); // if a button or submit was clicked last, include its value - var internalData = getInternalData(elt); if (internalData.lastButtonClicked) { var name = getRawAttribute(internalData.lastButtonClicked,"name"); if (name) { @@ -2255,6 +2259,10 @@ return (function () { swapSpec["show"] = showVal; swapSpec["showTarget"] = selectorVal; } + if (modifier.indexOf("focus-scroll:") === 0) { + var focusScrollVal = modifier.substr("focus-scroll:".length); + swapSpec["focusScroll"] = focusScrollVal == "true"; + } } } } @@ -2867,13 +2875,14 @@ return (function () { !bodyContains(selectionInfo.elt) && selectionInfo.elt.id) { var newActiveElt = document.getElementById(selectionInfo.elt.id); + var focusOptions = { preventScroll: swapSpec.focusScroll !== undefined ? !swapSpec.focusScroll : !htmx.config.defaultFocusScroll }; if (newActiveElt) { // @ts-ignore if (selectionInfo.start && newActiveElt.setSelectionRange) { // @ts-ignore newActiveElt.setSelectionRange(selectionInfo.start, selectionInfo.end); } - newActiveElt.focus(); + newActiveElt.focus(focusOptions); } } |