Zepto.js is a minimalist JavaScript library for modern browsers, with a jQuery-compatible API

Overview

Zepto.js – a minimalist JavaScript library

Zepto is a minimalist JavaScript library for modern browsers with a largely jQuery-compatible API. If you use jQuery, you already know how to use Zepto.

See zeptojs.com for an extended introduction, downloads and documentation.

Zepto.js is licensed under the terms of the MIT License.

Want to give us money or a tip? Don't. Instead please donate to charity: water.

Building

Build Status

The official site offers a download of the default distribution of Zepto. This is good for starting out. However, at some point you might want to add some optional modules and remove some of the default ones you don't need, to keep the size at a minimum. That's when you need to check out Zepto's source code and use the build commands.

You will need Node.js installed on your system.

$ npm install
$ npm run-script dist

# do a custom build
$ MODULES="zepto event data" npm run-script dist

# on Windows
c:\zepto> SET MODULES=zepto event data
c:\zepto> npm run-script dist

The resulting files are:

  1. dist/zepto.js
  2. dist/zepto.min.js

If you install CoffeeScript globally, you can run make directly:

# one-time operation
$ npm install coffee-script --global

$ coffee make dist
$ MODULES="zepto event data ..." ./make dist

# on Windows
c:\zepto> SET MODULES=zepto event data
c:\zepto> coffee make dist

Zepto modules

Zepto modules are individual files in the "src/" directory.

module default description
zepto Core module; contains most methods
event Event handling via on() & off()
ajax XMLHttpRequest and JSONP functionality
form Serialize & submit web forms
ie Support for Internet Explorer 10+ on the desktop and Windows Phone 8
detect Provides $.os and $.browser information
fx The animate() method
fx_methods Animated show, hide, toggle, and fade*() methods.
assets Experimental support for cleaning up iOS memory after removing image elements from the DOM.
data A full-blown data() method, capable of storing arbitrary objects in memory.
deferred Provides $.Deferred promises API. Depends on the "callbacks" module.
callbacks Provides $.Callbacks for use in "deferred" module.
selector Experimental jQuery CSS extensions support for functionality such as $('div:first') and el.is(':visible').
touch Fires tap– and swipe–related events on touch devices. This works with both `touch` (iOS, Android) and `pointer` events (Windows Phone).
gesture Fires pinch gesture events on touch devices
stack Provides andSelf & end() chaining methods
ios3 String.prototype.trim and Array.prototype.reduce methods (if they are missing) for compatibility with iOS 3.x.

Contributing

Please read our contribution guidelines for information on how to contribute.

Get in touch:

Write documentation

Zepto docs are written in Markdown and live in the "gh-pages" branch. They are published on zeptojs.com.

You can use GitHub's web interface to make quick changes to documentation for specific Zepto features (example: ajaxSettings). This will submit a pull request to us that we can review.

Report a bug

  1. Check if the bug is already fixed in the master branch since the last release.
  2. Check existing issues. Open a new one, including exact browser & platform information. For better formatting of your report, see GitHub-flavored Markdown.

Running tests

You will need to install PhantomJS. On OS X, that's easy:

$ brew install phantomjs

To run the automated tests:

$ npm test

To run a test server, which you can hit with your browsers and devices:

$ npm start

Go to http://your-ip-address:3000/ on your browser and follow the instructions. For your convenience test failures and exceptions will be reported to the the console you started the test server in (as well as the browser console if available).

