我想在需要在iOS,Android和Windows Phone 7上工作的移动Web项目中使用Xui.js。文档(http://xuijs.com/)有点不清楚不同的版本包括什么。“IE&IE Mobile”版本也包括“WebKit / Firefox / Opera”版本?

如果不是,推荐的图书馆的方式是什么?我考虑使用条件注释,如果需要,请包括不同版本。例如

<!--[if IE]>
<script src="xui-ie.js"></script>
<!-- <![endif]-->

<!--[if !IE]>
<script src="xui.js"></script>
<!-- <![endif]-->    
.

有帮助吗?

解决方案

I haven't investigated this much myself yet, but I've found others approaching it conditionally, like you: http://danny-t.co.uk/index.php/2012/03/10/conditionally-loading-xui-js-for-webkit-blackberry-or-ie/

Having quickly looked at the source of the ie- and the webkit/ff/opera-version it appears that the IE-version is somewhat tailored for IE, and will have issues if used on the other engines.

An example is the implementation of on in the IE-version, that uses attachEvent which is IE-only (maybe also Opera), and so wouldn't work on FF, Safari etc.

So in my opinion, it does look like you're on the right path.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top