🌐 AI搜索 & 代理 主页
Skip to content

Safari 16 crashes on in-template DOM manipulation #5147

@jded76

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions