Commit 18d4f072 authored by Thibaut Frain's avatar Thibaut Frain

Extract JS even if type='text/javascript' not set

parent 4965eab4
...@@ -605,7 +605,9 @@ ...@@ -605,7 +605,9 @@
// element.href returns absolute URL in firefox but "" in chrome; // element.href returns absolute URL in firefox but "" in chrome;
if (element.rel === "stylesheet") { if (element.rel === "stylesheet") {
settings.required_css_list.push(element.getAttribute("href")); settings.required_css_list.push(element.getAttribute("href"));
} else if (element.type === "text/javascript") { } else if (element.nodeName === "SCRIPT" &&
(element.type === "text/javascript" ||
!element.type)) {
settings.required_js_list.push(element.getAttribute("src")); settings.required_js_list.push(element.getAttribute("src"));
} else if (element.rel === "http://www.renderjs.org/rel/interface") { } else if (element.rel === "http://www.renderjs.org/rel/interface") {
settings.interface_list.push(element.getAttribute("href")); settings.interface_list.push(element.getAttribute("href"));
......
...@@ -298,6 +298,16 @@ ...@@ -298,6 +298,16 @@
}); });
}); });
test('Extract JS even if type="text/javascript" not set', function () {
var settings,
html = "<html><head>" +
"<script src='../lib/qunit/qunit.js'></script" +
"</head></html>";
settings = parseGadgetHTML(html, "http://test.org/foo");
deepEqual(settings.required_js_list,
["../lib/qunit/qunit.js"]);
});
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// declareGadgetKlass // declareGadgetKlass
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment