Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

<script is="lazy-template"> (ready for review) #165

Merged
merged 6 commits into from Sep 30, 2016
Merged

Conversation

collin
Copy link
Contributor

@collin collin commented Sep 28, 2016

@mparent61 If you link in bulbs-elements through your docker-compose.yml we'll be able to start testing out <script is="lazy-template">

@collin
Copy link
Contributor Author

collin commented Sep 30, 2016

@kand @daytonn @spra85 @mparent61

We're working on page speed and want to be able to ship html content without having the browser engine parse it.

According to the spec, this would be the time to use a <template> tag, but IE11 is real cool and parses the contents of <template> elements. So that's out for a while.

But browsers won't parse the contents of a <script> tag if it doesn't recognize the type.

enter:

<script type="text/html">

Now, we want to customize this <script> tag to convert its contents into real-live elements on the page at-will.

So we define a custom extension of the <script> tag, is="lazy-template"

<script is="lazy-template" type="text/html">

There is another required attribute load-on

Page load loads when the window load event fires:

 load-on="page-load"

In view loads the content when the template comes into the viewport.

 load-on="in-view"

@collin collin changed the title [WIP] spike: <script is="lazy-template"> <script is="lazy-template"> Sep 30, 2016
@collin collin changed the title <script is="lazy-template"> <script is="lazy-template"> (ready for review) Sep 30, 2016
@mparent61
Copy link
Contributor

Awesome, can't wait to try this out.

this.addEventListener('enterviewport', this.handleEnterViewport);
}

tearDownLoadOnPageLoad () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to leave this here if it's a no-op?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

Copy link
Contributor

@MelizzaP MelizzaP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@daytonn
Copy link

daytonn commented Sep 30, 2016

👍

@collin collin merged commit cc937b5 into master Sep 30, 2016
@collin collin deleted the lazy-template branch September 30, 2016 20:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants