Re: Why does HTML test f004 extract all script elements?

> On May 6, 2024, at 12:00 PM, Ben Wallberg <ben.wallberg@gmail.com> wrote:
> 
> Hello WG,
> In the JSON-LD Test Suite, HTML test f004 [1] "Flattens all script elements by default".  Why is this the case? In every other test case, and as far as I can tell in the "Process HTML" documentation [2], extractAllScripts has a default value of false, extracting only the first script element.

Sorry to not get back to you sooner. As it happens, I’m re-encountering the same situation after some updates to my own implementation.

The flatten() API [3] just uses the default options, and extractAllScripts is set to false, by default, yet the test is written to indicate that it should be defaulted to false.

There is a paragraph in JSON-LD 1.1 Embedding JSON-LD in HTML Documents [4] which indicates that it should default to true for toRdf(), but the API also doesn’t change the default value there.

I think it may be that the API descriptions for flatten() and toRdf() may need to be updated to indicate that the default value of extractAllScripts should be set to true, but others may have some other recollection about this.

Gregg

> Thank you,
> Ben
> https://github.com/wallberg
> 
> [1] https://w3c.github.io/json-ld-api/tests/html-manifest.html#tf004
> [2] https://www.w3.org/TR/json-ld11-api/#process-html

[3] https://w3c.github.io/json-ld-api/#dom-jsonldprocessor-flatten
[4] https://w3c.github.io/json-ld-syntax/#embedding-json-ld-in-html-documents

Received on Saturday, 15 June 2024 22:23:56 UTC