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/document/mediators') 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 From d716a08ab4e250dba817a222c3416f2e325beff7 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Sat, 9 Jun 2012 21:00:09 -0700 Subject: Re-adding temp doc type Adding a demo fix to include the document type, it is removed because comments are not supported currently, so we must added in manually. The YouTube component breaks, it does not support any doctype, hence, the component must have a bug filed against it, we MUST include doc types with our files. --- js/document/mediators/template.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/document/mediators') diff --git a/js/document/mediators/template.js b/js/document/mediators/template.js index 4c72314a..50fad1c3 100755 --- a/js/document/mediators/template.js +++ b/js/document/mediators/template.js @@ -613,8 +613,8 @@ exports.TemplateDocumentMediator = Montage.create(Component, { } else { 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 = cleanHTML; + //TODO: Remove, this is a temp hack to maintain a doc type on HTML files + cleanHTML = ''+cleanHTML; // function parseNinjaRootUrl(url) { if (url.indexOf(this.application.ninja.coreIoApi.rootUrl) !== -1) { -- cgit v1.2.3