Skip to content

Instantly share code, notes, and snippets.

@jeanmachuca
Created November 8, 2020 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeanmachuca/765dad92bba62b8a338cc8d61fd7e886 to your computer and use it in GitHub Desktop.
Save jeanmachuca/765dad92bba62b8a338cc8d61fd7e886 to your computer and use it in GitHub Desktop.
Append 10 div elements to body (0 to 9 indexes)
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width" />
<!-- This is a wide open CSP declaration. To lock this down for production, see below. -->
<meta http-equiv="Content-Security-Policy" content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap: https://ssl.gstatic.com; img-src * 'self' data:; child-src *; style-src * 'self' 'unsafe-inline' 'unsafe-eval'; script-src * 'self' 'unsafe-inline' 'unsafe-eval'; connect-src * 'self' 'unsafe-inline' 'unsafe-eval';media-src *">
<title>QCObjects Hello World</title>
<script type="text/javascript" src="https://qcobjects.dev/QCObjects.js"></script>
</head>
<body>
<script type="text/javascript">
Ready(()=>{
range(9).map(index => New(
Component,{
name:`component-${index}`,
template:`This is the component element number ${index}`,
tplsource:"inline",
body:_DOMCreateElement("div")
})).map(e=>document.body.append(e))
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment