Skip to content

Instantly share code, notes, and snippets.

@DylanPiercey
Created December 4, 2017 20:34
Show Gist options
  • Save DylanPiercey/cdac8bc8c9a3e9ee1b29d285575336c6 to your computer and use it in GitHub Desktop.
Save DylanPiercey/cdac8bc8c9a3e9ee1b29d285575336c6 to your computer and use it in GitHub Desktop.
Potential async flushing syntax for html.
<script>
// Prolyfill for watching for loading tags and shuffeling around dom.
// Could potentially come on first flush.
</script>
<body>
<header>
<h1>Hello world!</h1>
</header>
<main>
<!-- Will eventually insert any matching id that is flushed before this element. -->
<loading for="my-async-element">
<p>loading...</p>
</loading>
</main>
<footer>
copyright 2017 this guy
</footer>
</body>
<!-- Flushes Later -->
<div id="my-async-element">
My data
</div>
<!-- Final Result -->
<body>
<header>
<h1>Hello world!</h1>
</header>
<main>
<div id="my-async-element">
My data
</div>
<loading for="my-async-element">
<p>loading...</p>
</loading>
</main>
<footer>
copyright 2017 this guy
</footer>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment