Skip to content
Snippets Groups Projects

Issue #3422505: Use once() and context.

3 files
+ 6
4
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 4
2
@@ -12,14 +12,16 @@
Drupal.behaviors.nodeEditProtection = {
attach : function(context) {
// If they leave an input field, assume they changed it.
$(".node-form :input").each(function() {
// The ':input' selector only works in jQuery, therefore the $(...) is
// needed.
$(once('node-edit-protection-input', $('.node-form :input'), context)).each(function() {
$(this).blur(function() {
edit = true;
});
});
// Let all form submit buttons through.
$(".node-form input[type='submit'], .node-form button[type='submit']").each(function() {
$(once('node-edit-protection-submit', '.node-form :is(input,button)[type="submit"]', context)).each(function() {
$(this).addClass('node-edit-protection-processed');
$(this).click(function() {
click = true;
Loading