Skip to content

Instantly share code, notes, and snippets.

alert("Loaded!");
@jitter
jitter / gist:826700
Created February 14, 2011 22:18
Road to 1.5.1 (? complete)
NEEDSDOCS no ticket associated
https://github.com/jquery/jquery/commit/4e97543
FEATURE (SMALL) SHOULD THIS BE REMOVED BEFORE 1.5.1??
.invert() method on promises
returns an inverted promise that is resolved/rejected when the underlying deferred is rejected/resolved)
https://github.com/jquery/jquery/commit/e0b1bb8
http://api.jquery.com/extending-ajax/ <-- the code example at the very bottom should be updated to match the new regex
#8122
jQuery.fn.textFast = function(text) {
if (jQuery.isFunction(text)) {
return this.each(function(i) {
var self = jQuery(this);
self.text(text.call(this, i, self.text()));
});
}
if (typeof text !== "object" && text !== undefined) {
return this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(text));
}
@jitter
jitter / fiddle.response.js
Created February 1, 2011 22:11
jsfiddle enhancement
alert( "you got the content-type header right :)" );
@jitter
jitter / gist:804015
Created January 31, 2011 13:20
browser tests for 1.5 final
All browsers were run on Windows XP SP2 (except IE8 on Windows 7).
Missing IE 7
All tests passed (only Opera Mobile has the usual 4 offset failures).
Safari 5.0.3 / 4.0.5 / 3.2.3 / 3.1.2
Opera 11.01 / 11 / 10.63 / 10.54 / 10.10 / 9.64
Opera Mobile 10.00
IE 6 / 8 (IE8 was on Windows 7)
Firefox 4.0b9 / 3.6.13 / 3.5.11 / 3.0.19 / 2.0.0.20
Fennec 1.1b1
@jitter
jitter / gist:712171
Created November 23, 2010 17:42
test
jQuery.readyWait += 2;
var go = function () {
$("#foo").attr("value", " Click me again. So jQuery knows it can be ready ");
jQuery.ready(true);
}
@jitter
jitter / gist:708161
Created November 20, 2010 21:19
jQuery Ticket 2253 frame1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>iframe 2</title>
</head>
<body>
<div>iframe 2</div>
</body>
</html>
/*!
* jQuery nodetype filter - v0.1pre - 11/18/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*
* Variation by Anton M.
*/
/*!
* jQuery Tiny Pub/Sub - v0.3 - 11/4/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($){
// everyone's new favorite closure pattern:
(function(window,document,undefined){ ... })(this,this.document);
// when minified:
(function(w,d,u){ ... })(this,this.document);
// which means all uses of window/document/undefined inside the closure
// will be single-lettered, so big gains in minification.
// it also will speed up scope chain traversal a tiny tiny little bit.