remove script elements used for JSONP calls

This commit is contained in:
Sami Samhuri 2010-11-28 22:35:51 -08:00
parent d997c74d70
commit 274b6e4802

View file

@ -388,6 +388,7 @@
, head = oDOC.head || oDOC.getElementsByTagName("head") , head = oDOC.head || oDOC.getElementsByTagName("head")
// loading code borrowed directly from LABjs itself // loading code borrowed directly from LABjs itself
// (now removes script elem when done and nullifies its reference --sjs)
setTimeout(function () { setTimeout(function () {
if ("item" in head) { // check if ref is still a live node list if ("item" in head) { // check if ref is still a live node list
if (!head[0]) { // append_to node not yet ready if (!head[0]) { // append_to node not yet ready
@ -403,6 +404,8 @@
return false return false
} }
scriptElem.onload = scriptElem.onreadystatechange = null scriptElem.onload = scriptElem.onreadystatechange = null
scriptElem.parentNode.removeChild(scriptElem)
scriptElem = null
scriptdone = true scriptdone = true
}; };
scriptElem.src = url scriptElem.src = url