Skip to content

Commit

Permalink
refining second example
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenpuglia committed Mar 14, 2018
1 parent a94ecca commit d234aa9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
11 changes: 8 additions & 3 deletions examples/02-putting-content-into-shadow-dom.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
content="ie=edge">
<link rel="stylesheet"
href="styles.css">
<title>01 - Creating Shadow Dom</title>
<title>02 - Putting Content Into Shadow DOM</title>
</head>

<body>
Expand All @@ -18,14 +18,19 @@ <h2>Check the code for instructions</h2>

<!-- The element to which we'll attach the Shadow DOM -->
<div class="element">
Hello World!
<h1>Hello World!</h1>
</div>

<script>
// When init() is commented, you'll see the .element div with 'Hello World!'
// But once you run init, it attaches Shadow DOM to .element and only stuff
// from within the shadow is rendered on page.
// init();
init();

// You'll also see that the <h1> inside shdow DOM has the margins
// but the Hello World! <h1> didn't have it. 👀

// We are going to later see how styles work in the shadows.

function init() {
// The element
Expand Down
14 changes: 14 additions & 0 deletions examples/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,17 @@ body {
}

/*===== End of Layout ======*/


/*=============================================
= Example Specific Styles =
=============================================*/

.element {
padding: 1rem;
border: 1px dashed;
}

/*===== End of Example Specific Styles ======*/


0 comments on commit d234aa9

Please sign in to comment.