From 54040c273edfafd5012a1fa002c837e4241f57d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20J=C3=B8rgensen?= Date: Tue, 9 Jul 2013 10:36:27 +0200 Subject: [PATCH] Implemented String.prototype.trim if not defined to support IE8 --- js/h5p.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/h5p.js b/js/h5p.js index 0c1aaea..20dbcf1 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -298,6 +298,14 @@ if(!Array.prototype.indexOf) { }; } +// Need to define trim() since this is not available on older IEs, +// and trim is used in several libs +if(String.prototype.trim === undefined) { + String.prototype.trim = function () { + return H5P.trim(this); + }; +} + // Simple 'contains' function. Easier to use than keep testing indexOf to -1. Array.prototype.contains = function (needle) { return (this.indexOf(needle) > -1);