* Creates a new resource loader. You should generally not create you own
* resource loader, but instead use {@link ResourceLoader#get()} to get an
* instance.
*/
protected ResourceLoader() {
Document document = Document.get();
head = document.getElementsByTagName("head").getItem(0);
// detect already loaded scripts and stylesheets
NodeList<Element> scripts = document.getElementsByTagName("script");
for (int i = 0; i < scripts.getLength(); i++) {
ScriptElement element = ScriptElement.as(scripts.getItem(i));
String src = element.getSrc();
if (src != null && src.length() != 0) {
loadedResources.add(src);
}
}
NodeList<Element> links = document.getElementsByTagName("link");
for (int i = 0; i < links.getLength(); i++) {
LinkElement linkElement = LinkElement.as(links.getItem(i));
String rel = linkElement.getRel();
String href = linkElement.getHref();
if ("stylesheet".equalsIgnoreCase(rel) && href != null