[Bug 19870] [Imports]: Ensure import resources are loaded relative to location of import definition

https://www.w3.org/Bugs/Public/show_bug.cgi?id=19870

--- Comment #11 from Steve Orvell <sorvell@chromium.org> ---
> * only scripts and link[rel=import]s fetch resources in an import.

Makes sense.

> * URLs of all elements with hyperlinks are resolved relative to imported document.
> * at least as spec'd now, template documents don't have a base URL to resolve against. This means that using the templates from an import will lose the knowledge of the URL of the imported document in which they had arrived.

IMO, these 2 bullets should be handled the same. There should be nothing
special about the contents of templates. Given:

  index.html
  imports/import.html
  imports/images/foo.png

index.html is a page which has

  <link rel="import" href="imports/import.html">

and import.html contains: 

  <img href="images/foo.png">

Right now the image's url will resolve correctly if the images folder is
relative to the import's location as above. In the import, the image url will
resolve correctly, but the resource will not load so this has little value.

1. For the most part and regardless of whether or not they are inside a
<template>, elements in imports will eventually make their way to the main
document, either via moving or cloning. In our case, if the image is moved to
the main document, the src will no longer resolve correctly.

2. There are use cases for resolving url's correctly in imports: scripts and
imports must do so and custom elements may want to do so.

I think the ideal behavior would be that paths are resolved relative to the
import when elements are in the import and when elements move to the main
document, paths are additionally resolved relative to the import. This way our
img would correctly resolve its url when it's in the import or in the main
document.

That 'magical' behavior may be too tricky. If we have to pick one document
against which these (non-script or import) element url's should be resolved,
because of point #1, it needs to be the main document.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Friday, 16 August 2013 02:43:33 UTC