This is the particular behaviour that has been causing problems in IE8
/**
* Sends a 'formUpdated' event each time a form element is modified.
*/
Drupal.behaviors.formUpdated = {
attach: function (context) {
// These events are namespaced so that we can remove them later.
var events = 'change.formUpdated click.formUpdated blur.formUpdated keyup.formUpdated';
$(context)
// Since context could be an input element itself, it's added back to
// the jQuery object and filtered again.
.find(':input').andSelf().filter(':input')
// To prevent duplicate events, the handlers are first removed and then
// (re-)added.
.unbind(events).bind(events, function () {
$(this).trigger('formUpdated');
});
}
};
I changed it to
/**
* Sends a 'formUpdated' event each time a form element is modified.
*/
Drupal.behaviors.formUpdated = {
attach: function (context) {
// These events are namespaced so that we can remove them later.
var events = 'change.formUpdated click.formUpdated blur.formUpdated keyup.formUpdated';
$(context).undelegate(':input', events);
$(context).delegate(':input', events, function () {
$(this).trigger('formUpdated');
}
);
}
};
This seems to improve the performance a lot on that page in IE8
Comments?
Comments
Comment #1
catchMoving this to the right queue.
Comment #2
nod_That's the way to go. Needs to change across all of core too. I think the jQuery method changed in the newer version D8 is using (will be using soon).
Comment #3
gitesh.koli commentedPlease find attached the patch for 7.x version
Comment #4
attiks commented@gitesh.koli needs to be fixed for D8 first, can you make a patch?
Comment #5
gitesh.koli commentedD8 version of the patch. (using on and off function instead of delegate and undelegate)
Comment #6
nod_Comment #8
gitesh.koli commentedpatch against the latest D7 version.
Comment #9
gitesh.koli commentedD8 version of the patch
Comment #10
JamesK commentedtest bot
Comment #11
gitesh.koli commented#8: 1515734-form-js-changes-d7-1.patch queued for re-testing.
Comment #12
JamesK commentedThis should not be removed:
Comment #13
nod_I'd like this to do some more work and trigger the event on the actual
<form>with a custom parameter containing a DOM node of the changed form element.This issue would more or less be what's needed for step 1 of #1636992: form.js' formUpdated event is unreliable/incomplete but we need to check that the form has actually been updated before firing the event. As it is now it's pretty useless.
Comment #14
wim leersComment #15
wim leers#9: 1515734-form-js-changes-d8-1.patch queued for re-testing.
Comment #17
nod_See #1685146-8: Refactor form.js