Querying the DOM with WinJS.Utilities
The UI of the app is described in HTML and the corresponding styles. When the app is launched, you should expect different user interactions with the UI. The user will touch some sections of your app; he/she will scroll, zoom in and out, or add or remove items. Moreover, the app might interact with the user through dialogs or conversations and through posting notifications on the screen. Responding to such interactions is handled by code and in our case, specifically by JavaScript code. That's where WinJS.Utilities
comes in handy, by providing helper functions to do that; for example, functions to add/remove CSS classes or to insert HTML elements. But before anything interacts with the user, you have to select the function using JavaScript, which is called querying the DOM.
In Chapter 2, Styling with CSS3, we saw how to select parts of the DOM using CSS selectors. JavaScript has built-in functions to do so by using the traditional document.getElementById...