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?

2 Answers 2

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.

5
  • 2
    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.
    – Azure
    Apr 27, 2013 at 17:37
  • 1
    @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?
    – jgillich
    Apr 27, 2013 at 19:58
  • 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.
    – Azure
    Apr 27, 2013 at 20:52
  • 1
    @user2139648 I already wrote that 5 hours ago. Is it that hard to believe that you can use only jQuery?
    – jgillich
    Apr 27, 2013 at 21:47
  • 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.
    – LocalPCGuy
    Oct 17, 2013 at 17:59
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."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.