Skip to content

Commit

Permalink
Merge pull request #85 from izhyvaiev/master
Browse files Browse the repository at this point in the history
Making history.state to be returned as copy, not reference in IE 8,9
  • Loading branch information
devote committed Dec 22, 2015
2 parents 115f04b + 64b6489 commit 13feff6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion history.ielte7.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,13 @@
*/
"state": {
get: function() {
return stateStorage[windowLocation.href] || null;
if (typeof stateStorage[windowLocation.href] === 'object') {
return JSON.parse(JSON.stringify(stateStorage[windowLocation.href]));
} else if(typeof stateStorage[windowLocation.href] !== 'undefined') {
return stateStorage[windowLocation.href];
} else {
return null;
}
}
}
};
Expand Down
8 changes: 7 additions & 1 deletion history.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,13 @@
*/
"state": {
get: function() {
return stateStorage[windowLocation.href] || null;
if (typeof stateStorage[windowLocation.href] === 'object') {
return JSON.parse(JSON.stringify(stateStorage[windowLocation.href]));
} else if(typeof stateStorage[windowLocation.href] !== 'undefined') {
return stateStorage[windowLocation.href];
} else {
return null;
}
}
}
};
Expand Down

0 comments on commit 13feff6

Please sign in to comment.