Skip to content

Instantly share code, notes, and snippets.

@disnet

disnet/gist:6055864

Created Jul 22, 2013
Embed
What would you like to do?
macro forThing {
case $val ($a:expr, $b:expr) => {(function($val){forEach.call($b, this)}).bind($a)}
case $val ($a:expr) => {(function($val){forEach.call(val,this)}).bind($a)}
}
function makeMutationObserver(tag){
var queue= tag.queue,
put= queue.put.bind(queue),
mutationAddObserve= forThing val (put, val.getElementsByTagName(this.tag)),
mutationObserver= forThing val (mutationAddObserve, val.addedNodes),
mutationsObserver= forThing val (mutationObserver)
return new MutationObserver(mutationsObserver)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.