scrawl-canvas
Version:
Version 8.9.4 - 19 Nov 2022
84 lines (64 loc) • 2.61 kB
HTML
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Demo DOM 010</title>
<link href="css/normalize.css" rel="stylesheet" />
<link href="css/tests.css" rel="stylesheet" />
<style>
.control_panel {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-column-gap: 2px;
grid-template-rows: auto;
grid-row-gap: 2px;
margin-bottom: 1em;
}
button {
justify-self: stretch;
align-self: stretch;
text-align: center;
padding: 1em;
}
#target {
background-color: #b8ffb8;
margin-bottom: 1em;
}
[data-scrawl-stack] {
border: 1px solid red;
min-height: 20px;
}
</style>
</head>
<body>
<h1><a href="index.html">Scrawl-canvas v8</a> - DOM test 010</h1>
<h2>Add and remove (kill) Scrawl-canvas stack elements programmatically</h2>
<div class="control_panel">
<button class="control_button" id="action_1">1. Generate new stack</button>
<button class="control_button" id="action_2" disabled>2. Remove stack 1</button>
<button class="control_button" id="action_3">3. Convert existing element into stack</button>
<button class="control_button" id="action_4" disabled>4. Remove stack 3</button>
</div>
<div id="target">
<p id="p1">This is the <div> element which will host the stack created by <b>Button 1</b>.</p>
<p name="p2"><b>Button 2</b> removes the Button 1 stack, wherever it is placed on the page.</p>
<p>Clicking <b>Button 3</b> will convert this <div> element into a stack of its own, making all the child elements (these 4 <p> tags) scrawl elements.</p>
<p id="p4">After clicking <b>Button 4</b>, creating a stack with button 1 will force that stack to be added to the end of the web page. You will no longer be able to turn this <div> element into a stack because it will no longer exist.</p>
</div>
<p id="reportmessage"></p>
<div class="testinfo">
<h4>Test purpose</h4>
<ul>
<li>Turn a DOM element into a Scrawl-canvas stack programmatically</li>
<li>Create a Scrawl-canvas stack and add it to the DOM</li>
<li>Create a Scrawl-canvas stack inside another stack</li>
<li>Dynamically remove and delete a Scrawl-canvas stack from the DOM</li>
</ul>
<p><b>Touch test:</b> not required</p>
<p><a href="../docs/demo/dom-010.html">Annotated code</a></p>
</div>
<script src="dom-010.js" type="module"></script>
</body>
</html>