Re: [w3c/webcomponents] HTML Modules (#645)

Hi everybody,
sorry I am joining in late. I have been working on web components and imports since 2004, and have a working web component solution since 2006. I would like to discuss the issue further, though.

My results (and this is just what I am most comfortable with) are as follows:

I want tags like this:

1. <ul js='tools.MyUlHelperClassName'>
// this works if you have a global repository variable "tools" containing the "MyUlHelperClassName" class 
// much like the user builtin elements in the web components definition: <ul is="...."> 

or

2. <tools-myulhelperclassname>
// web component style, does not need global name space, since it can be defined in an IIFE and uses the browser internal element repo

Since (2) is just a wrapper layer for (1) in my system, I will only explain (1) here:
the js="..." attribute holds a space-separated list of classnames like e.g.:

<body js="utils.router">

my library - and my proposal would be the module loader as well - works like this (a bit simplified):

if there is no global hash object "util"
- let util={}
if "util" doesnt contain a property "Router"
- load "/util/Router.js" 
finally // assuming util.Router exists now and is a class
- if <body> does not have a property "js":    body.js = {}
- make an instance of the util.Router class and put it into <body>.js['Router']
- instance.target = <body>
- if body.js.Router contains an "init" function, call it       //bootstrapping

All template handling happens inside the instance code. I do not require shadowdom or encapsuled CSS, but can use it if required. I have this since 2006 and happily do recursive on-demand module loading, so during development I dont even need a build.

What do you think about this approach? In my opinion the beauty od it is that it is all based on plain classes...


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/645#issuecomment-412234768

Received on Saturday, 11 August 2018 00:01:16 UTC