Ajax requests, 129
adding Ajax GET request, 130–131
adding Ajax URL to main manifest, 135
adding Ajax URL to manifest NETWORK section, 135
POST request behavior, 135
products.json File, 131
Application cache entries, 122
Application cache specification, 126
Asynchronous module definition (AMD)
definition, 245
dependency declaration, 247–248
factory function, 245
Cache-control header, 122
browser, 105
enhancing view model, 106
managing application state, 107–108
mapProducts function, 106
Code
fragment, 6
HTML document, 5
Content distribution network (CDN), 16
Data Storage, browser. See HTML5 local storage feature
Default actions management, 27–29
Design patterns, 4
Desktop web browser, 7
Dynamic basket, 29
Event, definition, 24
Graphic design and layouts, 4
Hover method, jQuery, 26
HTML editor, 7
HTML5 History API
preserving view model state, 96–97
restoring application state, 99–101
storing application state, 98–99
HTML5 local storage feature, 137–139
complex data storage (see IndexedDB)
with offline web applications
cached CheeseLux web app, 150–153
createDialog function, 156–157
enhanceViewModel function, 153–154
script element changes, 155–156
session storage
semi-persistent observable data item, 149
synchronizing view models, 144
KO subscribe method, 146
main document modification, 147–148
persistentObservable function, 144, 146–147
StorageEvent object, 145
HTMLElement properties, 35
IndexedDB, 156
locating objects
using cursor, 166
using Index, 167
onupgradeneeded property, 160–161
success outcomes, 161
WebSQL, 157
working principle, 157
JavaScript
dependencies in libraries, 238
AMD module (see Asynchronous module definition (AMD))
directly resolved dependency, 240
double-loading problem, 243–244
global variables, 230
namespaces
nested, using a function, 232–233
self-executing function, 234–235
naming collision, 229
property, method and function, 235–238
unit testing, 253
JavaScript libraries, 7
JavaScript polyfill libraries, 129
jQuery
addClass method, 23
bind method, change and keyup events, 32–33
custom selectors, 20
hover method, 26
method chaining, 23
methods for inserting elements in document, 22
statement, 19
jQuery Mobile
disabling automatic processing, 212–213
widgets, 202
Knockout (KO)
data bindings, 51
definition, 49
ko object, 50
Method chaining, 23
Method pairs, 23
Mobile browser emulator, 7
Mobile Web Apps, 195
CheeseLux Mobile Web App
basic implementation, 209
formatText data binding, 210–211
duplicating elements using templates, 215
with custom data, 218
using two-pass data bindings, 215–218
getIndexOfCategory function, 226
goals, 205
jQuery Mobile
askmobile.html document, 198
CheeseLux web app, 204
data attributes, 201
events, 203
installation, 201
setCookie, 203
mobile device detection
multipage model
changePage method, 225
mapping page names to routes, 224–225
navigation, 223
replacing radio buttons with anchors, 223
Mouseenter and mouseleave events, 26–27
Node.js, 8
Offline web apps, 109
Ajax requests
adding Ajax GET request, 129–131
adding Ajax URL to main manifest, 135
adding Ajax URL to manifest NETWORK section, 135
POST request behavior, 135
products.json file, 131
HTML5 application cache
accepting changes to manifest, 115–116
adding manifest to HTML document, 112–113
adding network and fallback entries, 122–126
control of cache update process, 116–122
monitoring
adding elements and bindings, 128
detecting state of network, 126–128
POST request behavior, 135
Polyfill, 98
POST request behavior, 135
Recurring Ajax requests polyfills, 129
Responsive Web Apps, 169
screen size
adapting source data, 183
adapting web app layout, 179–183
conditional jQuery UI styling, 183–184
detectDeviceFeatures function, 177–178
JavaScript media queries, 174–175
removing elements, 184
touch interaction
application routes, 193
detecting touch support, 189–190
Single handler function, 27
Submit button upgradation
input element selection and hiding, 19–21
URL routing
CheeseLux
browser, 104
enhancing view model, 106
managing application state, 107–108
mapProducts function, 106
consolidating routes
unexpected segment values, 86–88
event-driven controls to navigation
bridging events and routing, 92–94
bridging URL routing and JavaScript events, 90–92
selected data binding, 94
using HTML5 History API
history.replaceState method, 95
preserving view model state, 96–97
restoring application state, 99–101
steps demonstrating the issue, 95
storing application state, 98–99
simple routed web application, 77–78
adding navigation markup, 81–83
adding routing library, 79
adding view model and content markup, 79–81
applying controls and elements, 83–85
View model, 47
dynamic basket
adding basket line items, 66–69
adding basket structure and template, 70–71
removing items, 71
model creation
adding data to document, 48
adopting view model library, 49
Web app development principles, 15
dynamic basket data
bind method, change and keyup events, 32–33
overall total calculation, 35–37
event handling
using event object, 27
mouseenter and mouseleave, 26–27
single handler function, 27
JavaScript disabled and enabled, 39–40
JavaScript-only policy, 41
non-JavaScript users, 40
submit button upgradation
input element selection and hiding, 19–21
UI toolkit
creating jQuery UI button, 43–44
setting up jQuery UI, 42
Web server, 7
whitelist entries, 122
WURFL database, 195
3.17.162.26