我们能强迫ZURB Foundation 4只使用jQuery而不是Zepto吗?

时间:2021-12-26 00:10:51

I am building a project using jQuery. I put in a manual reference to jQuery in ZURB Foundation 4.

我正在使用jQuery构建一个项目。我在ZURB Foundation 4中手动引用了jQuery。

I also removed

我也删除了

<script>
    document.write('<script src=' +
                   ('__proto__' in {} ? 'js/vendor/zepto' : 'js/vendor/jquery') +
                   '.js><\/script>')
</script>

from the default ZURB Foundation 4 implementation.

从默认的ZURB Foundation 4实现。

Is that okay? Or will removing the above code cause issues elsewhere in ZURB Foundation 4?

是,好吗?或者删除上面的代码会导致ZURB Foundation 4中的其他问题吗?

In other words, can we force ZURB Foundation 4 to use jQuery only, and not break it?

换句话说,我们能强迫ZURB Foundation 4只使用jQuery而不破坏它吗?

2 个解决方案

#1


6  

The snippet will always load either jQuery or Zepto, never both. So yes, of course you can only use jQuery.

这个代码片段总是加载jQuery或Zepto,而不是两者都加载。当然,你只能使用jQuery。

Zepto is a jQuery clone with fewer features, thus it is much smaller in file size. The only reason for them to still use jQuery is that Zepto doesn't have any support for any version of Internet Explorer.

Zepto是jQuery的克隆版本,它的特性更少,因此文件大小要小得多。他们仍然使用jQuery的唯一原因是Zepto不支持任何版本的Internet Explorer。

They also explain it in the documentation:

他们还在文件中解释:

Foundation JavaScript was designed to work with Zepto and jQuery right out of the gate. Zepto is not supported by all browsers, so as suggested in the Zepto documentation, you should test for compatibility and load Zepto or jQuery as necessary.

Foundation JavaScript被设计为直接使用Zepto和jQuery。Zepto不受所有浏览器的支持,因此在Zepto文档中建议,您应该测试兼容性并在必要时加载Zepto或jQuery。

#2


2  

Just as an update, this past January 2014, Zurb announced it was dropping Zepto in favor of jQuery 2 with their release of Foundation 5.

在刚刚过去的2014年1月,Zurb发布了Foundation 5,宣布将Zepto换成jQuery 2。

As they determined "... lighter file size did not translate into better performance overall," and that "... jQuery 2 has more operations per second."

当他们决定”…更小的文件大小并不能转化为更好的整体性能。jQuery 2每秒有更多的操作。

#1


6  

The snippet will always load either jQuery or Zepto, never both. So yes, of course you can only use jQuery.

这个代码片段总是加载jQuery或Zepto,而不是两者都加载。当然,你只能使用jQuery。

Zepto is a jQuery clone with fewer features, thus it is much smaller in file size. The only reason for them to still use jQuery is that Zepto doesn't have any support for any version of Internet Explorer.

Zepto是jQuery的克隆版本,它的特性更少,因此文件大小要小得多。他们仍然使用jQuery的唯一原因是Zepto不支持任何版本的Internet Explorer。

They also explain it in the documentation:

他们还在文件中解释:

Foundation JavaScript was designed to work with Zepto and jQuery right out of the gate. Zepto is not supported by all browsers, so as suggested in the Zepto documentation, you should test for compatibility and load Zepto or jQuery as necessary.

Foundation JavaScript被设计为直接使用Zepto和jQuery。Zepto不受所有浏览器的支持,因此在Zepto文档中建议,您应该测试兼容性并在必要时加载Zepto或jQuery。

#2


2  

Just as an update, this past January 2014, Zurb announced it was dropping Zepto in favor of jQuery 2 with their release of Foundation 5.

在刚刚过去的2014年1月,Zurb发布了Foundation 5,宣布将Zepto换成jQuery 2。

As they determined "... lighter file size did not translate into better performance overall," and that "... jQuery 2 has more operations per second."

当他们决定”…更小的文件大小并不能转化为更好的整体性能。jQuery 2每秒有更多的操作。