Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Upgrade jquery to 1.12 #1353

Conversation

GuySartorelli
Copy link
Member

@GuySartorelli GuySartorelli commented Aug 29, 2022

A slightly different approach from #1352

  • This approach has updated jquery UI from the thirdparty dir, but has completely removed jquery itself from there in favour of installing it via yarn.
  • There are various small changes in src javascript code to resolve bugs - they are not all the best resolutions, this was just a POC to see how far I could get.
  • I tried updating entwine from https://github.com/hafriedlander/jquery.entwine but I didn't see any new issues arise or existing issues resolved from doing so - so I reverted back to what was already in admin.
  • I manually removed some code from entwine which was causing problems - that code is in both the original and updated versions so updating wouldn't resolve that part.

There are comments in files changed about why some changes were made.

Parent issue

Comment on lines +127 to +128
const offset = activeTab.offset();
padding = offset ? (offset.top - containerSouth.offset().top) : 0;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New tabs are now an empty object - there is no offset() function on them - so this just checks if there was an offset or not to avoid "that is undefined" error.


// this._super();
// return;
// }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be replaced with some more appropriate third-party solution - for now I removed it because jquery doesn't have a browser property anymore.

Comment on lines -751 to -779

/**
* Add focusin and focusout support to bind and live for browers other than IE. Designed to be usable in a delegated fashion (like $.live)
* Copyright (c) 2007 Jörn Zaefferer
*/
if ($.support.focusinBubbles === undefined) {
$.support.focusinBubbles = !!($.browser.msie);
}

if (!$.support.focusinBubbles && !$.event.special.focusin) {
// Emulate focusin and focusout by binding focus and blur in capturing mode
$.each({focus: 'focusin', blur: 'focusout'}, function(original, fix){
$.event.special[fix] = {
setup: function(){
if (!this.addEventListener) return false;
this.addEventListener(original, $.event.special[fix].handler, true);
},
teardown: function(){
if (!this.removeEventListener) return false;
this.removeEventListener(original, $.event.special[fix].handler, true);
},
handler: function(e){
arguments[0] = $.event.fix(e);
arguments[0].type = fix;
return $.event.handle.apply(this, arguments);
}
};
});
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$.support is deprecated and $.browser doesn't exist - and anyway we aren't interested in supporting such old browsers so the easy fix to the errors this caused was to remove it.

Comment on lines -1468 to -1484
/** Taken from jQuery 1.5.2 for backwards compatibility */
if ($.support.changeBubbles == undefined) {
$.support.changeBubbles = true;

var el = document.createElement("div");
eventName = "onchange";

if (el.attachEvent) {
var isSupported = (eventName in el);
if (!isSupported) {
el.setAttribute(eventName, "return;");
isSupported = typeof el[eventName] === "function";
}

$.support.changeBubbles = isSupported;
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$.support is deprecated - and anyway we aren't interested in supporting such old browsers so the easy fix to the errors this caused was to remove it.

@GuySartorelli
Copy link
Member Author

Closing in favor of #1375

@GuySartorelli GuySartorelli deleted the pulls/1/poc-jquery-upgrade branch October 4, 2022 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant