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
{{ message }}
Repository navigation
Throw a better error when documentElement is missing #458
PR #439 made Sizzle crash earlier on a documentElement-missing document. However, we want selection to work on nodes inside of a <template> element for which ownerDocument will point to a document fragment with a nulldocumentElement. As @gibson042 said in #452:
We discussed in-meeting and had rough consensus that the right behavior was to stop at a disconnected fragment but to traverse up through a fragment's <template> host when one exists. But unfortunately, it seems difficult and maybe impossible to differentiate the two. My ideal change would instead be to tolerate null documentElement, but more changes will be required for that.
Activity
mgol commentedon Sep 7, 2023
For the record, the same code exists in jQuery 3.x:
https://github.com/jquery/jquery/blob/f79d5f1a337528940ab7029d4f8bbba72326f269/src/selector.js#L505-L512
but we're unlikely to touch it there. jQuery 4.x code already doesn't have this check:
https://github.com/jquery/jquery/blob/42e50f8c21fbfd08092ad81add4ac38982ef0841/src/selector.js#L325-L332
and it doesn't result in an automatic crash as
setDocumentin jQuery 4.x will be much, much simpler.