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
querySelectorAllExt can return [null] which violates the documented return type of findAttributeTargets: (Node|Window)[]. This has upstream effects on methods like disableElements, which iterate through a collection of elements returned by findAttributeTargets, expecting each to be not null.
functionfindAttributeTargets(elt,attrName){constattrTarget=getClosestAttributeValue(elt,attrName)if(attrTarget){if(attrTarget==='this'){return[findThisElement(elt,attrName)]}else{constresult=querySelectorAllExt(elt,attrTarget)// <-- This can return [null]if(result.length===0){logError('The selector "'+attrTarget+'" on '+attrName+' returned no matches!')return[DUMMY_ELT]}else{returnresult}}}}
Context
In my application, this happens when the elt passed in to findAttributeTargets has no children and the attrTarget would yield no results. The attrName in my context is hx-disabled-elt.
Workaround
In my setup, the inherited hx-disabled-elt was causing the failed lookup. I explicitly set the hx-disabled-elt to a query selector that would return results to unblock myself.
The text was updated successfully, but these errors were encountered:
I think this was found here #2913 which i wrote a quick fix for but this fix has now been combined with an existing in progress enhancment PR #2902 which should resolve this when this is merged and released.
Summary
querySelectorAllExt
can return[null]
which violates the documented return type offindAttributeTargets
: (Node|Window)[]. This has upstream effects on methods like disableElements, which iterate through a collection of elements returned byfindAttributeTargets
, expecting each to be not null.Context
In my application, this happens when the
elt
passed in tofindAttributeTargets
has no children and theattrTarget
would yield no results. TheattrName
in my context ishx-disabled-elt
.Workaround
In my setup, the inherited
hx-disabled-elt
was causing the failed lookup. I explicitly set thehx-disabled-elt
to a query selector that would return results to unblock myself.The text was updated successfully, but these errors were encountered: