Created
February 21, 2018 14:40
-
-
Save sz332/e9023a29e937aa511a30d75fd3fcc7d0 to your computer and use it in GitHub Desktop.
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
child.html | |
<div class="part"> | |
<style> | |
h3 { | |
color: red !important; | |
} | |
</style> | |
<h3>Warning!</h3> | |
<p>This page is under construction</p> | |
</div> | |
<div class="nopart"> | |
<p>This does not do anything</p> | |
</div> | |
index.html | |
<html> | |
<head> | |
<link rel="import" href="child.html"> | |
</head> | |
<body> | |
<p>Here comes the content of the child.html:</p> | |
<div id="wrapper"></div> | |
<script> | |
var link = document.querySelector('link[rel="import"]'); | |
var content = link.import; | |
// Grab DOM from warning.html's document. | |
var el = content.querySelector('.part'); | |
document.querySelector("#wrapper").appendChild(el.cloneNode(true)); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment