Applying a Template with a Query Selector

A query collection includes a template() method that you can use to quickly apply a template to either a single DOM element or set of DOM elements. For example, the page in Listing 3.22 displays a list of products.

LISTING 3.22 Using WinJS.Utilities.id() with a Template (templatesQuery\templatesQuery.html).

<!DOCTYPE html><html><head>    <meta charset="utf-8" />    <title>Chapter03</title>    <!-- WinJS references -->    <link href="//Microsoft.WinJS.2.0/css/ui-dark.css" rel="stylesheet" />    <script src="//Microsoft.WinJS.2.0/js/base.js"></script>    <script src="//Microsoft.WinJS.2.0/js/ui.js"></script>    <!-- Chapter03 references -->    <link href="templatesQuery.css" ...

Get Windows® 8.1 Apps with HTML5 and JavaScript Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.