Re: [w3ctag/design-reviews] Base used to resolve relative URIs to absolute URIs in HTML5 data-blocks (#312)

Hi JSON-LD! We discussed this at length at our [TAG Paris face-to-face](https://github.com/w3ctag/meetings/tree/gh-pages/2018/10-paris).  As I'd expected, it spawned a lot of good discussion about JSON-LD and its relationship to the rest of the web.

We had a number of thoughts:

1. We don't want JSON-LD documents, by definition, to need a DOM. [Data on the web](https://www.w3.org/TR/dwbp/), where intended to be machine-readable instead of human-readable, shouldn't have to jump through all those hoops – unless you're embedding JSON-LD into HTML. (Which is the use case you're highlighting here. So we'll focus on that.)

2. Where you are embedding it into HTML, JSON-LD is a valuable data store format for a lot of different use cases. We think it could be the default data format for the web – if it was exposed to the DOM (when embedded in HTML).
To that end, we would like to define a JavaScript API for those script elements, to reflect that content back out to DOM. 
Now that we have JavaScript modules... it would be useful to define the static export of a JSON-LD processor, for use as a module. @travisleithead has been working on an HTML modules proposal. We should make it possible to identify the module typing of all of our resource types: imaging, types, scripts, CSS, etc. -- and it would be ideal to include JSON-LD in that list, and treat it like we treat all of our other resources. We should bring this in from the cold; it's too important not to use with the rest of the Web.

3. The downside of this proposal is that it means we would all be treating JSON-LD like every other resource in the Web – which come with all the heavy lifting you've outlined in your [Detailed Design Discussion](https://gist.github.com/azaroth42/40fa22c0bb86c1fc92063fee5a7c3d4e#detailed-design-discussion) section of your explainer.
Sorry about that!!
If you're up for this, the next step would be to set up a call with me, @travisleithead and @slightlyoff to talk about how to take this forward. 

4.  To answer your question then – we would recommend that, where JSON-LD is embedded in HTML, we should treat it as part of the DOM (and it should be! A valuable part!) and resolve relative URIs to absolute URIs using the <base> element. 
Where JSON-LD is not embedded in HTML, and is therefore outside of a DOM – it makes sense to just use the document's URI to get to the absolute URI.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/312#issuecomment-434689623

Received on Wednesday, 31 October 2018 13:37:28 UTC