aboutsummaryrefslogtreecommitdiff
path: root/js/document/mediators
diff options
context:
space:
mode:
authorValerio Virgillito2012-06-11 14:10:08 -0700
committerValerio Virgillito2012-06-11 14:10:08 -0700
commitf4ad120c1a0d8594b8741eb1b07fdbd4fefcadeb (patch)
tree5dff803d67722595418e69f6cce9ec8a1a616f2f /js/document/mediators
parent30f17ae934ee60ed6e4ce52fad1eebc35fc5914a (diff)
parent756cbfad2b98b300af8db3793aa21718b88dd950 (diff)
downloadninja-f4ad120c1a0d8594b8741eb1b07fdbd4fefcadeb.tar.gz
Merge branch 'refs/heads/master' into dom-container
Diffstat (limited to 'js/document/mediators')
-rwxr-xr-xjs/document/mediators/template.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/js/document/mediators/template.js b/js/document/mediators/template.js
index e04c16d9..50fad1c3 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
@@ -611,8 +613,8 @@ exports.TemplateDocumentMediator = Montage.create(Component, {
611 } else { 613 } else {
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 to maintain a doc type on HTML files
615 cleanHTML = '<!DOCTYPE html>\n'+cleanHTML; 617 cleanHTML = '<!DOCTYPE html>'+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) {