Permalink
Browse files

perf(js): Remove jquery-migrate and upgrade jquery to ^2.1.4

BREAKING CHANGE:

See http://jquery.com/upgrade-guide/1.9/ for how to move off jquery-migrate.

If you'd prefer to just add it back, you can use this code in your plugin's init:

```php
elgg_register_js('jquery-migrate', elgg_get_simplecache_url('jquery-migrate.js'), 'head');
elgg_load_js('jquery-migrate');
```

Also, define a `jquery-migrate.js` view containing the contents of the script.
  • Loading branch information...
ewinslow committed Jun 25, 2015
1 parent 61d9a0f commit 8f58da9868c90a2aee2e998bf552f9bea899d13e
View
@@ -21,14 +21,13 @@
"zendframework/zend-mail": "~2.4",
"league/flysystem": "~1.0",
"twistor/flysystem-memory-adapter": "~1.0",
"bower-asset/jquery": "^1.11.3",
"bower-asset/jquery": "^2.1.4",
"bower-asset/jquery-ui": "^1.11.4",
"bower-asset/text": "^2.0.4",
"bower-asset/requirejs": "^2.1.18",
"bower-asset/sprintf": "^0.7.0",
"bower-asset/jquery-form": "^3.51",
"bower-asset/jquery-colorbox": "^1.5.14",
"bower-asset/jquery-migrate": "^1.2.1",
"bower-asset/jquery-imgareaselect": "^0.9.0",
"bower-asset/jquery-ui-extensions": "dev-master",
"bower-asset/jquery-jeditable": "^1.7.3"
View
@@ -12,6 +12,25 @@ See the administrator guides for :doc:`how to upgrade a live site </admin/upgrad
From 1.x to 2.0
===============
Dropped ``jquery-migrate`` and upgraded ``jquery`` to ^2.1.4
------------------------------------------------------------
jQuery 2.x is API-compatible with 1.x, but drops support for IE8-, which Elgg
hasn't supported for some time anyways.
See http://jquery.com/upgrade-guide/1.9/ for how to move off jquery-migrate.
If you'd prefer to just add it back, you can use this code in your plugin's init:
.. code:: php
elgg_register_js('jquery-migrate', elgg_get_simplecache_url('jquery-migrate.js'), 'head');
elgg_load_js('jquery-migrate');
Also, define a ``jquery-migrate.js`` view containing the contents of the script.
JS and CSS views have been moved out of the js/ and css/ directories
--------------------------------------------------------------------
View
@@ -1514,9 +1514,6 @@ function elgg_views_boot() {
elgg_register_js('jquery', elgg_get_simplecache_url('jquery.js'), 'head');
elgg_load_js('jquery');
elgg_register_js('jquery-migrate', elgg_get_simplecache_url('jquery-migrate.js'), 'head');
elgg_load_js('jquery-migrate');
elgg_register_js('jquery-ui', elgg_get_simplecache_url('jquery-ui.js'), 'head');
elgg_load_js('jquery-ui');
View
@@ -9,20 +9,20 @@ elgg.ui.init = function () {
elgg.ui.initHoverMenu();
//if the user clicks a system message, make it disappear
$('.elgg-system-messages li').live('click', function() {
$(document).on('click', '.elgg-system-messages li', function() {
$(this).stop().fadeOut('fast');
});
$('.elgg-system-messages li').animate({opacity: 0.9}, 6000);
$('.elgg-system-messages li.elgg-state-success').fadeOut('slow');
$('[rel=toggle]').live('click', elgg.ui.toggles);
$(document).on('click', '[rel=toggle]', elgg.ui.toggles);
$('[rel=popup]').live('click', elgg.ui.popupOpen);
$(document).on('click', '[rel=popup]', elgg.ui.popupOpen);
$('.elgg-menu-page .elgg-menu-parent').live('click', elgg.ui.toggleMenu);
$(document).on('click', '.elgg-menu-page .elgg-menu-parent', elgg.ui.toggleMenu);
$('*[data-confirm], .elgg-requires-confirmation').live('click', elgg.ui.requiresConfirmation);
$(document).on('click', '*[data-confirm], .elgg-requires-confirmation', elgg.ui.requiresConfirmation);
if ($('.elgg-requires-confirmation').length > 0) {
elgg.deprecated_notice('Use of .elgg-requires-confirmation is deprecated by data-confirm', '1.10');
}
@@ -132,9 +132,9 @@ elgg.ui.popupOpen = function(event) {
.fadeIn()
.position(options);
$('body')
.die('click', elgg.ui.popupClose)
.live('click', elgg.ui.popupClose);
$(document)
.off('click', 'body', elgg.ui.popupClose)
.on('click', 'body', elgg.ui.popupClose);
};
/**
@@ -227,16 +227,16 @@ elgg.ui.initHoverMenu = function(parent) {
}
// avatar image menu link
$(parent).find(".elgg-avatar").live('mouseover', function() {
$(parent).on('mouseover', ".elgg-avatar", function() {
$(this).children(".elgg-icon-hover-menu").show();
})
.live('mouseout', function() {
.on('mouseout', '.elgg-avatar', function() {
$(this).children(".elgg-icon-hover-menu").hide();
});
// avatar contextual menu
$(".elgg-avatar > .elgg-icon-hover-menu").live('click', function(e) {
$(document).on('click', ".elgg-avatar > .elgg-icon-hover-menu", function(e) {
var $placeholder = $(this).parent().find(".elgg-menu-hover.elgg-ajax-loader");
if ($placeholder.length) {
@@ -375,7 +375,7 @@ elgg.ui.initDatePicker = function() {
*/
elgg.ui.registerTogglableMenuItems = function(menuItemNameA, menuItemNameB) {
// Handles clicking the first button.
$('.elgg-menu-item-' + menuItemNameA + ' a').live('click', function() {
$(document).on('click', '.elgg-menu-item-' + menuItemNameA + ' a', function() {
var $menu = $(this).closest('.elgg-menu');
// Be optimistic about success
@@ -400,7 +400,7 @@ elgg.ui.registerTogglableMenuItems = function(menuItemNameA, menuItemNameB) {
});
// Handles clicking the second button
$('.elgg-menu-item-' + menuItemNameB + ' a').live('click', function() {
$(document).on('click', '.elgg-menu-item-' + menuItemNameB + ' a', function() {
var $menu = $(this).closest('.elgg-menu');
// Be optimistic about success
View
@@ -26,9 +26,9 @@ elgg.ui.widgets.init = function() {
$('.elgg-widgets-add-panel li.elgg-state-available').click(elgg.ui.widgets.add);
$('a.elgg-widget-delete-button').live('click', elgg.ui.widgets.remove);
$('.elgg-widget-edit > form ').live('submit', elgg.ui.widgets.saveSettings);
$('a.elgg-widget-collapse-button').live('click', elgg.ui.widgets.collapseToggle);
$(document).on('click', 'a.elgg-widget-delete-button', elgg.ui.widgets.remove);
$(document).on('submit', '.elgg-widget-edit > form ', elgg.ui.widgets.saveSettings);
$(document).on('click', 'a.elgg-widget-collapse-button', elgg.ui.widgets.collapseToggle);
elgg.ui.widgets.setMinHeight(".elgg-widgets");
};
@@ -79,8 +79,7 @@ define(function(require) {
CKEDITOR.on('instanceReady', elggCKEditor.fixImageAttributes);
// Live handlers don't need to wait for domReady and only need to be registered once.
$('.ckeditor-toggle-editor').live('click', elggCKEditor.toggleEditor);
$(document).on('click', '.ckeditor-toggle-editor', elggCKEditor.toggleEditor);
return elggCKEditor;
});
@@ -4,22 +4,22 @@
elgg.embed.init = function() {
// inserts the embed content into the textarea
$(".embed-item").live('click', elgg.embed.insert);
$(document).on('click', ".embed-item", elgg.embed.insert);
elgg.register_hook_handler('embed', 'editor', elgg.embed._deprecated_custom_insert_js);
// caches the current textarea id
$(".embed-control").live('click', function() {
$(document).on('click', ".embed-control", function() {
var textAreaId = /embed-control-(\S)+/.exec($(this).attr('class'))[0];
elgg.embed.textAreaId = textAreaId.substr("embed-control-".length);
});
// special pagination helper for lightbox
$('.embed-wrapper .elgg-pagination a').live('click', elgg.embed.forward);
$(document).on('click', '.embed-wrapper .elgg-pagination a', elgg.embed.forward);
$('.embed-section').live('click', elgg.embed.forward);
$(document).on('click', '.embed-section', elgg.embed.forward);
$('.elgg-form-embed').live('submit', elgg.embed.submit);
$(document).on('submit', '.elgg-form-embed', elgg.embed.submit);
};
/**
@@ -3,7 +3,7 @@
elgg.messageboard.init = function() {
var form = $('form[name=elgg-messageboard]');
form.find('input[type=submit]').live('click', elgg.messageboard.submit);
form.on('click', 'input[type=submit]', elgg.messageboard.submit);
// remove the default binding for confirmation since we're doing extra stuff.
// @todo remove if we add a hook to the requires confirmation callback
@@ -4,9 +4,9 @@
elgg.provide('elgg.site_notifications');
elgg.site_notifications.init = function() {
$('.site-notifications-delete').live('click', elgg.site_notifications.delete);
$('.site-notifications-link').live('click', elgg.site_notifications.auto_delete);
$('#site-notifications-toggle').live('click', elgg.site_notifications.toggle_all);
$(document).on('click', '.site-notifications-delete', elgg.site_notifications.delete);
$(document).on('click', '.site-notifications-link', elgg.site_notifications.auto_delete);
$(document).on('click', '#site-notifications-toggle', elgg.site_notifications.toggle_all);
};
/**
@@ -11,12 +11,8 @@ elgg.thewire.init = function() {
}
};
$("#thewire-textarea").live({
input: callback,
onpropertychange: callback
});
$(".thewire-previous").live('click', elgg.thewire.viewPrevious);
$(document).on('input propertychange', "#thewire-textarea", callback);
$(document).on('click', ".thewire-previous", elgg.thewire.viewPrevious);
};
/**
@@ -55,7 +55,7 @@ define(['jquery', 'elgg', 'jquery.ui.autocomplete.html'], function ($, elgg) {
}
});
$('.elgg-user-picker-remove', this.$wrapper).live('click', function(event) {
this.$wrapper.on('click', '.elgg-user-picker-remove', function(event) {
self.removeUser(event);
});
@@ -11,8 +11,8 @@ define(function(require) {
function init () {
// system messages do not fade in admin area, instead slide up when clicked
$('.elgg-system-messages li').stop(true);
$('.elgg-system-messages li').die('click');
$('.elgg-system-messages li').live('click', function() {
$(document).off('click', '.elgg-system-messages li');
$(document).on('click', '.elgg-system-messages li', function() {
$(this).stop().slideUp('medium');
});
@@ -22,7 +22,7 @@
$('.forgot_link').click(elgg.walled_garden.load('lost_password'));
$('.registration_link').click(elgg.walled_garden.load('register'));
$('input.elgg-button-cancel').live('click', function(event) {
$(document).on('click', 'input.elgg-button-cancel', function(event) {
var $wgs = $('.elgg-walledgarden-single');
if ($wgs.is(':visible')) {
$('.elgg-walledgarden-double').fadeToggle();

0 comments on commit 8f58da9

Please sign in to comment.