W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2014

Re: [HTML Imports] What is the imagined work flow?

From: Brian Di Palma <offler@gmail.com>
Date: Fri, 23 May 2014 17:35:15 +0100
Message-ID: <CAKkpDQTEDdRXwGvhNLR4-7ueAiLBYGd_KkNYnXSnzpcfvWqLrQ@mail.gmail.com>
To: Scott Miles <sjmiles@google.com>
Cc: Jonas Sicking <jonas@sicking.cc>, Webapps WG <public-webapps@w3.org>
HTML Imports seems the least crucial of the Web Components specs.

Consider that all but the most trivial of Web Components will require JS.
JS is now getting a module system which can be used to load other
resources ( e.g. https://github.com/systemjs/systemjs/#plugins ).
The JS module system seems much more flexible then loading via URLs.

I think it's fair to question if HTML Imports is even necessary.
Are any of the current HTML Import use cases impossible to implement
using JS modules?

On Wed, May 21, 2014 at 8:13 AM, Scott Miles <sjmiles@google.com> wrote:
> Sorry, but just a bit of follow up.
> One may notice that the Web Components spec is imperative and assume that
> declarative support is not important. But as it turns out, the notion of
> using custom-elements to bootstrap declarative syntaxes allows various
> parties to experiment in the real-world, as opposed to a working group
> trying to resolve the trade-offs in an a-priori spec.
> I mention this, because although I used Polymer as an example (it's my
> project after all), the fact is we hope people will use web-components like
> this:
> <link rel="import" href="sweet-button.html">
> ...
> <sweet-button></sweet-button>
> Is <sweet-button> implemented via Polymer? X-tags? Vanilla JavaScript? User
> doesn't need to know to use the resource.
> Ideally, best-of-breed technology emerges and the option to standardize is
> still available.
> On Tue, May 20, 2014 at 11:56 PM, Scott Miles <sjmiles@google.com> wrote:
>> Some of the ways Polymer team uses imports are as follows:
>> - aggregating <script src> and/or <link rel="stylesheet> elements into
>> functional units
>> - aggregating imports themselves into units
>> - expressing dependencies (N modules can each import jquery2-import.html
>> and I only get one copy of jquery)
>> - importing self-organizing databases via custom elements (e.g.
>> <core-meta> elements describe/provide metadata using monostate pattern)
>> Also, one of the first things Polymer does is register a custom-element
>> which itself provides a declarative interface to the custom element
>> machinery. Most other Polymer elements are then structured declaratively (as
>> HTML) which makes using imports highly convenient.
>> >> would stick a <style> element in the imported document
>> You can do that, reference an external stylesheet, or place a (scoped)
>> style tag directly in the shadow-root.
>> E.g. using Polymer idiom
>> <polymer-element name="my-button" noscript>
>> <template>
>> <style>
>>   :host > div.someclass {
>>     color: "aliceblue";
>>   }
>> </style>
>> <div class="someclass">my-button</div>
>> </template>
>> </polymer-element>
>> On Tue, May 20, 2014 at 10:08 PM, Jonas Sicking <jonas@sicking.cc> wrote:
>>> Hi All,
>>> Over here at mozilla we've been trying to understand how the HTML
>>> Imports spec is intended to be used.
>>> We have so far received descriptions of how the spec works. I.e. what
>>> happens when the various import related attributes are added to an
>>> <link rel=import>.
>>> However I'm curious to understand the expected developer work flows.
>>> Let me make a few guesses to clarify the type of description I'm looking
>>> for.
>>> Clearly imports are expected to be used together with web components.
>>> However so far web components are mainly an imperative API, and not a
>>> declarative thing. Any element registrations needs to be created
>>> through JS calls, and all the shadow DOM inside a custom element needs
>>> to be created using JS calls and then inserted into the shadow root
>>> using script.
>>> At first glance it seems like a simple <script src=...> would then
>>> provide all that you need?
>>> However it might be tedious to create all elements using createElement
>>> and appendChild calls. A better work flow is to stick a <script> in a
>>> <link rel=import>ed document together with some <template> elements.
>>> Then clone the of those templates from the constructors of the custom
>>> elements.
>>> And in order to style the custom elements, you would stick a <style>
>>> element in the imported document which would have rules like
>>> my-button::shadow > div.someclass {
>>>   color: "aliceblue";
>>> }
>>> Is this an accurate description? Are there other reasons to stick
>>> non-<script> content in the HTML? Are there any examples out there of
>>> how HTML imports are intended to be used?
>>> / Jonas
Received on Friday, 23 May 2014 16:35:42 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:24 UTC