Issue #2550717 follow-up by bnjmnm, tedbow, lauriii: [JS] Replace jQuery.cookie with JS-cookie and provide a BC layer
parent
a130897f02
commit
4789c5a767
|
@ -666,5 +666,3 @@ js-cookie:
|
|||
gpl-compatible: true
|
||||
js:
|
||||
assets/vendor/js-cookie/js.cookie.min.js: {}
|
||||
dependencies:
|
||||
- core/drupal.object.assign
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
Loading…
Reference in New Issue