-
Notifications
You must be signed in to change notification settings - Fork 20.6k
Selector:Manipulation: Fix DOM manip within template contents #5158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. As it turns out, we don't need to query the supposed container `documentElement` if it has the `Node.DOCUMENT_NODE` (9) `nodeType`; we can call `.contains()` directly on the `document`. That avoids the crash. Fixes jquerygh-5147
gibson042
approved these changes
Nov 14, 2022
timmywil
approved these changes
Nov 14, 2022
mgol
added a commit
that referenced
this pull request
Nov 14, 2022
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`. As it turns out, we don't need to query the supposed container `documentElement` if it has the `Node.DOCUMENT_NODE` (9) `nodeType`; we can call `.contains()` directly on the `document`. That avoids the crash. Fixes gh-5147 Closes gh-5158
mgol
added a commit
to mgol/sizzle
that referenced
this pull request
Nov 15, 2022
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 above behavior made `Sizzle.contains` crash when run on certain elements within the `<template/>` element. As it turns out, we don't need to query the supposed container `documentElement` if it has the `Node.DOCUMENT_NODE` (9) `nodeType`; we can call `.contains()` directly on the `document`. That avoids the crash. However, we still need to fall back to `documentElement` if one is defined as IE <9 have a broken `.contains()` on the document. Fixes jquery/jquery#5147 Ref jquery/jquery#5158
Landed on |
mgol
added a commit
to mgol/jquery
that referenced
this pull request
Nov 15, 2022
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. This PR pulls the new Sizzle version into jQuery's `3.x-stable` branch and backports one test from jquerygh-5158. Fixes jquerygh-5147 Ref jquery/sizzle/pull/490 Ref jquerygh-5158
3 tasks
mgol
added a commit
to jquery/sizzle
that referenced
this pull request
Nov 16, 2022
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 above behavior made `Sizzle.contains` crash when run on certain elements within the `<template/>` element. As it turns out, we don't need to query the supposed container `documentElement` if it has the `Node.DOCUMENT_NODE` (9) `nodeType`; we can call `.contains()` directly on the `document`. That avoids the crash. However, we still need to fall back to `documentElement` if one is defined as IE <9 have a broken `.contains()` on the document. Fixes jquery/jquery#5147 Closes gh-490 Ref jquery/jquery#5158
mgol
added a commit
to mgol/jquery
that referenced
this pull request
Nov 16, 2022
mgol
added a commit
to mgol/jquery
that referenced
this pull request
Nov 16, 2022
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. This PR pulls the new Sizzle version into jQuery's `3.x-stable` branch and backports one test from jquerygh-5158. Fixes jquerygh-5147 Closes jquerygh-5159 Ref jquery/sizzle#490 Ref jquerygh-5158
mgol
added a commit
to mgol/jquery
that referenced
this pull request
Nov 16, 2022
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. Fixes jquerygh-5147 Closes jquerygh-5159 Ref jquery/sizzle#490 Ref jquerygh-5158
mgol
added a commit
to mgol/jquery
that referenced
this pull request
Nov 16, 2022
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 jquerygh-5158 has also been applied here to the `selector-native` version. Fixes jquerygh-5147 Closes jquerygh-5159 Ref jquery/sizzle#490 Ref jquerygh-5158
mgol
added a commit
that referenced
this pull request
Nov 16, 2022
mgol
added a commit
that referenced
this pull request
Nov 16, 2022
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
mgol
added a commit
to mgol/jquery
that referenced
this pull request
Nov 17, 2022
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`. As it turns out, we don't need to query the supposed container `documentElement` if it has the `Node.DOCUMENT_NODE` (9) `nodeType`; we can call `.contains()` directly on the `document`. That avoids the crash. Fixes jquerygh-5147 Closes jquerygh-5158 (cherry picked from commit 3299236)
mgol
added a commit
to mgol/jquery
that referenced
this pull request
Dec 1, 2022
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`. As it turns out, we don't need to query the supposed container `documentElement` if it has the `Node.DOCUMENT_NODE` (9) `nodeType`; we can call `.contains()` directly on the `document`. That avoids the crash. Fixes jquerygh-5147 Closes jquerygh-5158 (cherry picked from commit 3299236)
mgol
added a commit
to mgol/jquery
that referenced
this pull request
Dec 13, 2022
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`. As it turns out, we don't need to query the supposed container `documentElement` if it has the `Node.DOCUMENT_NODE` (9) `nodeType`; we can call `.contains()` directly on the `document`. That avoids the crash. Fixes jquerygh-5147 Closes jquerygh-5158 (cherry picked from commit 3299236)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The
<template/>
elementcontents
property is a document fragment that mayhave a
null
documentElement
. In Safari 16 this happens in more cases dueto 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
. As it turns out, we don't needto query the supposed container
documentElement
if it has theNode.DOCUMENT_NODE
(9)nodeType
; we can call.contains()
directly onthe
document
. That avoids the crash.Fixes gh-5147
-18 bytes
Checklist
If needed, a docs issue/PR was created at https://github.com/jquery/api.jquery.com