diff --git a/js/flashcards.js b/js/flashcards.js index e0eff97..b31bd6b 100644 --- a/js/flashcards.js +++ b/js/flashcards.js @@ -153,6 +153,14 @@ H5P.Flashcards = (function ($) { } var correct = correctAnswer.toLowerCase().split('/'); var userAnswer = H5P.trim($input.val()).toLowerCase(); + + // Escape html characters + userAnswer = userAnswer.replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); + var userCorrect = false; for (var i = 0; i < correct.length; i++) { if (H5P.trim(correct[i]) === userAnswer) { @@ -198,6 +206,7 @@ H5P.Flashcards = (function ($) { if (index === 0) { this.setCurrent($card); } + }; C.prototype.setProgress = function () { diff --git a/library.json b/library.json index e27dd58..e1ccc8e 100644 --- a/library.json +++ b/library.json @@ -3,7 +3,7 @@ "description": "Create cards where the user has to guess the answer.", "majorVersion": 1, "minorVersion": 2, - "patchVersion": 3, + "patchVersion": 4, "runnable": 1, "author": "Joubel AS", "coreApi": {