Work around MutationObserver differences in Edge.

This commit is contained in:
ccd0 2015-08-02 01:16:24 -07:00
parent 66e2a304cc
commit c52e8e9ef8

View File

@ -117,6 +117,11 @@ $.asap = (test, cb) ->
$.onExists = (root, selector, subtree, cb) ->
if el = $ selector, root
return cb el
# XXX Edge doesn't notify MutationObservers of nodes added as document loads.
if $.engine is 'edge' and d.readyState is 'loading'
$.asap (-> d.readyState isnt 'loading' or $ selector, root), ->
$.onExists root, selector, subtree, cb
return
observer = new MutationObserver ->
if el = $ selector, root
observer.disconnect()