Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/93ab4fd9-adba-49a3-9368-03e6f5166509%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<link rel="import" href="https://api.github.com/wc/repo.html" imports="core-ajax github-repo github-user">To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
Thanks for the links! That's super-helpful. Completely agree that import-time is the right time to tackle this. Also agree that it's possible that a new spec would need to be added to really make this work.Unless I'm misunderstanding, it seems like the security concerns wouldn't be that big of a deal. You should never, ever be importing content from a source you don't already trust, so some form of resource hashing seems like it would only be an efficiency/deduplication issue, not a security issue. I can imagine something like a "unique" or "once" attribute on <link> that would basically say "don't load this resource if it's already been loaded." However this would require fetching and hashing the resource (or having an agreed-upon header to respond with in HEAD to verify the hash), which means you're still sending the data over the wire.
One way to manage this in a way that leaves most of the solution up to userland (which is imo a good idea in most cases) would be to have an attribute on the link tag called e.g. imports that would be a space-delimited token attribute. The idea here would be that if the resources specified by imports are already loaded (or already being loaded from an uncomplete import) they are simply skipped. Of course a <link> tag without this attribute would load regardless. To illustrate what I mean, imagine something like this:<link rel="import" href="https://api.github.com/wc/repo.html" imports="core-ajax github-repo github-user">
You would want to have some kind of canonical API to be able to manipulate imports via JS as well, something like document.imports. OK, so this would solve some of our problems but leave others:
- What about conflicting versions of an import? We could do versioning e.g. core...@0.3.3 but we can't really expect to put semantic versioning into an HTML spec.
- Depending on the import, that "imports" list could become very long indeed.
2. is a mostly aesthetic concern and I suppose the length of your imports list would be determined by how much you care about dependency deduplication.1. is a much trickier issue, and to solve it I would propose that you be able to actually reach in and define the import resolver yourself. For example, document.imports.resolver = function(import){ }
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/4b09301e-053a-4402-8d2d-1afb1e5490dd%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/CAKc-BFiSTPCi3K9r8jFRVYYCLTUGoVdgPKULOpOoMsRk7_Hwpw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/23bbb692-01fd-4871-86b5-aa36cd264f1c%40googlegroups.com.