# Any issues with Safari 16.0?

**URL:** <https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923>\
**Category:** Help Requests\
**Created:** [September 20, 2022, 8:11pm UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923 "2022-09-20T20:11:24Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![nickharrisdev](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/nickharrisdev/32/2351_2.png) [@nickharrisdev](https://discourse.aurelia.io/u/nickharrisdev)\
**Post date:** [September 20, 2022, 8:11pm UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/1 "2022-09-20T20:11:24Z")

</div>

Has anyone here run into issues with form inputs (type=“email” or type=“text” specifically) failing to register that the `value` has changed **specifically** when running an Aurelia 1 application in Safari 16.0 (the latest release)?

These are the Aurelia packages and versions I’m currently using in my application:

```
"aurelia-animator-css": "^1.0.4",
"aurelia-bootstrapper": "^2.3.3",
"aurelia-event-aggregator": "^1.0.3",
"aurelia-framework": "^1.3.1",
"aurelia-history-browser": "^1.4.0",
"aurelia-loader-nodejs": "^1.1.0",
"aurelia-notify": "^0.8.1",
"aurelia-pal": "^1.8.2",
"aurelia-pal-nodejs": "^2.0.0",
"aurelia-polyfills": "^1.3.4",
"aurelia-router": "^1.7.1",

```

My application also uses a library of custom web components based on Microsoft’s Fast, so the issue may be coming from that dependency, but I wanted to reach out here as well just in case others have dealt with this issue in the last week.

Any insights you can provide would be much appreciated! Thanks.

---

<div class="post-metadata">

**Author:** ![nenadvicentic](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/nenadvicentic/32/1191_2.png) [@nenadvicentic](https://discourse.aurelia.io/u/nenadvicentic)\
**Post date:** [September 22, 2022, 9:59am UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/2 "2022-09-22T09:59:43Z")

</div>

I’m having weird issue with Safari 16.0 (and 16.1 beta), where most of the pages in the single page app load correctly, but some of the pages do not. After navigation they just stay blank.

I see that `canActivate` event triggers on the destination page, but nothing happens afterwards. At the moment I’m not sure where exactly page cycle stops.

~~Same app works and in latest Safari on the iPhone.~~ (this was latest iOS 15)  
Same problem occurs on Safari on iOS 16.

---

<div class="post-metadata">

**Author:** ![cybk](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/cybk/32/2356_2.png) [@cybk](https://discourse.aurelia.io/u/cybk)\
**Post date:** [September 22, 2022, 2:35pm UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/3 "2022-09-22T14:35:15Z")

</div>

Having an error with routing for some of the pages on my Single Page App, for some reason some pages fail to load, even if activate or attached events run; the weird thing is that not happens with all the pages, the only error I see on console is

> [Error] ERROR [app-router] TypeError: null is not an object (evaluating ‘t.contains’)  
> error  
> value (app-bundle-73b4d7500d.js:1:189150)  
> value  
> (anonymous function) (app-bundle-73b4d7500d.js:1:188094)  
> value (app-bundle-73b4d7500d.js:1:193423)  
> value (app-bundle-73b4d7500d.js:1:188053)

I’m still investigating, it only happens with safari 16

---

<div class="post-metadata">

**Author:** ![nenadvicentic](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/nenadvicentic/32/1191_2.png) [@nenadvicentic](https://discourse.aurelia.io/u/nenadvicentic)\
**Post date:** [September 30, 2022, 5:47am UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/4 "2022-09-30T05:47:05Z")

</div>

After some investigation, for our application, issue turned to be that we use `Typeahead` auto-complete component on several input fields.

When we navigate away from the page with `Typeahead`, there was a code in `detached()` event handler that destroys the component:

```javascript
public detached() {
    // Safari 16 throws an error and stops page transition:
    $(this.myElementRef).typeahead("destroy");
}

```

To fix this, I moved `Typeahead` destruction to `deactivate()` event handler:

```javascript
public deactivate() {
    // Safari 16 throws an error and stops page transition
    // when destroying Typeahead elements in `detached()` method.
    $(this.myElementRef).typeahead("destroy");
}

```

The error was the same as in @cybk 's stack trace:

> TypeError: null is not an object (evaluating ‘n.contains’)

---

<div class="post-metadata">

**Author:** ![Isoldhe](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/isoldhe/32/2362_2.png) [@Isoldhe](https://discourse.aurelia.io/u/Isoldhe)\
**Post date:** [September 30, 2022, 7:09am UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/5 "2022-09-30T07:09:22Z")

</div>

For me the same error as @cybk was caused by the aurelia-knockout package. I created [this issue](https://github.com/aurelia-contrib/aurelia-knockout/issues/44) for it. All pages that contained the ‘knockout’ attribute crashed in Safari 16. The conclusion was that it’s caused by KnockoutJS itself. Since there hasn’t been a new release of Knockout for 3 years, it probably won’t be fixed any time soon. So we’re replacing all Knockout with Aurelia functionality.

---

<div class="post-metadata">

**Author:** ![jded](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/jded/32/1814_2.png) [@jded](https://discourse.aurelia.io/u/jded)\
**Post date:** [October 11, 2022, 5:48pm UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/6 "2022-10-11T17:48:24Z")

</div>

We have the same problem.  
I found that the first problem was with aurelia-resize and I just removed it.  
But that revealed the main problem, aurelia-kendoui-bridge. I found an issue [there](https://github.com/aurelia-ui-toolkits/aurelia-kendoui-bridge/issues/808) and I made a repo with the problem with Playwright installed so you can test it on windows.

It is very strange though that the problem appeared in many libraries…

---

<div class="post-metadata">

**Author:** ![jded](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/jded/32/1814_2.png) [@jded](https://discourse.aurelia.io/u/jded)\
**Post date:** [October 12, 2022, 12:49pm UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/7 "2022-10-12T12:49:45Z")

</div>

I searched more about this, and if I’m right the problem is that the element being destroyed has an empty document (about:blank) in the ownerDocument property. In chrome has the root document.  
I think that is the problem and every library that is trying to remove the element from the document is failing.  
Can anyone from the aurelia team have a deeper look at this problem?

---

<div class="post-metadata">

**Author:** ![nenadvicentic](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/nenadvicentic/32/1191_2.png) [@nenadvicentic](https://discourse.aurelia.io/u/nenadvicentic)\
**Post date:** [October 12, 2022, 5:50pm UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/8 "2022-10-12T17:50:49Z")

</div>

> [@jded](#):
>
> ownerDocument property

I’ve got exact same issue with TypeAhead, trying to access `ownerDocument` property throwing an error.

My guess is that this has nothing to do with Aurelia, but instead with `ownerDocument` property being deprecated in WebKit (macOS 10.3–10.14 Deprecated) as described [here](https://developer.apple.com/documentation/webkit/domnode/1517917-ownerdocument?changes=la_6_5_8&language=objc).

---

<div class="post-metadata">

**Author:** ![huochunpeng](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@huochunpeng](https://discourse.aurelia.io/u/huochunpeng)\
**Post date:** [October 13, 2022, 6:18am UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/9 "2022-10-13T06:18:28Z")

</div>

That deprecation is not for JS api, it was for Swift/Obj-C api. The whole api set is deprecated, not just the single one. [Apple Developer Documentation](https://developer.apple.com/documentation/webkit/deprecated_symbols/document_object_models_api_legacy?changes=la_6_5_8&language=objc)

The JS dom api still has ownerDocument in Safari v16.  
 ![image](https://canada1.discourse-cdn.com/flex027/uploads/aurelia/original/2X/4/4c0cef19ba17b7c3dedc9a30ad796f7af5e07968.png)

---

<div class="post-metadata">

**Author:** ![jded](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/jded/32/1814_2.png) [@jded](https://discourse.aurelia.io/u/jded)\
**Post date:** [October 13, 2022, 10:06am UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/10 "2022-10-13T10:06:21Z")

</div>

I tested with a simple aurelia page with a div with ref in the viewmodel.  
In the detached event I had a breakpoint and in Chrome it had the ownerDocument filled with the right document, but in Safari 16 it had an empty document (about:blank). You can see the differences in the pictures .  
Chrome:

 ![chrome](https://canada1.discourse-cdn.com/flex027/uploads/aurelia/original/2X/3/33fbdf96170f996aee5a7277064291b4858fe0ed.jpeg)

Safari 16:

 ![safari](https://canada1.discourse-cdn.com/flex027/uploads/aurelia/original/2X/8/87013b39292efeb3d23fa62c7739d675a0d3fc49.jpeg)

---

<div class="post-metadata">

**Author:** ![jded](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/jded/32/1814_2.png) [@jded](https://discourse.aurelia.io/u/jded)\
**Post date:** [October 13, 2022, 10:24am UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/11 "2022-10-13T10:24:44Z")

</div>

Just for reference, in the attached event the ownerDocument has the right document both in Chrome and Safari 16.

Chrome:

 ![Chrome_Attached](https://canada1.discourse-cdn.com/flex027/uploads/aurelia/original/2X/2/2e5369bb0b87346d066b9cb46cb40182b745799c.jpeg)

Safari 16:

 ![Safari_Attached](https://canada1.discourse-cdn.com/flex027/uploads/aurelia/original/2X/b/bea92e61cb43459ebe5cb64b7200dcb86fda527c.jpeg)

---

<div class="post-metadata">

**Author:** ![huochunpeng](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@huochunpeng](https://discourse.aurelia.io/u/huochunpeng)\
**Post date:** [October 13, 2022, 10:46am UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/12 "2022-10-13T10:46:43Z")

</div>

Great finding!

In Aurelia 1 we only have detached callback which happened after the element is detached from DOM tree. Aurelia 2 uses different detaching callback which happens just before the element is detached from DOM tree.

The detaching is a much more proper time point to do those cleanup logic, when the element is still on the DOM tree.

It looks Safari changed the behavior on those removed element (before they are finally garbage collected).

I think it’s not hard for Aurelia 1 to gain detaching lifecycle callback. As long as we don’t remove existing detached callback from Aurelia 1, no breaking change for user’s app. cc @bigopon

---

<div class="post-metadata">

**Author:** ![jded](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/jded/32/1814_2.png) [@jded](https://discourse.aurelia.io/u/jded)\
**Post date:** [October 13, 2022, 11:01am UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/13 "2022-10-13T11:01:59Z")

</div>

> [@huochunpeng](#):
>
> I think it’s not hard for Aurelia 1 to gain detaching lifecycle callback. As long as we don’t remove existing detached callback from Aurelia 1, no breaking change for user’s app. cc @bigopon

Yes but that means that every library has to change, to be compatible again. I don’t know if that this is the right solution.

---

<div class="post-metadata">

**Author:** ![huochunpeng](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@huochunpeng](https://discourse.aurelia.io/u/huochunpeng)\
**Post date:** [October 13, 2022, 11:36am UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/14 "2022-10-13T11:36:14Z")

</div>

But without detaching callback, right now there is no way to be compatible with Safari 16. Unless it’s a router component which has deactivate callback.

---

<div class="post-metadata">

**Author:** ![jded](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/jded/32/1814_2.png) [@jded](https://discourse.aurelia.io/u/jded)\
**Post date:** [October 17, 2022, 2:20pm UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/15 "2022-10-17T14:20:17Z")

</div>

Hi, any news from the team?  
You know, this is a problem that we have on production right now.  
Is there anything I can do to help investigating further?

---

<div class="post-metadata">

**Author:** ![beersandrew](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/beersandrew/32/2379_2.png) [@beersandrew](https://discourse.aurelia.io/u/beersandrew)\
**Post date:** [October 21, 2022, 2:02pm UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/16 "2022-10-21T14:02:44Z")

</div>

Hello,  
So happy to have found this thread, we also are experiencing this and would love to hear if there are any updates from the team, or if anyone here has come up with their own fixes for now.

---

<div class="post-metadata">

**Author:** ![huochunpeng](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@huochunpeng](https://discourse.aurelia.io/u/huochunpeng)\
**Post date:** [October 22, 2022, 10:38pm UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/17 "2022-10-22T22:38:27Z")

</div>

Thx for @jded for the github isssue [Many aurelia libraries are broken in iOS 16 · Issue #1003 · aurelia/framework · GitHub](https://github.com/aurelia/framework/issues/1003)

I have one not-so-great way to partially ignore the error. Only works for route component.

```nohighlight
<router-view swap-order="before"></router-view>

```

This swap order loads new route component before unloading old one. The exception still happens on the old component, error log still shows up in console, but it would not stop the new route from loading up.

---

<div class="post-metadata">

**Author:** ![jded](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/jded/32/1814_2.png) [@jded](https://discourse.aurelia.io/u/jded)\
**Post date:** [October 23, 2022, 8:56am UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/18 "2022-10-23T08:56:22Z")

</div>

If I’m right, the change of Safari is according to the spec. So I think the libraries must adopt the new spec to be compatible again.

For me the libraries that have problems with Safari 16+ are:

1. aurelia-resize uses **[element-resize-detector](https://github.com/wnr/element-resize-detector)** and it’s trying to access ownerDocument.body and it’s failing.
2. aurelia-kendoui-bridge uses kendo that uses jquery and I file an issue to jquery to fix the problem. I tried it and it’s working.

---

<div class="post-metadata">

**Author:** ![bonchien](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/bonchien/32/2388_2.png) [@bonchien](https://discourse.aurelia.io/u/bonchien)\
**Post date:** [November 24, 2022, 8:33pm UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/19 "2022-11-24T20:33:32Z")

</div>

Any idea the side affects? This was a quick fix for my setRoot issues with the new root not loading anything on ios 16. (I think, not fully tested but definitely allows transition to a new root)

---

<div class="post-metadata">

**Author:** ![huochunpeng](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@huochunpeng](https://discourse.aurelia.io/u/huochunpeng)\
**Post date:** [November 26, 2022, 4:05am UTC](https://discourse.aurelia.io/t/any-issues-with-safari-16-0/4923/20 "2022-11-26T04:05:58Z")

</div>

No idea about the side effects 🙂 Since it didn’t solve the exception on the previous detach, it might introduce some memory leak due to unfinished callback.
