Issue #2550717 follow-up by bnjmnm, tedbow, lauriii: [JS] Replace jQuery.cookie with JS-cookie and provide a BC layer

merge-requests/2419/head
Lauri Eskola 2020-03-19 20:01:02 +02:00
parent a130897f02
commit 4789c5a767
No known key found for this signature in database
GPG Key ID: 37E6EF00B7EEF188
3 changed files with 4 additions and 6 deletions

View File

@ -666,5 +666,3 @@ js-cookie:
gpl-compatible: true
js:
assets/vendor/js-cookie/js.cookie.min.js: {}
dependencies:
- core/drupal.object.assign

View File

@ -120,7 +120,7 @@
if (value !== undefined && !isFunction(value)) {
// The caller is setting a cookie value and not trying to retrieve the
// cookie value using a converter callback.
const attributes = Object.assign($.cookie.defaults, options);
const attributes = { ...$.cookie.defaults, ...options };
if (!$.cookie.json) {
// An object that is passed in must be typecast to a string when the
@ -201,7 +201,7 @@
Drupal.deprecationError({
message: `jQuery.removeCookie() ${deprecatedMessageSuffix}`,
});
cookies.remove(key, Object.assign($.cookie.defaults, options));
cookies.remove(key, { ...$.cookie.defaults, ...options });
return !cookies.get(key);
};
})(jQuery, Drupal, window.Cookies);

View File

@ -44,7 +44,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
});
if (value !== undefined && !isFunction(value)) {
var attributes = Object.assign($.cookie.defaults, options);
var attributes = _objectSpread({}, $.cookie.defaults, {}, options);
if (!$.cookie.json) {
value = String(value);
@ -79,7 +79,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
Drupal.deprecationError({
message: "jQuery.removeCookie() ".concat(deprecatedMessageSuffix)
});
cookies.remove(key, Object.assign($.cookie.defaults, options));
cookies.remove(key, _objectSpread({}, $.cookie.defaults, {}, options));
return !cookies.get(key);
};
})(jQuery, Drupal, window.Cookies);