css-path
css-path copied to clipboard
Get the unique css-path to a DOM-element.
✔ **Validating IDs** Escape any spaces or any unsupported characters of returned ids in order to be used safely with document.querySelector() 📜 **Example** 👉 Input `div#this element has an id...
I'm looking reducing the size of the selector by only adding constraints that reduce the number of matched elements. Will inform you when I'm done
how to reproduce: go to `http://www.amazon.de/dp/B00KX14CY6?psc=1` insert `css-path` sourcecode write in the console ``` el = document.querySelector("li:nth-child(3) #a-autoid-2 > span.a-button-inner > input.a-button-input") //second image el2 = document.querySelector(cssPath(el, document)) el ===...