Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
strip CDATA from template strings
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmason committed Mar 17, 2014
1 parent bbcdb04 commit 6aa4a86
Showing 1 changed file with 16 additions and 0 deletions.
Expand Up @@ -34,6 +34,22 @@
}(function ($, tmpl) {
'use strict';

// templates are wrapped in cdata tags to keep JSF happy,
// so the template loading function is updated to strip them.
tmpl.load = (function (originalLoad) {
return function (id) {
return withoutCdataTag (originalLoad(id));
}

function withoutCdataTag (string) {
return (string.trim().indexOf("<![CDATA[") === 0) ? trimCdata(string) : string;
}

function trimCdata (string) {
return string.slice("<![CDATA[".length, string.lastIndexOf("]]>"));
}
})(tmpl.load)

$.blueimp.fileupload.prototype._specialOptions.push(
'filesContainer',
'uploadTemplateId',
Expand Down

0 comments on commit 6aa4a86

Please sign in to comment.