Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a bug where 'Inspect element' would always inspect the same element. Fixed some typos. #10

Merged
merged 3 commits into from
Jul 20, 2017

Conversation

bbqjohan
Copy link

@bbqjohan bbqjohan commented Jun 6, 2017

When you inspected your first element, it and its position was cached when creating the context menu. So the same element and position would always be passed into inspectMenuTemplate() whenever you tried to inspect another element.

I stored the element and the coordinates in variables outside the functions to fix this. You could also just remove the if statement on line 42, so this:

function onContextMenu(e) {
  if (menu === null) {
    menu = inpectElementMenu({x: e.x, y: e.y}, ifInspectable(e.target));
  }

becomes:

function onContextMenu(e) {
    menu = inpectElementMenu({x: e.x, y: e.y}, ifInspectable(e.target));

without needing to changing anything else. But that would create a new menu every time you right-click, and I thought that was something you didn't want.

Also fixed some typos I found.

@bbqjohan bbqjohan changed the title Fixed a bug where 'Inspect element' would always inspect the same element. Fixed a bug where 'Inspect element' would always inspect the same element. Fixed some typos. Jun 6, 2017
@parro-it parro-it self-assigned this Jun 6, 2017
@parro-it
Copy link
Owner

parro-it commented Jun 6, 2017

@bbqjohan, thank you for the patch!

But that would create a new menu every time you right-click, and I thought that was something you didn't want.

Unfortunately, this does not work when using debug-menu as middleware,
because here the inpectElementMenu has to still support arguments.

Could you change that part also? You'll have to manually set posX, posY and elm variable before calling
inspectMenuTemplate

@bbqjohan
Copy link
Author

bbqjohan commented Jun 6, 2017

@parro-it

There, fixed! ^_^

@parro-it parro-it merged commit 009f392 into parro-it:master Jul 20, 2017
@parro-it
Copy link
Owner

Thank you @bbqjohan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants