diff options
author | Valerio Virgillito | 2012-06-08 14:28:09 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-06-08 14:28:09 -0700 |
commit | bad5a44824ba35cbc7f4f4d245e32b90208f00c1 (patch) | |
tree | 2241353db29b247b2bf77e61485d77f15f6b5d2c | |
parent | fd3cde46dbdf28b5e1166773fe5e092e2bd865b6 (diff) | |
parent | d88e74c6aa8f4ce9aa58f966df2f63a09ee91f23 (diff) | |
download | ninja-bad5a44824ba35cbc7f4f4d245e32b90208f00c1.tar.gz |
Merge pull request #285 from joseeight/FileIO
Remove doc type from files and adding tag check for html
-rwxr-xr-x | js/document/mediators/template.js | 10 |
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) { |