I'd like to talk about the possibly of supporting Zepto.js in core Javascript.

Zepto's API is designed to mimic jQuery's. The main difference is that Zepto has a strict focus on mobile/modern browsers and isn't as extensive as jQuery.

On some projects it would be desirable to swap out jQuery for Zepto, doing this right now would cause all core Javascript to stop working so you'd need to disable all of it.

It's simple for Javascript files to support both jQuery and Zepto, assuming that the files don't use jQuery only functions. An example is Garlic.js.

})(window.jQuery || window.Zepto);

I'm not saying we add Zepto to core, I just think it's worth exploring to see how easily we can achieve support.

Files: 
CommentFileSizeAuthor
#3 core-1996720-zepto-support.patch58.04 KBLewisNyman

Comments

nod_’s picture

this would validate everything we've been doing with core js for the past year. might be tricky though.

1. use zepto to replace jQuery
2. list what breaks
3. address each point one by one

there is probably going to be #1931632: [META] Make CORE compatible with jQuery native-API selector in the list.

nod_’s picture

I'd start in this order:

  1. jquery.once.js
  2. ajax.js
  3. form.js
  4. autocomplete.js
  5. vertical-tabs.js
  6. tableheader.js
  7. everything else in core/misc/
  8. The rest of modules (except views, that should be straightforward)
LewisNyman’s picture

StatusFileSize
new58.04 KB

Here's a patch for testing purposes, it modifies jquery.once.js and ajax.js

nod_’s picture

I'd even put a jQuery = Zepto somewhere, might be faster to spot issues like that than carefully testing one by one :) I'll see if I have time to have a look this week-end.

kevinquillen’s picture

I'm sure you are aware of this, but with Zepto:

If you need to support Internet Explorer, you can fall back on jQuery.

Zepto does not work in Internet Explorer, you'd still need jQuery to have a functional website for those users. How would both libraries be supported for everyone?

nod_’s picture

this issue is about being nice to contrib. not really for core to officially support it.

LewisNyman’s picture

Issue summary:View changes
Issue tags:+frontend
LewisNyman’s picture

Priority:Normal» Minor
Status:Active» Closed (won't fix)

Going to put this down as won't fix because we already have issues to make Drupal less dependant on jQuery, no need to give special treatment to a specific library.