aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/lib/elgglib.js4
-rw-r--r--js/tests/ElggLibTest.js10
2 files changed, 12 insertions, 2 deletions
diff --git a/js/lib/elgglib.js b/js/lib/elgglib.js
index af2c94000..cea2d0cdb 100644
--- a/js/lib/elgglib.js
+++ b/js/lib/elgglib.js
@@ -474,8 +474,8 @@ elgg.parse_str = function(string) {
re = /([^&=]+)=?([^&]*)/g;
while (result = re.exec(string)) {
- key = decodeURIComponent(result[1])
- value = decodeURIComponent(result[2])
+ key = decodeURIComponent(result[1].replace(/\+/g,' '))
+ value = decodeURIComponent(result[2].replace(/\+/g,' '))
params[key] = value;
}
diff --git a/js/tests/ElggLibTest.js b/js/tests/ElggLibTest.js
index 31b561923..21c6cb214 100644
--- a/js/tests/ElggLibTest.js
+++ b/js/tests/ElggLibTest.js
@@ -128,3 +128,13 @@ ElggLibTest.prototype.testParseUrl = function() {
});
};
+ElggLibTest.prototype.testParseStr = function() {
+
+ [
+ ["A+%2B+B", "A + B"]
+
+ ].forEach(function(args) {
+ assertEquals(args[1], elgg.parse_str(args[0]));
+ });
+};
+