diff options
author | Jose Antonio Marquez | 2012-06-08 11:24:10 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-06-08 11:24:10 -0700 |
commit | d88e74c6aa8f4ce9aa58f966df2f63a09ee91f23 (patch) | |
tree | 086e8be214a080d6606ddf1f4ce6c160565d0cbb | |
parent | d14249dd2d76e9eb8d14733c10393d36bd2ea8ee (diff) | |
download | ninja-d88e74c6aa8f4ce9aa58f966df2f63a09ee91f23.tar.gz |
Remove doc type from files and adding tag check for html
Removed the HTML5 doctype from files since it was break the YouTube component, also made a fix to check for the HTML tag to be present when copying attributes.
-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) { |