You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In one of my extensions I use internal method htmx.swap(). I also use head support extension as well. head-support extension has below code where it tap into htmx:afterSwap. It try to access the evt.detail.xhr and it's null in my case because I used htmx.swap() inside my extension.. I think we should execute head-support only if it has a valid xhr responce. a simple null check would do?
htmx.defineExtension("head-support", {
init: function(apiRef) {
// store a reference to the internal API.
api = apiRef;
htmx.on('htmx:afterSwap', function(evt){
var serverResponse = evt.detail.xhr.response;
if (api.triggerEvent(document.body, "htmx:beforeHeadMerge", evt.detail)) {
mergeHead(serverResponse, evt.detail.boosted ? "merge" : "append");
}
})
htmx.on('htmx:historyRestore', function(evt){
if (api.triggerEvent(document.body, "htmx:beforeHeadMerge", evt.detail)) {
if (evt.detail.cacheMiss) {
mergeHead(evt.detail.serverResponse, "merge");
} else {
mergeHead(evt.detail.item.head, "merge");
}
}
})
htmx.on('htmx:historyItemCreated', function(evt){
var historyItem = evt.detail.item;
historyItem.head = document.head.outerHTML;
})
}
});
The text was updated successfully, but these errors were encountered:
In one of my extensions I use internal method htmx.swap(). I also use head support extension as well. head-support extension has below code where it tap into htmx:afterSwap. It try to access the evt.detail.xhr and it's null in my case because I used htmx.swap() inside my extension.. I think we should execute head-support only if it has a valid xhr responce. a simple null check would do?
The text was updated successfully, but these errors were encountered: