Daz wrote:
I would like to know how to obtain a reference to (or at least, element
type of) the last node which was inserted into the document. I am using
an event listener to listen for dom inserts, but I am not sure how to
check if that last node was a script tag.
If that is the W3C DOM Level 2 DOMNodeInserted event e.g.
document.addEventListener('DOMNodeInserted', function (evt) {
alert(evt.target + ' inserted under parent ' + evt.relatedNode);
}, false);
then the evt.target tells you the inserted node and evt.relatedNode the
parent node into which evt.target has been inserted. So you can check
whether evt.target is an element node and if so, its
tagName.toLowerCase() is 'script'.
--
Martin Honnen
http://JavaScript.FAQTs.com/