The `<template/>` element `contents` property is a document fragment that may
have a `null` `documentElement`. In Safari 16 this happens in more cases due
to recent spec changes - in particular, even if that document fragment is
explicitly adopted into an outer document. We're testing both of those cases
now.
The crash used to happen in `jQuery.contains` which is an alias for
`Sizzle.contains` in jQuery 3.x.
The Sizzle fix is at jquery/sizzle#490, released in Sizzle `2.3.8`. This
version of Sizzle is included in the parent commit.
A fix similar to the one from gh-5158 has also been applied here to the
`selector-native` version.
Fixes gh-5147
Closes gh-5159
Ref jquery/sizzle#490
Ref gh-5158