Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:asual/jquery-address

  • Loading branch information...
commit 4f0964fa7148d957230073f06d154552fa0a1bac 2 parents 961a6e1 + 8cea93a
@asual authored
Showing with 19 additions and 3 deletions.
  1. +3 −3 src/jquery.address.js
  2. +16 −0 test/test.js
View
6 src/jquery.address.js
@@ -84,7 +84,7 @@
_listen = function() {
if (!_silent) {
var hash = _href(),
- diff = _value != hash;
+ diff = decodeURI(_value) != decodeURI(hash);
if (diff) {
if (_msie && _version < 7) {
_l.reload();
@@ -122,7 +122,7 @@
},
_html = function() {
var src = _js() + ':' + FALSE + ';document.open();document.writeln(\'<html><head><title>' +
- _d.title.replace(/\'/g, '\\\'') + '</title><script>var ' + ID + ' = "' + _href() +
+ _d.title.replace(/\'/g, '\\\'') + '</title><script>var ' + ID + ' = "' + encodeURIComponent(_href()).replace(/\'/g, '\\\'') +
(_d.domain != _l.hostname ? '";document.domain="' + _d.domain : '') +
'";</' + 'script></head></html>\');document.close();';
if (_version < 7) {
@@ -248,7 +248,7 @@
_st(fn, delay);
},
_popstate = function() {
- if (_value != _href()) {
+ if (decodeURI(_value) != decodeURI(_href())) {
_value = _href();
_update(FALSE);
}
View
16 test/test.js
@@ -243,6 +243,22 @@ asyncTest('Character test', function() {
}, 1000);
});
+asyncTest('Single quote test', function() {
+ setTimeout(function() {
+ var externalChange = 0;
+ var testFunction = function() {
+ externalChange++;
+ equals(externalChange, 0);
+ };
+ var ignore = false;
+ $.address.value('/')
+ .bind('externalChange', testFunction)
+ .parameter('p', "Patrick's Test")
+ .unbind('externalChange', testFunction);
+ start();
+ }, 1000);
+});
+
asyncTest('Value test', function() {
setTimeout(function() {
$.address.value(1);
Please sign in to comment.
Something went wrong with that request. Please try again.