-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redesign flow to build a partial. #8
Comments
There were and are many ideas, but for now I'll describe my recent one: I have already submitted a proposition to change
I believe, that it will give us fully featured |
Would it still support two usage scenarios that we have right now? <template is="x-html" bind content="<b>Some HTML</b>"></template>
<template is="x-html" bind content="./partial.html"></template> Point 4 seems to be the biggest winner for me. Points 1-2 are implementation details, that don't matter now. Point 3 is where we lose the current syntactic sugar. Could we please further investigate if it is possible for scripts to be handled exactly as in an HTML Import? (from my test it looks that they load with blocking, which is what we want). I agree that this can be another Custom Element that extends this one, I would just use it instead. |
Yes, it will. Please take a look at examples. Regarding 3., I'm affraid, just HTML Import behavior is not entirely what |
I think we can keep support for the simplicity of the old In this post, I will use the old name We need two versions of <template is="html-import" src="/test.html"></template>
<x-html src="/test.html"></x-html> The html-import elementIt uses the Ill-behaved partialsAn ill behaved partial will believe it is the only instance in the document. It will use Providing protectionThere are basically three levels of encapsulation available.
The idea is to avoid the Detecting ill behaved partialsThe imported document fragement from
Dealing with ill-behaved partialsIf it is an ill behaved partial, we will put it in an Well behaved partialsThe well behaved partial will be put it the shadow dom. The well behaved partial will be responsible for not leaking its logic. Shadow DOM should be used for individual parts of the partial to allow mixing while at the same time protecting internal styling. The x-html elementSame as the template but creates an instance in the DOM. |
I'm going to start development of BTW, are we going to keep current |
To summarise:
We detect the existence of a |
Example of a naive but (hopefully) well behaved partial<div>
I'm well behaved because I have no title. I do not believe I'm on my own.
</div>
<script>
what.is.going.on();
</script> |
Example of an ill-behaved partial<head>
<script src="lib/jquery.js"></script>
<title>I'm my own boss</title>
</head>
<div id="main">
I will be put in an iframe because I might believe I'm on my own (and I do scripting).
Please contain me.
</div>
<script>$("main").textContent = "Typical me";</script> |
Example of a performant and well behaved partial<link rel="import" href="lib/jquery.html"> <!-- well behaved partials can load dependencies as
they are guaranteed not to run multiple times --->
<template>
<div>I might be cloned in many places in the document</div>
</template>
<script>
console.log("I will run whenever I'm stamped out in by an owner document");
</script>
</template>
<script>I will run only once</script> |
Simple partials<link rel="import" href="lib/handsontable.html">
<div>{{FirstName}} {{LastName}}</div> |
Simple partials<div>hello world</div> |
How do we detect well behaved partials? |
Difference between
|
I'm afraid there will be a problem with handling ill behaved ones. For sure, it would be way much simpler if ill behaved flag would be given from outside as attribute. |
There is also a problem with putting well behaved ones into ShadowDOM, as it will break partials that were designed to server multiple nodes on root level, for examples merged output from Polujuice/Launcher.
@Starcounter-Jack I'm afraid we should reconsider changing design once again. |
Good point. Let's assume they are well behaved for now. We need to work against the demo. Sent from my iPhone
|
Let's do it first thing in the morning (hangout)
|
I have an idea how could we solve ShadowDOM issue, add support for <template is="imported-template">
<sortable-list order="{{order}}">
<content></content>
</sortable-list>
</template> But i still do not have any idea how to solve iframe detection on client side. |
This issue has been solved back in March/April. In result, 2 options are available:
|
We are facing more, and more issues that suggest we should reconsider overall design of
<x-html>
.I have decided to create this umbrella issue, to track general discussions about new designs, and flows.
Here is the list of issues that, led us here:
<script>
's are being executed before HTML was attached to DOM. #3 Sometimes<script>
's are being executed before HTML was attached to DOM.x-html
The text was updated successfully, but these errors were encountered: