-
-
Save GCheung55/73988 to your computer and use it in GitHub Desktop.
dispatch some method everytime a dom change
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
var reapplyTimeoutId = null | |
$each(['insertBefore', 'replaceChild', 'removeChild', 'appendChild'], function(methodName) { | |
Node.prototype["_" + methodName] = Node.prototype[methodName] | |
Node.prototype[methodName] = function() { | |
var ret = this["_" + methodName](arguments[0], arguments[1]) | |
if (reapplyTimeoutId) { clearTimeout(reapplyTimeoutId) } | |
reapplyTimeoutId = setTimeout(Attitude.applyDefinitions.bind(Attitude), 100) | |
return ret | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment