sqlite-html
sqlite-html copied to clipboard
Add "path" column to `html_each`
Similar to the fullkey / path columns in json_each/json_tree.
sqlite> select fullkey, path, key, value from json_tree('{"sub": {"name": "alex"}}');
┌────────────┬───────┬──────┬─────────────────────────┐
│ fullkey │ path │ key │ value │
├────────────┼───────┼──────┼─────────────────────────┤
│ $ │ $ │ │ {"sub":{"name":"alex"}} │
│ $.sub │ $ │ sub │ {"name":"alex"} │
│ $.sub.name │ $.sub │ name │ alex │
└────────────┴───────┴──────┴─────────────────────────┘
But instead, it's a CSS selector to the exact HTML Element, similar to the "copy path" button in Chrome Devtools.

The catch: this is pretty difficult to calculate, here's Chrome's implementation of it. https://github.com/ChromeDevTools/devtools-frontend/blob/69ed2407734d98fdbaaabaac91fb679ca73bd88c/front_end/panels/elements/DOMPath.ts#L73-L171