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
/** | |
* Returns true if this selection is part of the current DOM; | |
* false if it's a fragment. | |
* @return {Boolean} | |
*/ | |
jQuery.fn.inDom() = function() { | |
// Get the first element in the jQuery selection | |
var node = this[0]; | |
while (node) { |
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
// A painfully simple check to see if an element is disconnected | |
// from a document (should be improved, where feasible). | |
function isDisconnected( node ) { | |
return !node || !node.parentNode || node.parentNode.nodeType === 11; | |
} |
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
function Person(){} | |
Person.prototype.greet = function(){ alert("Hi!"); }; | |
var p = new Person(); | |
JSON.parse(JSON.stringify(p)).greet(); // throws Object #<an Object> has no method 'greet' in Chrome |
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
(function fixScrollAndTapHold() { | |
var $document = $(document); | |
var isScrolling = false; | |
var lastX, lastY, lastT, scrollTimeout; | |
$document.bind("touchstart mousedown click", function(e) { | |
lastT = e.originalEvent.timeStamp; | |
}); |
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
/** | |
* @module plugins/removeUseStrict | |
* @author kpozin | |
*/ | |
exports.handlers = { | |
beforeParse: function (e) { | |
e.source = e.source.replace(/(['"])use strict\1;/g, ""); | |
} | |
}; |