question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there any way to exclude element to be inspected?

See original GitHub issue

Hey, thanks for this lib, you did a great job!

Use Case:

I’m creating a lib which creates a kind of online inspector for the current website when my script is injected on the browser. In order words, when a user adds my script to its website, it injects a kind of toolbar allowing him to perform some actions such as activating or deactivating the dom-inspector. Since I can’t know in advance the website structure, I set by default the dom inspector root target as body. This work well except that when the inspector is activated it also inspect my injected toolbar which is a behavior I would like to avoid.

Question:

Is there any way to give ‘non-inspectable elements selectors’ during the initialization of the inspector? Something like:

const inspector = new DomInspector({
	root: 'body',
        except: ['#do-not-inspect-this', '.nor-this'],
});

I’m almost sure it’s not possible right now, but do you have any hint about how to implement it, and are you open to an eventual pull request?

Thanks in advance for considering my request 😃

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
luoye-fecommented, Dec 11, 2018

In theory, the except option will not inspect itself and all children.

Well, if use recursive option to avoid this case, will make api so complex.

So if want to inspect children on except parent node, I think we can new another inspector on children.

Just like:

const bodyInspector = new DomInspector({
	root: 'body',
        except: ['#do-not-inspect-this', document.querySelectorAll('.nor-this')],
});

const anotherInspector = new DomInspector({
        root: '#do-not-inspect-this>div'
})
0reactions
luoye-fecommented, Mar 16, 2019

close it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to remove "Inspect Element"? - Stack Overflow
It's easy, just press F6 and then press F12 .
Read more >
Remove Anything with Inspect Element Custom CSS - YouTube
Learn how to quickly remove any part of your WordPress website using inspect element and writing some custom css and the display none ......
Read more >
1173504 - Allow to remove elements while inspecting
1 - click on the element picker icon 2 - start moving your mouse over elements in the page 3 - as you...
Read more >
Is there a software that'll automatically remove a certain block ...
It is not really possible to completely block inspect element on your website. But you can block some popular ways of accessing it....
Read more >
How to delete HTML tags without opening Inspect Element?
Is there any fastest way of deleting HTML tags? My current routine was: Open a webpage. Send keys for short cut of Inspect...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found