Skip to content

Commit

Permalink
Merge pull request woocommerce#10547 from mikebronner/patch-1
Browse files Browse the repository at this point in the history
Add tests for localStorage
  • Loading branch information
mikejolley committed Mar 14, 2016
2 parents 571956d + de85e5b commit ed36b1b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions assets/js/frontend/cart-fragments.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ jQuery( function( $ ) {

/* Storage Handling */
var $supports_html5_storage;

try {
$supports_html5_storage = ( 'sessionStorage' in window && window.sessionStorage !== null );
window.sessionStorage.setItem( 'wc', 'test' );
window.sessionStorage.removeItem( 'wc' );
window.localStorage.setItem( 'wc', 'test' );
window.localStorage.removeItem( 'wc' );
} catch( err ) {
$supports_html5_storage = false;
}
Expand Down

0 comments on commit ed36b1b

Please sign in to comment.