Created
May 10, 2016 16:06
-
-
Save davidbgk/37ab1d4bc21d76e6281c700884fc5cbf to your computer and use it in GitHub Desktop.
Test DOM Content Loaded and promises
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<meta charset=utf-8> | |
<title>Test DOM Content Loaded and promises</title> | |
<script> | |
console.log(document.querySelector('main')) // => null | |
document.ready = new Promise( | |
(resolve) => document.addEventListener('DOMContentLoaded', resolve)) | |
document.ready.then(() => console.log(document.querySelector('main'))) // => <main> | |
</script> | |
<main></main> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment