mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-30 06:21:19 +00:00
add processFocus to makeAjaxTask
This adds an additional check to makeAjaxLoadTask that focuses on the first element with the HTML standard "autofocus" attribute set. I've put it right next to the makeAjaxLoadTask function for clarity, but it should probably be organized into a different place, next to other corresponding functions.
This commit is contained in:
parent
7d83527bfb
commit
018ba7c2c2
@ -411,10 +411,18 @@ return (function () {
|
||||
return function () {
|
||||
processNode(child, true);
|
||||
processScripts(child);
|
||||
processFocus(child)
|
||||
triggerEvent(child, 'htmx:load', {});
|
||||
};
|
||||
}
|
||||
|
||||
function processFocus(child) {
|
||||
var el = child.querySelector("[autofocus]")
|
||||
if (el != null) {
|
||||
el.focus()
|
||||
}
|
||||
}
|
||||
|
||||
function insertNodesBefore(parentNode, insertBefore, fragment, settleInfo) {
|
||||
handleAttributes(parentNode, fragment, settleInfo);
|
||||
while(fragment.childNodes.length > 0){
|
||||
|
Loading…
x
Reference in New Issue
Block a user