Releases: madrobby/zepto
Zepto v1.0 RC1
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"
Zepto 0.8
Changes in Zepto since v0.7
Most notable additions in Zepto 0.8 are:
- CSS transitions for every browser with
animate()
method; - Unified event handling with
fn.on()
&off()
; - Ajax global events, timeout support, and other improvements;
- Performance boost for selectors;
- 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
Zepto 0.7
- 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.
Zepto 0.6
Zepto 0.5
Zepto 0.4
Zepto 0.3
Zepto 0.1.1
- 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; usebind
for touch event internals