I have this code snippet working on the browser using JavaScript:
Array.from(document.querySelectorAll('input'))
Thedocument.querySelectorAll('input')
gets a NodeList and Array.from
converts it to an array.
I am trying to translate it to Parenscript inside a function as:
(ps:chain array (from (ps:chain document (query-selector "input")))))
This is close:
"array.from(document.querySelector('input'));"
There is even a little trick to achieve the capital letter with the hyphenating of -array
:
(ps:ps (ps:chain -array (from (ps:chain document (query-selector "input")))))
Which generates:
"Array.from(document.querySelector('input'));"
But it does not work as expected when called. It returns an empty string.
How can I fix it?
Obs.: I am using Common Lisp/SBCL.
Currently, Parenscript only returns primitive values which are:
The code document.getElementsByTagName('input')
is not returning a
string, it is returning some objects. That's why it fails to work.