Is Zepto.js only to be used for mobile web apps or can it be used for desktop just like jQuery?
Asked Answered
A

2

12

The Zepto.js website says:

Zepto.js is a minimalist JavaScript framework for mobile WebKit browsers, with a jQuery-compatible syntax.

Is it only recommended for use with apps that will be used on mobile devices or can it also be used in traditional computer browser web apps as well? What are the downsides of doing so?

I use jQuery a lot in my regular web apps (for computer browsers) and I've realized (after finding Zepto.js) that I don't always use all of jQuery's features, so Zepto.js is perfect for what I do.

Also, why is there focus on the 'WebKit' engine? Does it not work with mobile Internet Explorer on Windows Phone 7, Firefox Mobile on Android or Opera Mobile?

EDIT: The presence of $.os.android in addition to $.os.ios indicates that there is support for non-iOS platforms, so the last question is answered!

EDIT (final): I guess the real question is "Can the Zepto.js library, intended for use on mobile WebKit-based browsers, be used as a lighter-weight alternative to jQuery for the desktop also?" The answer is no.

Archi answered 20/8, 2011 at 7:52 Comment(2)
The andoid browser is also Webkit based hence the $.os.androidManual
and the fact that it's $.os.ios and $.os.android instead of $.os.macos or $.os.windows should answer your first questionBurkle
O
14

It seems that Zepto's purpose has evolved. The site now notes :

Note that some optional features of Zepto specifically target mobile browsers; as the original project goal was to specifically provide a leaner alternative to jQuery on for the mobile web.

It lists the following as target platforms (note the inclusion of desktop browsers):

Browser support Primary (100% support)

  • Safari 6+ (Mac)
  • Chrome 30+ (Windows, Mac, Android, iOS, Linux, Chrome OS)
  • Firefox 24+ (Windows, Mac, Android, Linux, Firefox OS)
  • iOS 5+ Safari
  • Android 2.3+ Browser
  • Internet Explorer 10+ (Windows, Windows Phone)

Secondary targets (fully or mostly supported)

  • iOS 3+ Safari
  • Chrome <30
  • Firefox 4+
  • Safari <6
  • Android Browser 2.2
  • Opera 10+
  • webOS 1.4.5+ Browser
  • BlackBerry Tablet OS 1.0.7+ Browser
  • Amazon Silk 1.0+
  • Other WebKit-based browsers/runtimes

EDIT
List above updated to reflect reality as of January 2013.

Occipital answered 18/7, 2012 at 17:53 Comment(3)
Even more important to note the exclusion of Internet ExplorerHexosan
Zepto supports IE10 on Windows and Windows Mobile.Prepositor
At the time of this question it didn't. Support was added around Dec 2012.Occipital
B
28

Note: This answer is old, and not up to date anymore. Yes, Zepto started as a webkit-only, mobile-specific framework, but it has evolved since then as EBarr points out below.
So always check Zepto's website for the most up-to-date information.


Not to sound too harsh, but did you click the big button on the site to see the presentation?

You basically already answered the questions:

Yes, it's for mobile devices. Support for swipe and tap events doesn't exactly make sense on a desktop computer, where you use a mouse.

Yes, it's for WebKit specifically, because that's what's most used for mobile browsing. That means no support for IE/Firefox/Opera - mobile or desktop. As the presentation says, "No one is running IE6 on an iPhone". Most desktop-browser JS libraries exist specifically to eliminate browser differences. Zepto does the opposite.

jQuery is an offroad truck: Enormous but very capable both on- and off-road.
Zepto is a Formula-1 car: Small, fast, and built exclusively to be great on the racetrack, so it won't work right in any other situation.

Burkle answered 20/8, 2011 at 8:37 Comment(1)
I did see the presentation and that's why this question popped into my head. I guess this answers it!Archi
O
14

It seems that Zepto's purpose has evolved. The site now notes :

Note that some optional features of Zepto specifically target mobile browsers; as the original project goal was to specifically provide a leaner alternative to jQuery on for the mobile web.

It lists the following as target platforms (note the inclusion of desktop browsers):

Browser support Primary (100% support)

  • Safari 6+ (Mac)
  • Chrome 30+ (Windows, Mac, Android, iOS, Linux, Chrome OS)
  • Firefox 24+ (Windows, Mac, Android, Linux, Firefox OS)
  • iOS 5+ Safari
  • Android 2.3+ Browser
  • Internet Explorer 10+ (Windows, Windows Phone)

Secondary targets (fully or mostly supported)

  • iOS 3+ Safari
  • Chrome <30
  • Firefox 4+
  • Safari <6
  • Android Browser 2.2
  • Opera 10+
  • webOS 1.4.5+ Browser
  • BlackBerry Tablet OS 1.0.7+ Browser
  • Amazon Silk 1.0+
  • Other WebKit-based browsers/runtimes

EDIT
List above updated to reflect reality as of January 2013.

Occipital answered 18/7, 2012 at 17:53 Comment(3)
Even more important to note the exclusion of Internet ExplorerHexosan
Zepto supports IE10 on Windows and Windows Mobile.Prepositor
At the time of this question it didn't. Support was added around Dec 2012.Occipital

© 2022 - 2024 — McMap. All rights reserved.