Skip to content

Instantly share code, notes, and snippets.

View markelog's full-sized avatar
😀
set your status

Oleg Gaidarenko markelog

😀
set your status
View GitHub Profile
// jQuery made popular chaining style in JavaScript,
// as i recall this approach we liked at San Diego meeting,
// i think we could use similar approach for $.xhr
//
// also https://github.com/visionmedia/superagent
$.xhr( "url" )
// Default method is GET
.method( "post" )
@markelog
markelog / gist:3495987
Created August 28, 2012 07:53
#12346 – fn.append not working correctly
// In previous versions of jQuery, on every for iteration new div was created in jQuery.clean,
// now, on every iteration only one div is used, which created some problems –
// Illustration of WebKit bug
div = document.createElement("div");
div.innerHTML = "1";
nodes = jQuery.merge( [], div.childNodes );
div.innerHTML = "2";
@markelog
markelog / gist:2706036
Created May 15, 2012 23:44
disconnected nodes and css
// suppose we have this in css
// .hidden { display: none; }
// .inline { display: inline; }
// then in javascrpit
$('<div class="hidden"/>').css("display");
// for FF – "none"
// for IE – "block"
// For Chrome, Opera – ""
@markelog
markelog / gist:2589514
Created May 3, 2012 21:06
Copy in Firefox, Chrome and Safari
// We can't copy stuff in clipboard in Chrome, Safari and Firefox (Opera)
// Maybe one day this tickets will be resolved –
// https://bugzilla.mozilla.org/show_bug.cgi?id=407983
// https://bugs.webkit.org/show_bug.cgi?id=17645
// But if they will, we still can only copy text to clipboard only during clipboard events
// We might get around this, it's not a production code, just...
var clipboard = function() {};
// If we have firebug installed
@markelog
markelog / gist:2390810
Created April 15, 2012 07:55
#8894 fix explanation
var fragment, div, clonedNode, firstP, secondP, clonedP, dbi, clonedBdi,
node = document.createElement("div");
// true in all browsers
console.log( node.parentNode == null );
// but after
node.getElementsByTagName();
// true only in ie < 9