dart-archive / web-components

Dart package providing the web components platform polyfills
https://pub.dartlang.org/packages/web_components
BSD 3-Clause "New" or "Revised" License
18 stars 10 forks source link

@HtmlImport deduplication #8

Open jakemac53 opened 9 years ago

jakemac53 commented 9 years ago

Currently the mirror based version of @HtmlImport leaves deduplication up to the browser. This may actually be fine, but it could end up outputting some pretty gross html with lots of duplicate tags. It might not be worth actually searching the document for pre-existing html imports (probably more work overall) but we should at least keep a static set of the assets we have already injected and not re-inject those.

sigmundch commented 9 years ago

good point - at least when searching for pre-existing imports, we could limit it to just the ones that exist at the time the initializers start running (rather than checking those that exist at the time you are injecting a new import)

jakemac53 commented 9 years ago

Ya, we don't have any good hooks for that but we could do it when the first HtmlImport is found and then cache it at that point.