From 212f8c6f0fa62f4ee99fcfa755cfa588391c4c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20J=C3=B8rgensen?= Date: Tue, 23 Sep 2014 12:00:21 +0200 Subject: [PATCH] Added H5P.htmlspecialchars() --- js/h5p.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/h5p.js b/js/h5p.js index 3b5db69..0500cc9 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -975,6 +975,13 @@ H5P.setFinished = function (contentId, points, maxPoints) { } }; +/** + * Mimics how php's htmlspecialchars works (the way we use it) + */ +H5P.htmlspecialchars = function(string) { + return string.toString().replace(//g, '>').replace(/'/g, ''').replace(/"/g, '"'); +}; + // Add indexOf to browsers that lack them. (IEs) if (!Array.prototype.indexOf) { Array.prototype.indexOf = function (needle) {