From d88e74c6aa8f4ce9aa58f966df2f63a09ee91f23 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Fri, 8 Jun 2012 11:24:10 -0700 Subject: 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. --- js/document/mediators/template.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'js') 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, { hackTag = hackHtml.getElementsByTagName('ninjahtmlhack')[0]; docHtmlTag = doc.getElementsByTagName('html')[0]; //Looping through the attributes to copy them - for (var m in hackTag.attributes) { - if (hackTag.attributes[m].value) { - docHtmlTag.setAttribute(hackTag.attributes[m].name.replace(/ninjahtmlhack/gi, 'html'), hackTag.attributes[m].value.replace(/ninjahtmlhack/gi, 'html')); + if (hackTag) { + for (var m in hackTag.attributes) { + if (hackTag.attributes[m].value) { + docHtmlTag.setAttribute(hackTag.attributes[m].name.replace(/ninjahtmlhack/gi, 'html'), hackTag.attributes[m].value.replace(/ninjahtmlhack/gi, 'html')); + } } } //Garbage collection @@ -612,7 +614,7 @@ exports.TemplateDocumentMediator = Montage.create(Component, { 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)); } //TODO: Remove, this is a temp hack - cleanHTML = '\n'+cleanHTML; + cleanHTML = cleanHTML; // function parseNinjaRootUrl(url) { if (url.indexOf(this.application.ninja.coreIoApi.rootUrl) !== -1) { -- cgit v1.2.3