aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/document/mediators/template.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/js/document/mediators/template.js b/js/document/mediators/template.js
index e04c16d9..4c72314a 100755
--- a/js/document/mediators/template.js
+++ b/js/document/mediators/template.js
@@ -93,9 +93,11 @@ exports.TemplateDocumentMediator = Montage.create(Component, {
93 hackTag = hackHtml.getElementsByTagName('ninjahtmlhack')[0]; 93 hackTag = hackHtml.getElementsByTagName('ninjahtmlhack')[0];
94 docHtmlTag = doc.getElementsByTagName('html')[0]; 94 docHtmlTag = doc.getElementsByTagName('html')[0];
95 //Looping through the attributes to copy them 95 //Looping through the attributes to copy them
96 for (var m in hackTag.attributes) { 96 if (hackTag) {
97 if (hackTag.attributes[m].value) { 97 for (var m in hackTag.attributes) {
98 docHtmlTag.setAttribute(hackTag.attributes[m].name.replace(/ninjahtmlhack/gi, 'html'), hackTag.attributes[m].value.replace(/ninjahtmlhack/gi, 'html')); 98 if (hackTag.attributes[m].value) {
99 docHtmlTag.setAttribute(hackTag.attributes[m].name.replace(/ninjahtmlhack/gi, 'html'), hackTag.attributes[m].value.replace(/ninjahtmlhack/gi, 'html'));
100 }
99 } 101 }
100 } 102 }
101 //Garbage collection 103 //Garbage collection
@@ -612,7 +614,7 @@ exports.TemplateDocumentMediator = Montage.create(Component, {
612 cleanHTML = template.file.content.document.documentElement.outerHTML.replace(/(\b(?:(?:https?|ftp|file|[A-Za-z]+):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$]))/gi, parseNinjaRootUrl.bind(this)); 614 cleanHTML = template.file.content.document.documentElement.outerHTML.replace(/(\b(?:(?:https?|ftp|file|[A-Za-z]+):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$]))/gi, parseNinjaRootUrl.bind(this));
613 } 615 }
614 //TODO: Remove, this is a temp hack 616 //TODO: Remove, this is a temp hack
615 cleanHTML = '<!DOCTYPE html>\n'+cleanHTML; 617 cleanHTML = cleanHTML;
616 // 618 //
617 function parseNinjaRootUrl(url) { 619 function parseNinjaRootUrl(url) {
618 if (url.indexOf(this.application.ninja.coreIoApi.rootUrl) !== -1) { 620 if (url.indexOf(this.application.ninja.coreIoApi.rootUrl) !== -1) {