Tuesday, May 3, 2011

Breaking changes of Jquery 1.6



Case-mapping of data- attributes

In Jquery 1.5.2, an attribute of data-max-value="15" would create a data object of { max-value: 15 } but as of jQuery 1.6 it sets { maxValue: 15 }. It is done to match W3C HTML5 spec.

Handling of DOM properties and DOM attributes separatly
.prop() -
.removeProp() -
.attr() -

Properties represent the dynamic state of DOM, whereas Attributes represent the state of DOM information as retrieved from the document.
Ex: $(this).prop("checked") - returns current state of the checkbox.

Ajax
Bugs Fixed:

#6481: revert $.param should treat empty arrays/objects like empty strings
#7881: Make compatible with XHR 2
#8417: When posting AJAX and the data has “??” is formats it to jQuery?
#8744: .ajax() jsonp requests are not handled correctly when hitting timeout
#8884: jqXHR breaks names of custom header fields

Performance Improvement
.attr("alue");
.attr("name", "value")
.val() - get
.data()

boolean attributes

$(#checkbox).attr("checked","true"); - check it
$(#checkbox).attr("checked","false"); - Uncheck it

Bugs fixed
Bugs Fixed:

#1591: IE "Invalid Argument" $('table').attr('non-existent')
#3116: .attr does not work with SVG IDLs
#3786: removeAttr should use jQuery.props
#4283: .attr('checked') & XHTML 1.1 Strict
#4464: IE cannot get width attribute of detached IMG element
#4978: jQuery.prop missing cellpadding?
#5413: tag "img" width/height attribute is zero (IE)
#6562: using .attr() to set the ‘target’ attribute, with a node that has ID of 'target'
#6708: Opera has inconsistent result for usemap attribute value
#6823: Make .val(value) faster for common use case
#7472: $('form').attr('id') return DOM Element
#7485: Inconsistency between has [attribute] selector and attr() method
#7709: Permission denied to access property ‘nodeType’ from a non-chrome Firefox/3.5.15
#7996: Safari $('script').attr(‘event’); Bug
#8117: .removeAttr don’t works with select element’s size attribute
#8150: removeAttr issue in webkit, firefox
#8255: support for list attribute
#8418: set name parameter using attr() method in IE 7
#8457: attrHooks
#8570: .val method returning “on” for dynamically created radio buttons in ie9
#8699: .attr() returns -1 on missing attribute instead of undefined
#8772: Using .attr() to set input type 'range' causes script error in IE9
#8997: new attribute “form” (HTML5) is not supported, .attr(‘form’) not working properly
#9037: $('blah').attr('onclick') return event in Firefox

Event - Bugs fixed
#5884: live mouseenter/mouseleave events don’t fire as expected when nested
#6514: Mouseenter and mouseleave events not able to be triggered if bound by live
#6913: namespaced event bubbleing wrong
#6993: .bind() and .one() don’t allow a function as data
#7071: Accessing the ‘type’ property on VML elements fails on IE
#7883: .delegate (and .live) should accept false as the fn arg, like .bind
#8018: Unsafe access to frameElement causes error in crossdomain (i)frames
#8272: Exceptions in plain JS object event handlers swallowed by jQuery
#8712: Custom events don’t bubble up to window
#8732: Incorrect feature detect for IE9 focusin/focusout
#8753: jQuery 1.6: jQuery.Event contstructor to support setting properties
#8755: binding to beforeunload throws an error in IE6, 7, 8 on page unload
#8777: jQuery 1.6: undelegate() accepts custom namespaced events
#8788: Reorganize jQuery.event.trigger to use loop instead of recursion
#8790: Optimize non-attached events such as data events
#8803: jQuery.holdReady() method


Manipulation - Bugs fixed

#1954: val() returns innerHTML for button elements in IE
#6180: jQuery.clean should not touch script tags that are not of type text/javascript
#7623: Exception thrown in replaceWith
#7885: jQuery .offset doesn’t property works when current offset is float (which is possible in FireFox)
#8060: Setting checked to true on a disconnected checkbox does not carry over after attaching to DOM.
#8500: radios and checkboxes revert to default (HTML) state when wrapped in IE

Misc
Bugs Fixed:


#8203: Remove un-needed “someVar = null;”s
#8851: Wraps strings with double quotes in sources and tests
#8882: Tests: Update QUnit usage, replace id=main with id=qunit-fixture


Selector
:focus Selector

In jQuery 1.6 we now ensure that the :focus selector works properly across all browsers. You can use this selector to find the currently focused element on the page (such as a form input).

$("input:focus").addClass("active");

#3685: Selector fails for forms with an element named “name”
#4321: $(“#”) returns undefined
#8105: :focus selector filter


Support
Bugs Fixed:


#9028: IE8 crashes while loading 1.6rc1 if using body background image


Traversing

find(), closest(), and is() now all take DOM elements and jQuery objects
In jQuery 1.6 we’ve ensured that find(), closest(), and is() can all take DOM elements and jQuery objects as arguments. This gives you alternatives for filtering sets of elements based upon the passed-in elements.

// Only returns .test elements if they're inside of a div
$("div").find( $(".test") )

Bugs Fixed:

#2773: $.fn.is and $.fn.not should accept DOMelements and jQuery collections
#5712: Allow jQuery.fn.is to accept a function
#6912: $().add(selectElement) adds option children instead
#7369:
$('
ff
').closest('[attr]');
raises exception in all browsers
#8609: Result of .find("") is undefined

Reference : http://blog.jquery.com/2011/05/03/jquery-16-released/

No comments:

Post a Comment