Mobile Safari 和 Mac 上的 Safari 之间的 JavaScript 差异?
嘿,这个问题很笼统,但我想知道 Mobile Safari 和 Mac 版 Safari 中的 Javascript 差异是什么。
我的印象是,从 Javascript 的角度来看,它们是相同的,只有 CSS/渲染方面存在一些差异。但我在 Mobile Safari 中遇到了一些在 Mac 上的常规 Safari 中不存在的 Javascript 错误。
基本上,对某些 jQuery 插件的许多调用都会返回未定义的值(根据 Mobile Safari 中的开发人员调试器)。
我遇到这些问题的网站有一个非常糟糕的前端,充满了验证错误、糟糕的 JS,并且附加了大量的 CSS。我毫不怀疑这个问题就在这段代码中的某个地方,而且我以前从未遇到过这样的问题。
我只是在解决这个问题时遇到了麻烦,因此任何关于 Javascript 引擎的一般差异的见解/链接将不胜感激。
Hey this question is pretty general, but I'm wondering what the Javascript differences are in Mobile Safari and Safari for Mac.
I was under the impression that from a Javascript perspective they are the same, with only some differences in CSS/rendering. But I am experiencing a number of Javascript errors in Mobile Safari that don't exist in regular Safari on Mac.
Basically a number of calls to certain jQuery plugins are returning undefined values (according to the developer debugger in Mobile Safari).
The website that I'm experiencing these issues on has a very lousy front end that is riddled with validation errors, lousy JS and has an enormous amount of CSS attached. I have no doubt that this issue lies somewhere in this code, and I've never experienced issues like this before.
I'm just having trouble honing in on the problem, so any insight/links as to the general differences in Javascript engines would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Javascript 本身作为核心语言,也不例外。 DOM 中存在一些未记录的显着差异,但大多数情况都是相同的。在这里您可以看到 您可以处理的事件。
我注意到的 DOM 差异与测量元素有关。例如,
getClientRects
(至少对于 Selection 或 Range)不可用。可能还有其他事情。Javascript itself, the core language, is no different. There are a few significant differences in the DOM that appear undocumented, but mostly it is all the same. Here you can see some differences in events that you can handle.
The DOM differences I noticed had to do with measuring elements. For example
getClientRects
, at least for a Selection or Range, was not available. There are probably other things.在我补充两点关于 Safari 因环境或构建而异的差异之前:Safari 可能的环境列表不仅仅是 iPod、iPhone、iMac。
我还正在处理:Windows(桌面)的 Safari 和 iMac 上iOS 模拟器中的移动 Safari。
我的 jQueryMobile + PhoneGap 应用程序在 Windows 版 Safari(桌面版)和 iMac 上的 Safari 中运行良好,但在带有 XCode 3.x 的 iMac Snow Leopard 上的 iOS 模拟器上的 Safari 中存在以下问题:
其他问题可能是以下任何一个:
对 localDb 的正确
Before I add my two cents about differences in Safari depending on environment or build: the list of possible environments for Safari is bigger than just iPod, iPhone, iMac.
I am also dealing with: Safari for Windows (desktop) and Mobile Safari in iOS Simulator on iMac.
My jQueryMobile + PhoneGap app works nicely in Safari for Windows (desktop) and Safari on iMac, but it has the following problems in Safari on iOS Simulator on iMac Snow Leopard with XCode 3.x:
That other problem could be any of:
properly