Comments
  • Feature Request: $.Deferred

    Feature Request: $.Deferred

    I'd like to get JavaScriptMVC running on Zepto. I've got most of it working except for those areas around use of $.Deferred.

    Are Deferreds something you guys are looking to add to Zepto? I can get it working if there is interest. Thanks!

    Feature Plugin Needs tests 
    opened by justinbmeyer 48
  • IE 10 Support

    IE 10 Support

    Hello there!

    I've implemented a very basic IE support module that requires two lines in zepto.js to be changed. It works by adding the proto property to Object and referencing it to the objects prototype. I have only done quick testing of the code and found that everything works fine in currently supported browsers and I've only noticed a few animation problems in IE10. I would like to point out that I'm only targeting IE10 since I am in full support of sticking to modern browsers and IE10 is a modern browser with a growing number of users so supporting IE10 with this small module that adds only a few lines of code would be a good move for Zepto. I would like to run a full suite of tests on IE but I'm currently working on projects that require my time and I only made this because of the reasons stated above.

    I hope you like what you see and include the commits to the Zepto master branch.

    UPDATE: updated the IE module to handle everything. No core file changes are required to make IE work. detect.js and make file are changed to include IE detection and include the IE module by default to support IE10.

    UPDATE2: here is a jsfiddle of the minified Zepto.js with IE support showing the snow example working in all modern browsers.

    UPDATE3: change the snow example so that the main Zepto.js would be fetched from the website. http://jsfiddle.net/zGKjU/ http://fiddle.jshell.net/zGKjU/show/

    Regards Stefan Andres Charsley

    opened by charsleysa 42
  • Zepto incompatible with Bootstrap 3

    Zepto incompatible with Bootstrap 3

    I was using happily Bootstrap 2 with Zepto, integrated thorugh require.js.

    Today I've tried to integrate Bootstrap 3 (very recently released as RC1) with Zepto. It seems to work for basic things, but if failed when I tried to use the "responsive navbars" feature of Bootstrap 3 : http://twitter.github.io/bootstrap/components/#navbar-responsive If you resize the screen to a small width, the navbar collapses into a button. If you click this button, it should display the menu. It works correctly when using jQuery, but does not when using Zepto v1.0-1-ga3cab6c instead. It gives the following error message : TypeError: str is undefined at line 103 of zepto.js (my line numbers are probably not accurate because I added lines to integrate zepto with require.js). Anyway, it is in function dasherize : return str.replace(/::/g, '/')

    If I put a breakpoint on this line, I see it is called by line 657 of bootstrap.js (again, line number not accurate) : var option = data ? 'toggle' : $this.data() It is in under comment // COLLAPSE DATA-API

    I think it might simply come from the fact that jQuery handles a call of data() with no arguments. In this case, it seems to return a list of the data elements : http://api.jquery.com/data/ And it seems that Zepto does not support a call to data() with no arguments, because the first instruction of this function is : var data = this.attr('data-' + dasherize(name), value)

    opened by mossroy 23
  • Add AMD to Zepto

    Add AMD to Zepto

    Very usefull, when we want to choose between Jquery or Zepto on the client side:

    define.amd.jQuery = true;
    
    define([
      RegExp(" AppleWebKit/").test(navigator.userAgent)? 'zepto' : 'jquery'
    ], function($){
      $(function(){
        $('#main').text('Hello World !!!');
      });
    });
    
    Feature Discuss 
    opened by Filirom1 23
  • Final comment about browserify and JS module loaders

    Final comment about browserify and JS module loaders

    It's clear that Zepto developers don't want to add support for JS loaders (other than the classical old-school <script src='js/zepto.js'></script>). It is also clear that Zepto developers don't even want to talk about it since they have closed (and avoided more comments in them) all the related issues: #955 #948 #900 #872 #751 #342.

    This issue will be ignored anyhow, but let me recommend you reading the browserify-handbook. May be that enlighten you and you stop arguing that "zepto is for browsers, not for Node".

    Said that, it is very sad that you don't know what AMD or CommonJS is, and you force users to add an ugly <script> tag in order to use your library, like 10 years ago. So sad.

    Your main argument is that "that stuff is hard to maintain". Let me show you how easy is to build a JS package suitable for Node (via require()) and the browser (via classic <script>tag, via AMD or via CommonJS):

    https://github.com/ibc/eventcollector

    • The source code is placed within the lib/ folder, and it is "Node" code.
    • A grunt task invokes browserify which builds build/eventcollector.bundle.js, which basically is the code in lib/ plus the additions of browserify to automatically make it suitable for ANY kind of usage in the browser (via AMD, via CommonJS or via a global window.XXXXX by loading it with a <script> tag).

    -1 developers. Read and learn.

    opened by ibc 21
  • Add semicolon at the end of the zepto.js build

    Add semicolon at the end of the zepto.js build

    Zepto's lack of semicolons was causing me trouble when concating with other files (namely underscore). I was ending up with something like this:

    })(Zepto)
    // End of zepto
    // Start of underscore.js
    (function () {
    

    Which obviously causes issues. Putting in a final semicolon at the end lets zepto play nice with other scripts.

    opened by natefaubion 21
  • Zepto 1.1 selector test is 1.8x slower in Firefox 26 than Firefox 25

    Zepto 1.1 selector test is 1.8x slower in Firefox 26 than Firefox 25

    The following Zepto 1.0 vs 1.1 selector test is 1.8x slower in Firefox 26 than Firefox 25:

    http://jsperf.com/zepto-1-0-vs-1-1-performance/7

                            Zepto11     Zepto10     jQuery
    Firefox 25 (Release)    51,096      23,655      31,849 (operations/second)
    Firefox 26 (Beta)       29,456!     18,049      30,025
    Firefox 27 (Aurora)     28,984      20,318      35,839
    Firefox 28 (Nightly)    29,345      19,636      36,649
    

    The primary problem is that the zepto.Z function overrides dom.__proto__, which prevents many JIT optimizations. Overriding an object's __proto__ property is strongly discouraged and will be deprecated in ES6.

    For more information, please see Firefox bug 947048 for Mozilla developers' discussion this particular Zepto test regression.

    opened by cpeterso 20
  • Officially adding Zepto to NPM

    Officially adding Zepto to NPM

    I just reached out to the NPM support team, and we freed up the zepto name.

    Would your team like to help make zepto CommonJS compliant for use with browserify and webpack? And perhaps take over the npm module?

    opened by ChrisAntaki 19
  • Remove __proto__ use from zepto.

    Remove __proto__ use from zepto.

    This addresses #970 removing the need to use __proto__ by relying on a technique that more closely resembles jQuery. This also avoids emerging ES6 issues and removes the need for an IE<11 fallback.

    The gzipped size remains the same and there looks to be nice perf wins too.

    opened by ghost 19
  • Problem with Browserify support?

    Problem with Browserify support?

    I'm a user of Browserify. I found they don't work well with each other. Since there's module on NPM, I suppose it works with Node or something. But as I compiled the code with browserify, I found that there's still Zepto global variable. Meanwhile $ = require "zepto" doesn't work as supposed. So, Zepto is not competible with Browserify yet, how about adding support for it?

    opened by tiye 19
  • Binding blur events seems not working under backbone.js

    Binding blur events seems not working under backbone.js

    Below is a test app, which works under jQuery but not current Zepto(v1.0rc).

    ==== index.html=====

        <!DOCTYPE html>
        <title>Zepto vs. blur</title>
        <link rel="stylesheet" type="text/css" href="app.css">
        <!--script src="http://code.jquery.com/jquery-1.7.2.min.js"></script-->
        <script src="http://cdnjs.cloudflare.com/ajax/libs/zepto/1.0rc1/zepto.min.js"></script>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js"></script>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.2/backbone-min.js"></script>
    
    
        <ul></ul>
    
        <script type="text/template" id="view">
            <label>Interface:&nbsp;
                <input type="text" name="interface" autofocus value="<%-interface%>">
            </label>
            <label>Port:&nbsp;
                <input type="number" min="1025" max="32768" name="port" value="<%-port%>">
            </label>
            <label>Location:&nbsp;
                <input type="text" list="locations" name="location"
                       value="<%-location%>">
                <datalist id="locations">
                    <option value="<set location>">
                    <option value="primary">
                    <option value="secondary">
                    <option value="primary-alt">
                    <option value="secondary-alt">
                </datalist>
            </label>
            <button class="button delete">X</button>
        </script>
    
        <script src="app.js"></script>
    

    ===== index.html ====

    
    ===== app.js =======
    var Record, Records, RecordView, RecordListView;
    
    Record = Backbone.Model.extend({
        defaults: {
            interface: "eth0",
            port: 1700,
            location: ""
        }
    });
    
    Records = Backbone.Collection.extend({
        model: Record
    });
    
    
    RecordView = Backbone.View.extend({
        tagName: 'li',
        className: 'view',
        template: _.template($('#view').html()),
    
        events: {
            "click .button": "delRec",
            "blur input": "updModel"
        },
    
        initialize: function (opts) {
            console.assert(opts && opts.records);
            this.records = opts.records;
        },
    
        updModel: function(event) {
            var attrs = {};
            attrs[event.target.name] = event.target.value;
    
            if(this.model) {
                this.model.set(attrs);
            } else {
                this.model = new Record(attrs);
                this.records.add(this.model);
            }
    
            this.$('.button').show();
        },
    
        delRec: function() {
            this.$el.remove();
            this.records.remove(this.model);
        },
    
        render: function() {
            var data = (this.model && this.model.toJSON()) || Record.prototype.defaults;
            this.$el.html(this.template(data));
    
            if(!this.model) this.$('.button').hide();
    
            return this;
        }
    });
    
    RecordListView = Backbone.View.extend({
        initialize: function(attrs) {
            this.model.on('add', this.createNew, this);
            this.createNew();
        },
    
        createNew: function() {
            var rv = new RecordView({records: this.model});
            this.$el.append(rv.render().el);
        }
    });
    
    $(function() {
        new RecordListView({model: new Records(), el: $('ul')});
    });
    ===== app.js =======
    
    opened by vtomilin 19
  • Trying to get in touch regarding a security issue

    Trying to get in touch regarding a security issue

    Hey there!

    I'd like to report a security issue but cannot find contact instructions on your repository.

    If not a hassle, might you kindly add a SECURITY.md file with an email, or another contact method? GitHub recommends this best practice to ensure security issues are responsibly disclosed, and it would serve as a simple instruction for security researchers in the future.

    Thank you for your consideration, and I look forward to hearing from you!

    (cc @huntr-helper)

    opened by JamieSlome 1
  • can not use event.stopPropagation() to stop the event propagation

    can not use event.stopPropagation() to stop the event propagation

    <div><p><em> some thing </em></p></div>

    $('div').on('click','p',function(e){   // here still performed }).on('click','em',function(e){   e.stopPropagation( );   return false; });

    opened by mobljs 0
  • There is no Zepto.noConflict method

    There is no Zepto.noConflict method

    Hey all,

    Zepto doesn't seem to want to define global with the following code:

    var first = document.getElementById('first-global'),
    second = document.getElementById('second-global');
    
    first.innerHTML = $;
    second.innerHTML = Zepto
    

    Is there anyway to define Zepto global only if $ isn't available?

    I understand $ is less reliable, seems to me something is being overwritten. To be sure what's behind $ I used the following pattern:

    (function($){
       $('selector').doSomething();
    }(library));
    

    Obviously where library is the other global variable besides $ I want to reference is Zepto.

    Thank you all.

    -Montana Mendy

    opened by Montana 0
  • Report security vulnerability

    Report security vulnerability

    Please let me know what would be the best way to privately report a vulnerability.

    If possible, please create a private GitHub Security Advisory for this findings. This way I can provide all the details, collaborate and further discuss these findings in private before they are published.

    opened by pwntester 0
  • Custom build

    Custom build

    Hello

    I would like to suggest that zepto js, could, somehow, provide a builder in the website. In my use case, i don't require the form and ajax modules, so would like to download from the website a more customized version.

    opened by jarodium 3
Releases(v1.2.0)
  • v1.2.0(Jul 13, 2016)

    On top of all the bug fixes found in v1.1.7, this release also brings new features and some slightly backwards-incompatible changes made to ensure better parity with jQuery.

    Large changes:

    • Eliminate __proto__ use from codebase.
    • Enable AMD-compatible module output. Zepto and $ are still exported to global namespace, even in the case of module loader, to keep compatibility with plugins.

    New functionality:

    • Add $.noop
    • Add fn.removeProp()
    • Add $.isNumeric()
    • Add dataFilter ajax option
    • Provide $.data() & $.hasData() in optional "data" module
    • Add Firefox OS detection

    jQuery compatibility:

    • Stop falling back to reading properties in fn.attr()
    • fn.attr() now returns undefined for non-existing properties instead of null
    • Add document fragment/shadow DOM support
    Source code(tar.gz)
    Source code(zip)
  • v1.1.7(Jul 13, 2016)

    DOM:

    • Fix fn.closest() on collections of multiple elements
    • text() returns text from all matching selectors
    • Fix offset() on documentElement
    • Use the standard API for CSS selector matches
    • append() now accepts array of DOM nodes
    • Add multi-window support for embedded scripts
    • Fix css() batch setting on non-existing element
    • Convert null/undefined into "" in fn.val() for jQuery compatibility
    • Improve detection of array-like objects

    Ajax:

    • Fix appending ajax params to URLs that have a hash component
    • Add ajax support for receiving binary data
    • Sufficiently randomize JSONP callback names
    • Fix assigning query params from data with explicit JSONP

    Cross-browser:

    • Avoid IE10 error by checking if element is in the DOM before calling getBoundingClientRect
    • Added support for pseudo-elements in IE getComputedStyle shim
    • Fix use of ajax xhrFields on Android 2.3 and Windows Mobile
    • Fx: avoid using vendor prefixes if unprefixed is supported

    Misc.:

    • Fix dasherize bug in fx module
    • Fix swipe event of touch module
    • Avoid exception in doubleTap
    • Accept function as data for on event handler
    • Populate event.timeStamp if it's 0 or missing
    Source code(tar.gz)
    Source code(zip)
  • v1.1.6(Dec 12, 2014)

  • v1.1.5(Dec 11, 2014)

    Many serialization improvements:

    • Don't serialize form fields without a name attribute
    • Don't try to serialize <input type=file>
    • Fix serializing <select multiple> values
    • Fix serialize()/serializeArray() on empty Zepto collections
    • Serialize null values as empty strings in $.param()
    • Support functions as values in $.param()
    • Only deserialize number from data-* attributes if that doesn't change its string representation

    Other fixes:

    • Improve detection of whether an $.ajax request is crossDomain or not
    • Fix find(falsey) to return an empty Zepto collection instead of an empty Array
    • Fix css() on empty Zepto collection causing exceptions when "ie" module is not included
    • Ensure that $.animate completion callback doesn't fire prematurely if the animation is configured with a delay
    • Actually focus() & blur() elements when these events are manually triggered
    • Fix installing auto-cancelling event handlers with shorthands such as submit(false), click(false)
    • Prevent removeClass/addClass from affecting window objects
    • Enable removeAttr to remove space separated list
    • Ensure recognition of Safari on Windows
    Source code(tar.gz)
    Source code(zip)
  • v1.1.4(Jul 7, 2014)

    • Detect IE 11, Windows Phone, Safari on OS X
    • .find() with falsy values now returns an empty array
    • Fix how .attr('value') and .val() interact on <input> (#939)
    • Have .text() accept a function argument
    • Make .text(undefined) assign an empty string
    • Do not eval <script> tags if parent element is not in the DOM
    • Second argument to .attr/prop/data() is always a setter, even if undefined
    • $.proxy() now accepts additional arguments
    • $.ajax() uses HTTP cache-busting parameter for dataType: jsonp/script by default
    • Fix $.contains and related features on Firefox 4 – 8.0
    Source code(tar.gz)
    Source code(zip)
  • v1.1.3(Feb 12, 2014)

    • Fix automatic parsing of JSON responses in $.get/post
    • Don't falsely detect requests to URLs such as /foo=?a=b to be JSONP requests; the = is part of the request path in this case
    • Use native Array.isArray if available
    • Update to Uglify v2, saving ~1.6 kB in minified version

    :sparkles: :star2: Download Zepto.js :star2: :sparkles:

    Source code(tar.gz)
    Source code(zip)
  • v1.1.2(Dec 13, 2013)

  • v1.1.1(Jul 13, 2016)

  • v1.1.0(Dec 5, 2013)

    Notable changes

    • IE10+ support
    • Huge speed optimizations for simple CSS selectors (classname, ID) and DOM element creation
    • Provide $.Callbacks and $.Deferred in optional modules
    • Removed fx and detect modules from default build

    Download Zepto.js:

    Ajax

    • New supported $.ajax() options:
      • xhrFields
      • mimeType
      • jsonpCallback
      • username & password
    • Promise interface supported when loading the optional "callbacks" and "deferred" modules:
      • xhr.done(function(data, status, xhr){ ... })
      • xhr.fail(function(xhr, errorType, error){ ... })
      • xhr.always(function(){ ... })
    • Enable mutating Ajax settings in the beforeSend callback
    • Fix JSONP callbacks for errored responses on Android
    • Ensure consistent Accept request HTTP header across browsers
    • Fix $.param() for jQuery compatibility when handling complex nested objects
    • Support IIS JavaScript MIME type
    • Pass "abort" and "timeout" status to global ajaxError event handlers

    Event

    • Provide isDefaultPrevented(), stopImmediatePropagation(), and related methods for all events
    • Support the data argument in .bind(), .on(), and .one()
    • Support CSS selector argument in .one() for event delegation
    • Support .on('ready') as an alias for .ready()
    • Enable event handlers on plain old JS objects
    • Many fixes related to event delegation

    Data

    • Cleanup .data() values on DOM element removal with .remove/empty()
    • .data() now assumes that numbers that begin with zeroes are strings
    • .removeData() (no argument) now removes all data on the element
    • Enable reading data-* attributes that have underscores in the name

    Misc.

    • Support simple DOM property names in .prop(name) such as for, class, readonly
    • Implement the .scrollLeft([value]) method
    • Support setting .scrollTop(value)
    • Fix $(document).width/height()
    • Support fetching multiple CSS values via array in .css(['prop1', 'prop2', ...])
    • Support setting CSS transition delay via delay option for .animate()
    • Ensure that .animate() callback always fires
    Source code(tar.gz)
    Source code(zip)
  • v1.0(Jul 13, 2016)

    Party like it's one-oh!

    Notable changes

    • Zepto is now compatible with Twitter Bootstrap
    • Portable, completely new node.js-based build system
    • Fully automated tests with PhantomJS and Travis CI
    • Removed touch module from default distribution

    New features

    • $.fn.filter(function(index){ ... })
    • $.fn.contents()
    • $.fn.wrapInner()
    • $.fn.scrollTop()
    • $.contains()
    • $.fn.has()
    • $.fn.position()
    • $.fn.offsetParent()
    • $.parseJSON()
    • $.camelCase()
    • $.isWindow()
    • $.grep() (interface to Array.filter)
    • Support $(html, attributes) syntax for element creation
    • Emulate mouseenter and mouseleave events
    • Bootstrap compat: support $.fn.offset(coordinates)
    • Bootstrap compat: implement $.fn.detach()
    • Add support for Ajax cache: false option
    • Prevent scrolling when horizontal swipe events are detected
    • cancelTouch for tap events
    • prev and next now support an optional selector argument
    • $.fn.find and $.fn.closest now support Zepto objects as arguments
    • Enable deep copy via $.extend(true, target, source)
    • Enable nested structures for $.fn.wrap() and $.fn.wrapAll()
    • Enable function arguments for $.fn.wrap() and $.fn.wrapInner()
    • Support number, boolean, JSON types in data attributes
    • Support manipulating classnames on SVG elements
    • Enable named durations for animate, e.g. slow.
    • Support timing-function for animate
    • Support event properties passed to $.fn.trigger() or $.Event()
    • Selector module: support child > * queries
    • Add detect support for mobile Chrome browser
    • Add $.os.phone and $.os.tablet (booleans)
    • Detect Firefox mobile, Playbooks and BB10

    Fixes

    • Fix passing null selector to on or off
    • Fixed bug where self-closing html tags would act as open tags
    • Fix val for multiple select
    • Fix various touch and gesture bugs.
    • Corrected parameters of load success callback to match jQuery.
    • Fix css with 0 values and falsy values
    • Fix a css performance issues with string values
    • Fix $.ajaxJSONP when invoked directly
    • Fix animate with 0 durations.
    • Fix toggle and fadeToggle for multiple elements.
    • Fix ajax $.fn.load behavior with selector
    • Make attr(name, null) unset attribute
    • Fix animate in Firefox
    • Fix animate for elements just added to DOM
    • Fix an escaping issue with $.param
    • Respect traditional: true option in $.ajax
    • Fix focus & blur event delegation and enable unbind
    • Simple wrapping for any object passed to $()
    • Enable children method for XML documents
    • Don't eval <script> content when src is present
    • Support processData option for $.ajax()
    • Enable passing contentType: false to $.ajax()
    • Apply focus() and blur() to all elements in collection
    • Change $.fn.map() to return a Zepto collection
    • Selector argument for on(evt, selector, fn) can be false
    • Don't raise error on $('#')
    • Provide empty object in $.support
    • return false in event handler calls stopPropagation()
    • Fix $.isPlainObject() for window in Opera
    • $.ajax error callback correctly reports abort status
    • Fix hasClass in collections of multiple elements
    • Stop iteration in each() when the callback returns false
    • Add ability to set xhr factory per-request
    • Have get() method accept negative index
    • Support for multiple class names in toggleClass()
    • Fix error callbacks for ajaxJSONP
    • Support optional data argument for various Ajax methods
    • Fix DOM insertion operators for null values
    • Fix dataType being set for $.getJSON
    Source code(tar.gz)
    Source code(zip)
  • v1.0rc1(Jul 13, 2016)

    The semicolon-free edition! That's right, we removed all trailing semicolons from the source and tests. They were never needed anyway.

    New methods:

    New module:

    • "selector.js" with experimental support for jQuery CSS pseudo-selectors such as :visible and :first

    Improvements in core:

    • added missing methods for Ember.js compatibility
    • improved creating DOM fragments from HTML with $()
    • enable append & family to accept multiple arguments
    • fix $.each context
    • fix calling get without index
    • fix calling val on empty collection
    • using css(property, '') removes the property
    • fix filter, is, and closest when operating on nodes that are detached from the document
    • remove end & andSelf from core to the new "stack.js" plugin
    • exposed important internal Zepto functions through the $.zepto object for extending or overriding Zepto functionality.
    • data method returns undefined when there is no data
    • support camelized names in data method

    Apart from improving the basic data method in core, the "data.js" module got improvements as well:

    • better jQuery compatibility
    • ability to store functions
    • new removeData method

    Ajax:

    • have correct ajaxComplete argument order for JSONP abort and timeout
    • JSONP requests that hit a 404 will now correctly invoke the error callback
    • add support for dataType: 'jsonp' in $.ajax
    • add support for data in $.ajaxJSONP
    • HTTP 304 status is treated as success instead of an error
    • made load more compatible with jQuery
    • allow Content-Type to be set via request headers
    • respect Content-Type of the response if dataType isn't set
    • work around Chrome CORS bug when data is empty

    Changes in other modules:

    • fix animate for edge cases such as when there is an animation within an animated element, and improve handling of transition CSS properties

    • new "singleTap" event

    • improved "longTap" detection

      "Semicolons in JavaScript are optional"

    Source code(tar.gz)
    Source code(zip)
  • v0.8(Jul 13, 2016)

    Changes in Zepto since v0.7

    Most notable additions in Zepto 0.8 are:

    1. CSS transitions for every browser with animate() method;
    2. Unified event handling with fn.on() & off();
    3. Ajax global events, timeout support, and other improvements;
    4. Performance boost for selectors;
    5. 2 new add-ons.

    Zepto is now expected to work in all major browsers, mobile or desktop, except IE. Full summary of most notable additions/fixes below.

    Download Zepto 0.8. Report bugs here. Thank you Zepto contributors!

    Two new add-ons

    • "data.js": expand the $.fn.data() method to store any kind of objects, not just scalar values
    • "fx_methods.js": animated show(), hide(), fadeIn/Out methods
    // examples
    $('#el').show('slow')
    $('#el').hide(150)
    $('#el').fadeIn('fast')
    

    To build a custom "zepto.js" distribution file including add-ons you'd like, you can clone the project and use the rake concat tool:

    $ rake concat[data:fx_methods]
    Building zepto.js by including: polyfill, zepto, event, detect, fx, ajax, form, touch, data, fx_methods
    

    Event

    • unified event handling with fn.on() & off()
    • event methods now accept objects in which keys are event names and values are handler functions
    • fix delegate(), one() handlers receiving multiple data arguments
    • fix return false cancels event even in delegated handlers
    // example: observe the following events for forms matching selector
    $(document).on({
      click: function(e) { ... },
      submit: function(e) { ... }
    }, 'form.add_comment')
    

    Ajax

    • enable cross-domain Ajax requests
    • add "global" Ajax events as well as an extra "ajaxBeforeSend" event
    • add "context" option to $.ajax
    • ensure $.get(), $.post(), $.getJSON() all return xhr objects
    • add abort() functionality for $.ajaxJSONP
    • don't choke on JSON requests that return an empty body
    • allow to specify xhr transport
    • allow to set timeout for ajax request (closes #209)
    • correctly call "error" callback for Ajax requests failed due to connectivity issues
    $(document)
      .on('ajaxStart', function() { /* display a progress indicator */ })
      .on('ajaxStop',  function() { /* hide the progress indicator */ })
      .on('ajaxSuccess', 'form.add_comment', function() {
        // hide the comment form when submitted
        $(this).hide()
      })
    
    var form = $('#myform')
    
    $.ajax({
      url: '/create',
      data: form.serializeArray(),
      context: form,
      timeout: 2500,
      error: function(xhr, errorType) { console.error(errorType) }
    })
    

    CSS animations for all

    • $.fn.anim() is now $.fn.animate(); duration is now specified in milliseconds
    • enable CSS animations in Firefox, Opera (and IE, theoretically, but Zepto still doesn't support IE)
    • turn off animations globally with $.fx.off = true
    • Added ability to run keyframe animations
    • fix animation callback being executed in the context of element
    $('#el').animate({
      translate3d: '100px, 100px, 100px',
      rotateZ: '-90deg',
      opacity: 0.8,
      'background-color': '#BADA55'
    }, {
      duration: 1800,
      easing: 'ease-out',
      complete: function() { /* ... */ }
    });
    

    Form

    • improve form serialization
    • val(value) now accepts a function argument
    • refactor attr() to support empty attributes and more input field types
    • refactor $.param() so it also accepts data from serializeArray()

    Core

    • improve $(document).ready(), pass Zepto as 1st argument to handlers
    • performance boost for $.qsa(), Zepto's main query function
    • make first() & last() useful for non-DOM collections

    DOM

    • fix <script> eval
    • support insertion of CharacterData nodes
    • replaceWith, wrap, before, after: make all of them noop on fragments
    • improve $.fn.width() & height() to work on window & document objects
    • add $.fn.insertBefore() & insertAfter()
    • trim whitespace from html fragment when using $("...") to create an element
    Source code(tar.gz)
    Source code(zip)
  • v0.7(Jul 13, 2016)

    • add $.each, $.map, $.slice;
    • add .serializeArray(), .serialize();
    • add .triggerHandler();
    • add .wrap, .wrapAll, .unwrap, .width/height setters, .append (and friends) improvements;
    • add "longTap" event;
    • .anim() accepts CSS transform properties;
    • return false in event handlers cancels browser event behavior.
    Source code(tar.gz)
    Source code(zip)
  • v0.6(Jul 13, 2016)

    • add .add, .appendTo, .prependTo, .replaceWith, .empty, .submit;
    • allow function args for .add/.remove/.toggleClass;
    • improvements to events and xhr.
    Source code(tar.gz)
    Source code(zip)
  • v0.5(Jul 13, 2016)

  • v0.4(Jul 13, 2016)

    • JSONP;
    • better .find, .each, .closest;
    • add .eq, .size, .parent, .parents, .removeAttr, .val;
    • support function args in .html, .attr;
    • adjacency methods now take Zepto objects.
    Source code(tar.gz)
    Source code(zip)
  • v0.3(Jul 13, 2016)

  • v0.1.1(Jul 13, 2016)

    • jQuery-like load functionality with built-in response html parsing by selector
    • Add $.load for ajax loading of pages and page fragments
    • Add fn.is()
    • add $.os object for environmental info
    • Switch to inheritance-based extension mechansim
    • use a local undefined variable instead of void 0 comparision, better compression and faster
    • remove the dom local variable and use short if for $() function
    • Shouldn't touch events be binded instead of accessing them as a property?
    • Add fn.ready() function; use bind for touch event internals
    Source code(tar.gz)
    Source code(zip)
Owner
Thomas Fuchs
Thomas Fuchs
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Javascript client for Sanity. Works in node.js and modern browsers (older browsers needs a Promise polyfill).

@sanity/client Javascript client for Sanity. Works in node.js and modern browsers (older browsers needs a Promise polyfill). Requirements Sanity Clien

Sanity 23 Nov 29, 2022
Highly customizable checkboxes and radio buttons (jQuery & Zepto)

iCheck plugin 1.0.3 Highly customizable checkboxes and radio buttons for jQuery and Zepto. Refer to the iCheck website for examples. Note: iCheck v2.0

Dar Gullin 7.4k Dec 25, 2022
Highly customizable checkboxes and radio buttons (jQuery & Zepto)

iCheck plugin 1.0.3 Highly customizable checkboxes and radio buttons for jQuery and Zepto. Refer to the iCheck website for examples. Note: iCheck v2.0

Dar Gullin 7.5k Aug 24, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A tiny, lightning fast jQuery-like library for modern browsers.

Sprint.js Sprint is a high-performance, 5KB (gzipped) DOM library for modern browsers. Sprint notably shines on bandwidth and resource constrained dev

Benjamin De Cock 4.3k Jan 3, 2023
Reorderable drag-and-drop lists for modern browsers and touch devices. No jQuery or framework required.

Sortable Sortable is a JavaScript library for reorderable drag-and-drop lists. Demo: http://sortablejs.github.io/Sortable/ Features Supports touch dev

SortableJS 26.1k Jan 5, 2023
This package generates a unique ID/String for different browsers. Like chrome, Firefox and any other browsers which supports canvas and audio Fingerprinting.

Broprint.js The world's easiest, smallest and powerful visitor identifier for browsers. This package generates a unique ID/String for different browse

Rajesh Royal 68 Dec 25, 2022
A simple color picker application written in pure JavaScript, for modern browsers.

Color Picker A simple color picker application written in pure JavaScript, for modern browsers. Has support for touch events. Touchy… touchy… Demo and

Taufik Nurrohman 207 Dec 14, 2022
🗿 Surreal - Hyper minimalist jQuery alternative

?? Mini jQuery alternative for devs who ?? ergonomics. Use direct elements or arrays transparently! Locality of behavior (LoB) using me()! It's vanilla querySelector but better!

Nathaniel Sabanski 19 Dec 29, 2022
Forked from hayes0724/shopify-packer Modern development tool for Shopify using Webpack 5. Easy to extend and customize, zero build config, compatible with Slate and existing websites.

Shopify Packer Modern development tool for Shopify using Webpack 5. Easy to extend and customize, zero build config, comes with starter themes and com

Web & Mobile | eCommerce | Full-Stack Developer 4 Nov 24, 2022
A minimalist Javascript library to perform AJAX POST and GET Request.

minAjax.js A minimalist Javascript library to perform AJAX POST and GET Request. #Check Pretty Documentation http://flouthoc.github.io/minAjax.js/ #Us

null 6 Apr 27, 2021
A fast, vanilla JS customisable select box/text input plugin for modern browsers ⚡

choices A fast, vanilla, lightweight (~16kb gzipped ?? ), configurable select plugin for modern browsers. Similar to Select2 and Selectize but without

null 9 Aug 9, 2022
ndarray/tensor data processing for modern browsers

nadder Easy n-dimensional data manipulation with NumPy syntax. Installation npm i nadder # or yarn add nadder, or pnpm add nadder Usage import { ndarr

null 16 Dec 23, 2022
Wraps postgres API in a pg compatible API.

postgres/pg compatibility layer Wraps postgres API in a pg compatible API.

Gajus Kuizinas 18 Oct 16, 2022
minimalist virtual dom library

petit-dom A minimalist virtual DOM library. Supports HTML & SVG elements. Supports Render functions and Fragments. Custom components allows to build y

Yassine Elouafi 485 Dec 12, 2022
Minimalist dependancy free Masonry layout library

MiniMasonry.js Minimalist dependency free Masonry layout library MiniMasonry is a lightweight dependency free Masonry layout. It will compute elements

Spope 343 Dec 4, 2022
Sharerbox - Free, minimalist and lightweight JavaScript-based social-media sharer for websites

Sharerbox Free minimalist and lightweight JavaScript-based social-media sharer for websites. Version: 0.8.1 Description SharerBox is a free, minimalis

Juan Astudillo 3 Aug 22, 2022