From 3eeaf81e641dec78fdb84cb5bf79d449c54f729e Mon Sep 17 00:00:00 2001 From: euzuro Date: Mon, 11 Jun 2007 19:28:48 +0000 Subject: [PATCH] rollback r3284, reopening #734. This patch causes tests to break in IE6. I will help to debug this at some point, but right now I am doing other things and I need all tests to pass or I can't move forward. git-svn-id: http://svn.openlayers.org/trunk/openlayers@3317 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Util.js | 18 +++--------------- tests/test_Util.html | 12 ------------ 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js index d9970e0580..c57a990216 100644 --- a/lib/OpenLayers/Util.js +++ b/lib/OpenLayers/Util.js @@ -609,27 +609,15 @@ OpenLayers.Util.getArgs = function(url) { if(url == null) { url = window.location.href; } - - var start = url.indexOf('?'); - var stop = url.indexOf('#'); - - if (start != -1) { - if (stop != -1) { - var query = url.substring(start + 1, stop); - } else { - var query = url.substring(start + 1); - } - } else { - return {}; - } - + var query = (url.indexOf('?') != -1) ? url.substring(url.indexOf('?') + 1) + : ''; var args = new Object(); pairs = query.split(/[&;]/); for(var i = 0; i < pairs.length; ++i) { keyValue = pairs[i].split(/=/); if(keyValue.length == 2) { args[decodeURIComponent(keyValue[0])] = - decodeURIComponent(keyValue[1]) || ''; + decodeURIComponent(keyValue[1]); } } return args; diff --git a/tests/test_Util.html b/tests/test_Util.html index f5032854dc..756713f9e1 100644 --- a/tests/test_Util.html +++ b/tests/test_Util.html @@ -571,18 +571,6 @@ t.eq(OpenLayers.Util.createDiv().id, "OpenLayersDiv3", "Div created is sequential, starting at lastSeqID in Util."); } - function test_Util_getArgs(t) { - t.plan(5); - t.eq(OpenLayers.Util.getArgs('http://www.example.com'), {}, "getArgs works when args = ''"); - t.eq(OpenLayers.Util.getArgs('http://www.example.com?'), {}, "getArgs works when args = '?'"); - t.eq(OpenLayers.Util.getArgs('http://www.example.com?hello=world&foo=bar'), - {'hello' : 'world', 'foo': 'bar'}, "getArgs works when args = '?hello=world&foo=bar'"); - t.eq(OpenLayers.Util.getArgs('http://www.example.com?hello=&foo=bar'), - {'hello' : '', 'foo': 'bar'}, "getArgs works when args = '?hello=&foo=bar'"); - t.eq(OpenLayers.Util.getArgs('http://www.example.com?foo=bar#bugssucks'), - {'foo': 'bar'}, "getArgs works when using a fragment identifier"); - } - // -->