Skip to content

Safari 16 crashes on in-template DOM manipulation #5147

Closed
jquery/sizzle
#490

Description

@jded76

Description

After the new IOS 16, Safari changed the behavior of document.adoptNode when called on a template. It's not changing the ownerDocument any more. It leaves this on an empty document (about:blank).

This causing an error at the function contains at this line, because the documentElement property is null on an empty document (about:blank).

If you change this line from
var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode;
to
var adown = a.nodeType === 9 && a.documentElement ? a.documentElement : a, bup = b && b.parentNode;
it's working again.

More details can be found here and aurelia/framework#1003.

Link to test case

You can see the problem in this fiddler if you try it with Safari 16+.
If you press "add" and then "remove" you get the error.

Activity

  1. jded76 commented on Oct 23, 2022

    @jded76
    Author

    I made a repository if you like to test it without fiddler.

    If you change this line to use the local jquery file <script src="jquery-3.5.1.js"></script> the error is gone.

  2. added
    Discuss in MeetingReserved for Issues and PRs that anyone would like to discuss in the weekly meeting.
    on Oct 24, 2022
  3. removed
    Discuss in MeetingReserved for Issues and PRs that anyone would like to discuss in the weekly meeting.
    on Oct 24, 2022
  4. added this to the 3.6.2 milestone on Oct 24, 2022
  5. self-assigned this
    on Nov 14, 2022
  6. changed the title [-]Problem with Safari 16+[/-] [+]Safari 16 crashes on in-template DOM manipulation[/+] on Nov 14, 2022
  7. added a commit that references this issue on Nov 14, 2022
    ef2e6ab
  8. added a commit that references this issue on Nov 14, 2022
    10a1d54
  9. mgol commented on Nov 14, 2022

    @mgol
    Member

    Reopening until the fix lands in Sizzle and - then - on 3.x-stable.

  10. reopened this on Nov 14, 2022
  11. reopened this on Nov 14, 2022
  12. added a commit that references this issue on Nov 15, 2022
    19c0be1
  13. 5 remaining items

  14. reopened this on Nov 16, 2022
  15. added 6 commits that reference this issue on Nov 16, 2022
    bc78d56
    ffdd09b
    5e40c14
    bc23c1c
    a1b7ae3
    5318e31
  16. mgol commented on Nov 16, 2022

    @mgol
    Member

    Landed on main in 3299236 and on 3.x-stable in a1b7ae3 (commit updating Sizzle, includes the fix from jquery/sizzle@759acc7) & 5318e31. Closing.

  17. added a commit that references this issue on Nov 17, 2022
    f24b324
  18. added a commit that references this issue on Dec 1, 2022
    7ccd0a9
  19. added a commit that references this issue on Dec 13, 2022
    90f59ad
  20. added a commit that references this issue on Feb 2, 2024
    3299236
  21. locked as resolved and limited conversation to collaborators on Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions