0

I'm getting an error when I try to use forward slashes inside a string:

splash:evaljs('document.querySelector("a[href=/some/link/path/]")')

If I take the splashes out it's ok, do I need to escape the forward slashes?

EDIT

I'm using it with evaljs in the DOM context the error is: "SyntaxError: Dom exception 12"

S. Schenk
  • 1,960
  • 4
  • 25
  • 46
  • Can you include the exact error message? – Nifim Nov 04 '19 at 19:00
  • @Nifim Please see my edit – S. Schenk Nov 04 '19 at 19:39
  • 1
    Don't you need to enclose the path in quotes? In this case, you need to escape the inner quotes. – lhf Nov 05 '19 at 00:01
  • Surely you don't need to escape the inner quotes when the string uses single instead of double quotes as a string declaration? Isn't everything inside the single quotes treated as raw? – Corsaka Nov 07 '19 at 14:17
  • I've tried using extra quotes and escaping like so: 'document.querySelector("a[href=\"/en-gb/betting/football/\"]")' but no luck – S. Schenk Nov 08 '19 at 15:35

0 Answers0