Is it considered good practice in today's standards to utilize something like the following code snippet and use jQuery to swap out content based on a selector?
<script type="text/html" id="this-content1">
<h1>This Header Info One</h1>
<p>This content one. . .</p>
</script>
<script type="text/html" id="this-content2">
<h1>This Header Info Two</h1>
<p>This content two. . .</p>
</script>
I am just starting to explore the use of script type="text/html"... to enable dynamic content changes and am discovering various approaches to achieve this. Is there a reliable source that explains the direction in which this practice is evolving and whether there is any standardization in place?
I often encounter code like the following...
<div class="thumbnail">
<# if ( data.uploading ) { #>
<div class="media-progress-bar"><div></div></div>
<# } else if ( 'image' === data.type ) { #>
<img src="{{ data.size.url }}" draggable="false" />
<# } else { #>
<img src="{{ data.icon }}" class="icon" draggable="false" />
<# } #>
</div>
...embedded within a script type="text/html" tag, and I am unsure of the rationale behind this structure. As someone who is just beginning to explore backbone, it seems a bit heavy-handed if the goal is simply to implement content swapping within a single page.