Skip to content

Commit

Permalink
Update main.js (#3)
Browse files Browse the repository at this point in the history
Recently GitHub has updated their HTML for the GitHub Squash and Merge button, and was causing this error:
Uncaught TypeError: Cannot read property 'getAttribute' of null
    at scanForSquashAndMergeButtons (main.js:39)
    at poll (main.js:61)

The reason being is that the button was no longer with a type=submit and therefore was a null. It then failed when we tried to getAttribute of this null variable.

I updated the query selector to find the button correctly with the new introduced updates.
  • Loading branch information
yarneo authored Feb 11, 2019
1 parent 34511d7 commit fabd2f6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
if (!squashContainer) {
return;
}
var squashButton = squashContainer.querySelector('button[type="submit"]');
var squashButton = squashContainer.querySelector('button[data-details-container=".js-merge-pr"]');

if (squashButton.getAttribute('squashmerge')) {
return;
Expand Down

0 comments on commit fabd2f6

Please sign in to comment.