domcss-selectorscommon-lispparenscript

In the Common Lisp ecossystem of libraries, how to get the active element of the DOM using Clss and/or Plump instead of Parenscript?


Using javascript in the browser's console (firefox), I can do:

document.activeElement.placeholder

If the mouse cursor is in the StackOverflow search bar, the code above returns:

"Search…"

I can achieve the same using Parenscript with:

(ps:chain document active-element placeholder)

Is it possible to achieve the same output using CL Plump (manual) and/or Clss (manual) instead of Parenscript?

If so, how to do it?

I have tried finding this on the documentation references above but I could not find it. I am new to CL, though. Maybe I missed something.

Thanks.


Solution

  • When using Parenscript you are using the browser engine through JavaScript. The browser has a concept of user interaction, such as focus, on top of the model representing the document itself.

    Plump and CLSS are not browser engines. They only have an object model of the HTML document they have parsed. They do not model anything like user interaction, so they also do not have something like the »active element«.