w3c / json-ld-api

JSON-LD 1.1 Processing Algorithms and API Specification
https://w3c.github.io/json-ld-api/
Other
73 stars 29 forks source link

`expand(..., extractAllScripts)` and typing #592

Open anatoly-scherbakov opened 4 months ago

anatoly-scherbakov commented 4 months ago

As described in Process HTML section of the specification, it is described how expand() behaves on HTML documents with extractAllScripts option.

This means that the output type of expand() deterministically depends on its input parameters.

What if we could split expand() into two separate functions?

Over time, expand() might be updated: it will no longer accept extractAllScripts option at all and it will only parse one <script> in the document.

P. S. This will be handy for YAML-LD to expand_all() multiple documents in a stream.