Skip to content
This repository has been archived by the owner on Nov 11, 2019. It is now read-only.

Do parsers apply the value of "base" elements when resolving URLs? #37

Closed
chaals opened this issue May 18, 2017 · 7 comments
Closed

Do parsers apply the value of "base" elements when resolving URLs? #37

chaals opened this issue May 18, 2017 · 7 comments

Comments

@chaals
Copy link
Collaborator

chaals commented May 18, 2017

If an HTML document hosted somewhere other than http://example.org, and it has <base href="http:example.org">, do parsers resolve the URL relative to the base element, or not?

And likewise for XML…

@gkellogg, @iherman

@gkellogg
Copy link
Member

RFC3986 has a section on URI resolution, and both HTML and XML have specific rules for resolving relative URIs against an established base.

For HTML, it's typically the value of the base element in the head section. XML uses xml:base, on the closest element; many RDFa parsers do this as well.

In the absence of an explicit base, it is set from the document location.

As RDF does not allow relative IRIs in the abstract syntax, everything needs to be resolved against something. example.org has no special meaning other than convention.

@chaals
Copy link
Collaborator Author

chaals commented May 19, 2017

Yeah, I am specifically wondering if microdata parsers actually do it...

@gkellogg
Copy link
Member

With regards to RDF Microdata parsers, there are tests to ensure this is how relative URIs are handled. Mine does this, and I'm sure @iherman's does as well.

There are so many variations, @RubenVerborgh wrote a number of tests for various RDF serlializations to test this. We repeated those for JSON-LD, but haven't gone that far in the RDF or Microdata RDF test suites.

@iherman
Copy link
Member

iherman commented May 19, 2017

@gkellogg knows me well, but, to be on the safe side, I checked my code too:-) Yes, RDFLib & Co. do implement the HTML <base> element.

@chaals
Copy link
Collaborator Author

chaals commented Jun 17, 2017

This is less important than I thought, if we solve #41 so typed items collect the vocabulary we expect for describing the names of URLs.

@chaals
Copy link
Collaborator Author

chaals commented Jun 17, 2017

In any event, I deferred to RFC3986 for resolving URLs, so I think that covers it and we can close this issue.

@gkellogg ?

@chaals
Copy link
Collaborator Author

chaals commented Jul 19, 2017

I did a quick'n'dirty test on the Google validator and it applied base too. So nothing to see here...

@chaals chaals closed this as completed Jul 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants