Created
January 26, 2010 14:26
-
-
Save paulirish/286873 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://jquery14.com/day-13/jquery-1-4-hawtness-6-with-paul-irish | |
/*d8b .d88888b. d888 d8888 | |
Y8P d88P" "Y88b d8888 d8P888 | |
888 888 888 d8P 888 | |
8888 888 888 888 888 .d88b. 888d888 888 888 888 d8P 888 | |
"888 888 888 888 888 d8P Y8b 888P" 888 888 888 d88 888 | |
888 888 Y8b 888 888 888 88888888 888 888 888 888 8888888888 | |
888 Y88b.Y8b88P Y88b 888 Y8b. 888 Y88b 888 888 d8b 888 | |
888 "Y888888" "Y88888 "Y8888 888 "Y88888 8888888 Y8P 888 | |
888 Y8b 888 | |
d88P Y8b d88P | |
888P" "Y88P" | |
888 888 888 | |
888 888 888 | |
888 888 888 | |
8888888888 8888b. 888 888 888 888888 88888b. .d88b. .d8888b .d8888b | |
888 888 "88b 888 888 888 888 888 "88b d8P Y8b 88K 88K | |
888 888 .d888888 888 888 888 888 888 888 88888888 "Y8888b. "Y8888b. | |
888 888 888 888 Y88b 888 d88P Y88b. 888 888 Y8b. X88 X88 | |
888 888 "Y888888 "Y8888888P" "Y888 888 888 "Y8888 88888P' 88888P' | |
#6: OMG what could break???! | |
db d8b db d888888b d888888b db db | |
88 I8I 88 `88' `~~88~~' 88 88 | |
88 I8I 88 88 88 88ooo88 | |
Y8 I8I 88 88 88 88~~~88 | |
`8b d8'8b d8' .88. 88 88 88 | |
`8b8' `8d8' Y888888P YP YP YP | |
d8888b. .d8b. db db db d888888b d8888b. d888888b .d8888. db db | |
88 `8D d8' `8b 88 88 88 `88' 88 `8D `88' 88' YP 88 88 | |
88oodD' 88ooo88 88 88 88 88 88oobY' 88 `8bo. 88ooo88 | |
88~~~ 88~~~88 88 88 88 88 88`8b 88 `Y8b. 88~~~88 | |
88 88 88 88b d88 88booo. .88. 88 `88. .88. db 8D 88 88 | |
88 YP YP ~Y8888P' Y88888P Y888888P 88 YD Y888888P `8888Y' YP YP | |
*/ | |
// http://code.jquery.com/jquery.compat-1.3.js | |
// .add() returns elements in document order. | |
$('.foo').add('.bar').eq(0) | |
// .clone(true) now copies events AND data instead of just events. | |
$('.muchodata') | |
.data('saywhattt','ooh yah') | |
.clone(true) | |
.appendTo('section:eq(2)') | |
.data('saywhattt') // 'ooh yah' | |
jQuery(elem).data() no longer returns an id, it returns the element’s object cache instead. | |
$('#bigcheif') | |
.data('age',7).data('interests',['lollipops']) | |
.data(); // previously something like 12324789549 | |
// now an obj: { 'age' : 12, 'interests' : ['lollipops'] } | |
jQuery() (with no arguments) no longer converts to jQuery(document). | |
$(documen).ready(function(){ | |
}) | |
//.val('name') on an option or a checkbox is no longer ambiguous (it will always select by value now, not by text value). | |
<select> | |
<option value="1">2</option> | |
<option value="2">1</option> | |
</select> | |
$('select').val('1'); // first one set to selected | |
$('select').val('2'); // first one set to selecteds | |
//jQuery.browser.version returns engine version for webkit and gecko/mozilla | |
$.browser.webkit | |
$.browser.mozilla | |
$.browser.msie | |
$.browser.opera | |
$.browser.version | |
//Param serialization now happens in the PHP/Rails style by default. You can use jQuery.ajaxSettings.traditional = true; to use traditional parameter serialization. You can also set the behavior on a per-request basis by passing traditional: true to the jQuery.ajax method. | |
// In jQuery 1.3: (or jQuery.ajaxSettings.traditional=true) | |
$.param( {foo: ["bar", "baz"]} ) === “foo=bar&foo=baz”. | |
// In jQuery1.4 | |
$.param( {foo: ["bar", "baz"]} ) === “foo[]=bar&foo[]=baz”. | |
// jQuery.extend(true, ...) No longer extends non-plain-objects or arrays. | |
var func = function() {} | |
var extendee = {hello: func}; | |
$.extend(extendee, {foo: "bar"}) | |
extendee // in 1.3: {foo: "bar", hello: {}} | |
extendee // in 1.4: {foo: "bar", hello: func } | |
// If an Ajax request is made without specifying a dataType and it is returned as text/javascript, it will be executed. Previously, an explicit dataType was required. Previously it would have been interpretted as text and remained unexecuted. | |
// Response header is obeyed if no dataType given: | |
Content-Type : 'application/json' // parsed as JSON | |
// or | |
Content-Type : 'application/javascript' // executed as script | |
// Setting an Ajax request’s ifModified now takes ETags into consideration. | |
$.ajax({ | |
url : ajaxurl, | |
success : purplePeopleEaterFn, | |
ifModified : true | |
}) | |
//We are now strict about incoming JSON and throw an exception if we get malformed JSON. If you need to be able to evaluate malformed JSON that is valid JavaScript, you can make a text request and use eval() to evaluate the contents. | |
$.getJSON('bestdataever.json.js',function(){ | |
... | |
}); | |
//response: | |
{ | |
"unquotedkeys" : function illegalfuncs(){}, | |
"invalid" : true | |
} | |
// http://code.jquery.com/jquery.compat-1.3.js | |
888 888 888 | |
888 888 888 | |
888 888 888 | |
888888 88888b. 8888b. 88888b. 888 888 888 888 .d88b. 888 888 d8b | |
888 888 "88b "88b 888 "88b 888 .88P 888 888 d88""88b 888 888 Y8P | |
888 888 888 .d888888 888 888 888888K 888 888 888 888 888 888 | |
Y88b. 888 888 888 888 888 888 888 "88b Y88b 888 Y88..88P Y88b 888 d8b | |
"Y888 888 888 "Y888888 888 888 888 888 "Y88888 "Y88P" "Y88888 88P | |
888 8P | |
Y8b d88P " | |
"Y88P" | |
more at: http://jquery14.com | |
my podcast: http://yayquery.com | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment