0

I'm newbie in js.. but I found a construct I've never seen and although googled a little, haven't fount any info:

here a piece of code I found with slider revolution:

<script type="text/html" id="tmpl-attachment-details-two-column">
    <div class="attachment-media-view {{ data.orientation }}">
        <div class="thumbnail thumbnail-{{ data.type }}">
            <# if ( data.uploading ) { #>
                <div class="media-progress-bar"><div></div></div>
            <# } else if ( 'image' === data.type && data.sizes && data.sizes.large ) { #>
                <img class="details-image" src="{{ data.sizes.large.url }}" draggable="false" />
            <# } else if ( 'image' === data.type && data.sizes && data.sizes.full ) { #>
                <img class="details-image" src="{{ data.sizes.full.url }}" draggable="false" />
            <# } else if ( -1 === jQuery.inArray( data.type, [ 'audio', 'video' ] ) ) { #>
                <img class="details-image" src="{{ data.icon }}" class="icon" draggable="false" />
            <# } #>
....
</script>

what is it used for? what's the rules? Thanks

Joe
  • 1,033
  • 1
  • 16
  • 39

1 Answers1

3

This isn't JavaScript, see the type="text/html"? This is an HTML template.

See What are modern uses of script type="text/html" and is this example considered good use? (among other similar questions).

Community
  • 1
  • 1
Madara's Ghost
  • 172,118
  • 50
  • 264
  • 308