--- a/wp/wp-admin/js/farbtastic.js Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-admin/js/farbtastic.js Fri Sep 05 18:40:08 2025 +0200
@@ -1,9 +1,15 @@
/*!
* Farbtastic: jQuery color picker plug-in v1.3u
+ * https://github.com/mattfarina/farbtastic
*
* Licensed under the GPL license:
* http://www.gnu.org/licenses/gpl.html
*/
+/**
+ * Modified for WordPress: replaced deprecated jQuery methods.
+ * See https://core.trac.wordpress.org/ticket/57946.
+ */
+
(function($) {
$.fn.farbtastic = function (options) {
@@ -49,7 +55,7 @@
fb.linkTo = function (callback) {
// Unbind previous nodes
if (typeof fb.callback == 'object') {
- $(fb.callback).unbind('keyup', fb.updateValue);
+ $(fb.callback).off('keyup', fb.updateValue);
}
// Reset color
@@ -61,7 +67,7 @@
}
else if (typeof callback == 'object' || typeof callback == 'string') {
fb.callback = $(callback);
- fb.callback.bind('keyup', fb.updateValue);
+ fb.callback.on('keyup', fb.updateValue);
if (fb.callback.get(0).value) {
fb.setColor(fb.callback.get(0).value);
}
@@ -116,7 +122,7 @@
fb.mousedown = function (event) {
// Capture mouse
if (!document.dragging) {
- $(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup);
+ $(document).on('mousemove', fb.mousemove).on('mouseup', fb.mouseup);
document.dragging = true;
}
@@ -155,8 +161,8 @@
*/
fb.mouseup = function () {
// Uncapture mouse
- $(document).unbind('mousemove', fb.mousemove);
- $(document).unbind('mouseup', fb.mouseup);
+ $(document).off('mousemove', fb.mousemove);
+ $(document).off('mouseup', fb.mouseup);
document.dragging = false;
};
@@ -262,7 +268,7 @@
};
// Install mousedown handler (the others are set on the document on-demand)
- $('*', e).mousedown(fb.mousedown);
+ $('*', e).on('mousedown', fb.mousedown);
// Init color
fb.setColor('#000000');