Last active
April 7, 2018 02:40
-
-
Save kolserdav/49366fd2151a1f30a9f46a30c85ffb2c to your computer and use it in GitHub Desktop.
Rel import html file across javascript
This file contains 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> | |
<html> | |
<head> | |
<link rel="import" href="http://some.domain/patch.html"> | |
</head> | |
<body> | |
<script src = "http://some.domain/js/main.js"></script> | |
</body> | |
</html> |
This file contains 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
let block = document.querySelector('link[rel="import"]').import; | |
let content = block.querySelector('.block'); | |
document.body.appendChild(content.cloneNode(true)); |
This file contains 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
<text class="block"> | |
<h2>Header</h2> | |
<p><span>Author: @kolserdav </span></p> | |
<p>Content</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment