I took a look on the Zurb Foundation 3 JS files. I saw that the minified file foundation.min.js has included jQuery 1.8.x and the modernizr. But you load in the template configuration additionally jQuery and modernizr.

Comments

chrisjlee’s picture

@Neofelis1985 respectfully, could you read your last sentence and explain that you mean by that?

alexander.sibert’s picture

I mean following. I installed this theme here http://www.neofelis.de/drupal/

You see in the end of source code following load JavaScripts:

<script type="text/javascript" src="http://www.neofelis.de/drupal/sites/all/themes/zurb-foundation/js/jquery.js?v=1.8.2"></script>
<script type="text/javascript" src="http://www.neofelis.de/drupal/misc/jquery.once.js?v=1.2"></script>
<script type="text/javascript" src="http://www.neofelis.de/drupal/misc/drupal.js?meo5gn"></script>
<script type="text/javascript" src="http://www.neofelis.de/drupal/misc/jquery.cookie.js?v=1.0"></script>
<script type="text/javascript" src="http://www.neofelis.de/drupal/sites/default/files/languages/de_FJZ6HnlMvDniqoAXmD7iT6W4ZpgJVjOGG_R-TqEO1DM.js?meo5gn"></script>
<script type="text/javascript" src="http://www.neofelis.de/drupal/sites/all/modules/panels/js/panels.js?meo5gn"></script>
<script type="text/javascript" src="http://www.neofelis.de/drupal/modules/toolbar/toolbar.js?meo5gn"></script>
<script type="text/javascript" src="http://www.neofelis.de/drupal/sites/all/themes/zurb-foundation/js/modernizr.foundation.js?meo5gn"></script>
<script type="text/javascript" src="http://www.neofelis.de/drupal/sites/all/themes/zurb-foundation/js/foundation.min.js?meo5gn"></script>
<script type="text/javascript" src="http://www.neofelis.de/drupal/sites/all/themes/zurb-foundation/js/app.js?meo5gn"></script>

The foundation.min.js has jQuery Framework and modernizr included. In my example we loading double jQuery and modernizr.

chrisjlee’s picture

Title: Double jQuery 1.8 and modernizr » jQuery 1.8 and modernizr loaded twice
Assigned: alexander.sibert » Unassigned

Are you using a subtheme and what version?

alexander.sibert’s picture

I using the subtheme in current dev release version.

ishmael-sanchez’s picture

Category: bug » support
Status: Needs work » Fixed

@neofelis1985 thanks for the note. Have you actually downloaded the http://foundation.zurb.com/download.php and looked at the HTML structure. Unless I'm missing something it's the same as the theme and this theme is used and production so I didn't notice any issues and that's how it is when you download from the foundation website (See code below) so I just think you might be concerned over nothing unless I'm missing something. If you have an issue related to foundation code kindly file issues in their github queue.

  <script src="javascripts/modernizr.foundation.js"></script>
  <!-- Included JS Files (Compressed) -->
  <script src="javascripts/jquery.js"></script>
  <script src="javascripts/foundation.min.js"></script>
  

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

johnvb’s picture

Category: support » bug
Status: Closed (fixed) » Active

I'm seeing a similar issue using the dev version downloaded today (I'm not using a subtheme as I'm only just starting development of the site).
In the HTML page output, I can see the following script definitions:

<script type="text/javascript" src="http://localhost/wdcs/sites/all/themes/zurb-foundation/js/jquery.js?v=1.8.2"></script>
...
<script type="text/javascript" src="http://localhost/wdcs/sites/all/themes/zurb-foundation/js/foundation.min.js?miiire"></script>

The problem is that foundation.min.js contains the jQuery library code. So, jQuery is being initialised twice. This causes a problem because I'm using drupal_add_library to include the jQuery UI datepicker component and the js file for this appears in the list of js files in the HTML, between the jquery.js script reference and the foundation.min.js script reference. Therefore, jQuery gets loaded, the datepicker plugin gets added, and foundation.min.js reloads jQuery thus obliterating the jQuery plugin.

derMatze’s picture

In addition to this, the current foundation release contains jquery 1.9(!) included in the foundation.min.js and that causes the drupal overlay to crash, as it is not compatible with jquery >=1.9...

ishmael-sanchez’s picture

Assigned: Unassigned » ishmael-sanchez
Status: Active » Needs work

@johnvb I see what's going on. If I get rid of adding jquery.js there is no way for the sub theme to override and no check for the jQuery update module. If I dump foundation.min.js foundation elements wont work. I think it might be best to remove them both from the repo (and actually they shouldn't be there anyway) and force themers to make decisions based on their use case/project. Thoughts?

Also, FYI to complicate things there is good possibility Foundation 4 won't use jQuery but a different JS library...

@derMatze please review the project page as it has ways of dealing with different jQuery versions (#1779484: Depends on jquery 1.7).

derMatze’s picture

#1779484: Depends on jquery 1.7 is about how to deal with "normal" included jquery versions. But this one (1.9) is implemented from within the foundation.js as mentioned above.
But if you just cut this part from the foundation.js file, everything should be ok :).

ishmael-sanchez’s picture

@derMatze thanks for your note. Well, that means I would have to maintain my own foundation.js file without it or I have to include the files individually in the info file? Suggestions?

derMatze’s picture

I'm pretty sure, that foundation.min.js doesn't need to be included at all, as it just includes the other js files within one file:
- Modernizr
- jquery
- jquery custom forms
- jquery event move
...

All these files are still as single js files in javascripts folder.

ishmael-sanchez’s picture

Status: Needs work » Fixed

@derMatze good point. For now I'm just removing the duplicate jQuery and Modernizr from foundation.min.js once Foundation 4 comes out I might restructure thanks for the input.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Knarf31’s picture

Version: 7.x-1.x-dev » 7.x-1.0-alpha1
Status: Closed (fixed) » Needs work

Right now i'm in the "tweaking" and "optimizing" phase on my latest project and i just noticed, that this is still (or again) an issue:

The foundation.min.js in the 1.0-alpha1 release contains a minified jquery 1.8. version.
This was causing *no* errors or bugs so far but by deleting this unnecessary code (jquery and modernizr) i was able to reduce the foundation.min.js file size by roughly 120kb and everything is working flawlessly.

kevinquillen’s picture

Status: Needs work » Closed (fixed)

ishmael has indicated it was fixed in dev- therefore the change won't be in alpha1 until another release is created. I believe focus is on 4.x branch now (Foundation 4).

kevinquillen’s picture

Version: 7.x-1.0-alpha1 » 7.x-1.x-dev