On Sat, 19 Aug 2017, Karl Dahlke wrote:

Well duktape has some json support out of the box.
It has a JSON global object, with JSON.parse() in it and I don't know what 
else, so using js to convert css to json might be a practical pathway.

Correction: Actually I made a mistakes that it was JSON. The parser doesn't return JSON, the parser returns a tree of nested objects. The documentation simply turned it into JSON in order to serialize the contents of the object for readability. So this is even more familiar, just traversal with recursion maybe.

Course we'd have to follow up with a function to apply bgcolor=white to foo.style wherever that makes sense.

I think that's right.  We might get the first two thirds of a three step
process done "free" by the libraries and have to write the function that
you describe.  Since querySelectorAll returns elements (foo) and the
parser css.js breaks down selectors, attribute names (bgcolor) and
attribute values (white) into neat compartments, I think it would be
(don't want to speak too soon) somewhat straightforward to dole out
bgcolor=white to foo.style.

Here is the code for the parser and then for querySelector:

https://raw.githubusercontent.com/jotform/css.js/master/css.js
https://raw.githubusercontent.com/yiminghe/query-selector/master/build/query-selector-debug.js

And here are the git projects:

https://github.com/jotform/css.js.git
https://github.com/yiminghe/query-selector.git

K
_______________________________________________
Edbrowse-dev mailing list
[email protected]
http://lists.the-brannons.com/mailman/listinfo/edbrowse-dev

Reply via email to