Pointless code: The "all links and buttons" part has no effect

Created on 19 February 2024, 9 months ago
Updated 11 March 2024, 9 months ago

Problem/Motivation

This snippet in the js seems to have no effect:

      // Catch all links and buttons EXCEPT for "#" links.
      $("a, button, input[type='submit']:not(.node-edit-protection-processed), button[type='submit']:not(.node-edit-protection-processed)")
          .each(function() {
            $(this).click(function() {
              // Return when a "#" link is clicked so as to skip the
              // window.onbeforeunload function.
              if (edit && $(this).attr("href") != "#") {
                return 0;
              }
            });
          });

To make a difference, it would have to return false instead of 0.
But it is also questionable whether this would be a good thing.

Steps to reproduce

Delete the snippet, or let it return null or undefined instead of 0.

The behavior is still the same.

Proposed resolution

Remove the complete part.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇩🇪Germany donquixote

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024