luoye-fe/dom-inspector

More precise selection

Closed this issue · 5 comments

Hi,
I'm using the dom inspector and it works great!
I have a question about specificity. sometimes i get a selector back from the inspector that selects multiple elements.
For example if i select an image on digg.com, i get this back:
html>body>section>section>section:nth-of-type(2)>div>div>article>a>picture>img

while my chrome devtools gives back:
body > section.frontpage > section.live-pull.frontpage > section:nth-child(2) > div > div:nth-child(1) > article > a > picture > img

which returns 1 element.
I hope my question is clear :)
Is there any way to increase the specificity so it will always return 1 element?

Thanks, Jonathan

dom-inspector@1.2.2-beta.0

Beta version has been released, You can try it. If no problem, please reply me and I will release the official version

Hi,
Thank you for the quick reply!
Maybe it's a good idea to remove duplicate whitespace. I got an error because there were 2 spaces somewhere. I canged it to:
className.replace(/\s+/g,' ').split(' ')

Thanks!

dom-inspector@1.2.2-beta.2

😴 It's my fault, try this version

No problem :)
Looks good this new version. Thanks!

OK, dom-inspector@1.2.2 has published