Can we force ZURB Foundation 4 to use jQuery only, and not Zepto?
Asked Answered
J

2

5

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

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.

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

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

Jobina answered 27/4, 2013 at 13:33 Comment(0)
K
6

The snippet will always load either jQuery or Zepto, never both. So yes, of course you can only use 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.

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.

Ketty answered 27/4, 2013 at 16:37 Comment(5)
So, instead of falling back to Jquery, why not use just jquery to begin with? Also: the fallback doesnt seem to work on IE. Using just jquery in IE 9 and 10, i found that some foundation 4 plugins dont work, such as dropdown.Jobina
@user2139648 As I said, Zepto is smaller and therefore faster to load. Do the plugins work in other browsers, or do you get any JS errors?Ketty
That was my misstake...i had activex disabled. Now they're working perfectly with jquery in IE10. However, I do get "network" errors in IE console, which I dont get in other browsers. These are random. However, by and large, full jquery substitution is working perfectly in all browsers. This leads me to believe that jquery can be a near substitute for zepto under Foundation 4.Jobina
@user2139648 I already wrote that 5 hours ago. Is it that hard to believe that you can use only jQuery?Ketty
Zepto is not nearly as compatible as jQuery, and the size difference is very minimal these days, particularly with the newer versions of jQuery. I'm more concerned that they inject the script dynamically rather than allowing it to be bundled in a concatenated script file.Geosynclinal
S
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.

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

Succinct answered 30/3, 2014 at 14:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.