Merge pull request #2004 from tomalec/html-import-issue

Use current document to process <script> tags (fixes ajaxorg/ace#2003)
This commit is contained in:
Harutyun Amirjanyan 2014-06-18 11:05:26 +04:00
commit bdd54043b5

View file

@ -153,7 +153,11 @@ function init(packaged) {
var scriptOptions = {};
var scriptUrl = "";
var scripts = document.getElementsByTagName("script");
// Use currentScript.ownerDocument in case this file was loaded from imported document. (HTML Imports)
var currentScript = (document.currentScript || document._currentScript ); // native or polyfill
var currentDocument = currentScript && currentScript.ownerDocument || document;
var scripts = currentDocument.getElementsByTagName("script");
for (var i=0; i<scripts.length; i++) {
var script = scripts[i];