A B C D E F G H I J K L M N O P Q R S T U V W X-Y-Z

Symbols

$() function, 225

$(“”) wrapper, 233-234

$(document).ready handler, 233

$F() function, 225

&& (logical AND), 96

+ operator, 29

! character, 79

A

[top]

accessing

browser history, 55

classes with className property, 192-193

JSON data

eval() function, 153-154

native browser support, 154

accordion widget, 253-254

ActiveX objects, creating, 264

adding comments to code, 24-25

addTax() function, testing, 365-366

advantages

of JSON, 152-153

of OOP, 106

Ajax, 261-262

asynchronous requests, 265-266

browser support, 264

client-server interaction, 262-263

form submission, 268-270

implementing with jQuery, 266-270

ajax() method, 268

get() method, 267

load() method, 266-267

post() method, 267

XMLHttpRequest object, 263

ajax() method, 268

alert() method, 51-52, 343

AngularJS, 300-304

building an application, 305-308

directives, 302-304

filters, 304

ng- directives, 300-302

scopes, 302

animate() function, 173

animation

CSS3, 213-214

fading, 237

jQuery, 238-241

sliding elements, 237-238

anonymous functions, 110-111, 289-290

arguments

for constructor functions, 113-114

multiple arguments, passing to functions, 41

passing to functions, 40-43

arithmetic operators, 27-28

+ operator, 29

incrementing/decrementing value of variables, 27-28

modulus division operator, 27

precedence, 28

arrays

associative arrays, simulating, 158-159

creating, 81

initializing, 81-82

length property, 82

manipulating, 84-86

methods, 82-86

arrow functions, 289-290

<article> tag (HTML5), 168

<aside> tag (HTML5), 168

assigning values to variables, 25-26

associative arrays, simulating, 158-159

asynchronous requests (Ajax), 265-266

attaching event handlers to elements, 239-243

attr() method, 235

attributes (HTML5)

of <video> tag, 169

reading, 133-134

<audio> tag (HTML5), 171-172

B

[top]

background-origin property (CSS3), 208

background-size property (CSS3), 207

backgrounds, 207-209

multiple background images, 208-209

banner-cycling script, writing, 347-351

beginPath() method, 173

best practices for writing JavaScript code, 325-326, 329

commenting, 326-327

error handling, 335-338

feature detection, 333-334

graceful degradation, 329-330

naming conventions, 327-328

progressive enhancement, 330-331

reusing code, 328-329

writing unobtrusively, 331-333

Boolean values, 75-79

negation operator, 79

border-radius property (CSS3), 206-207

box-shadow property (CSS3), 205

break command, 99

breakpoints, 353

browsers

Ajax support, 264

cookies, 273-274

deleting, 280-281

document.cookie property, 274

domain attribute, 276

escaping and unescaping data, 275

expires date, 276

limitations of, 274

path attribute, 276

reading, 280

secure flag, 276

testing, 281-284

value, 276

writing, 276-279

CSS3 vendor prefixes, 203-205

debugging tools, 344-347

ECMAScript 6 compatibility, 287

feature detection, 119-120

Google Chrome extensions, writing, 312-316

launching the extension, 315

manifest.json file, 316-317

history, accessing, 55

JavaScript console, 351-352

grouping messages, 352-353

opening, 344, 347-351

Mozilla Firefox, DOM Inspector, 134-147

child nodes, manipulating, 136-141

dynamic menu creation, 142-147

loading JavaScript files, 141-147

nodes, creating, 135-136

native browser support, accessing JSON data, 154

navigator object, 57-59

reloading current page, 57

building

AngularJS application, 305-308

extensions, 312-314

built-in objects, extending, 117-118

C

[top]

calculations, simplifying with Math object, 62-66

finding minimum and maximum, 62-63

rounding, 62

calling functions, 38-40

CamelCase convention, 25

canPlayType() method, 170

<canvas> tag (HTML5), 172-175

capabilities of JavaScript, 7

CDNs (Content Delivery Networks), jQuery, 232

Celsius, converting to Fahrenheit, 29-30

Changing Classes Using className listing, 192

character strings, assigning as value of variable, 26

child nodes, manipulating, 136-141

childNodes property, 126-129

classes, 288

accessing with className property, 192-193

className property, accessing classes, 192-193

clearRect() method, 174

client-side scripting, 6

closePath() method, 173

code

debugging, 341

alert() method, 343

breakpoints, 353

conditional breakpoints, 354-355

editor, selecting, 342-343

types of errors, 341-342

watch expressions, 355

libraries

Dojo, 223

jQuery, 224, 231

MooTools, 223

Prototype Framework, 223

prototype.js, 224-228

purpose of, 222

reasons for using, 221-222

refactoring, 363

writing, best practices, 325-326, 329

commenting, 326-327

error handling, 335-338

feature detection, 333-334

graceful degradation, 329-330

naming conventions, 327-328

progressive enhancement, 330-331

reusing code, 328-329

writing unobtrusively, 331-333

combining

conditions, 96

JavaScript statements, 24

command chaining, 238-242

commenting, 24-25

best practices, 326-327

comparison operators, 90

concat() method, 74, 83

concatenating strings, 29

conditional breakpoints, 354-355

conditional statements

comparison operators, 90

if() statement, 89-90, 94-95

libraries, Yahoo! UI library, 223

logical operators, 96

switch statement, 95-96

testing for equality, 91-94

testing multiple conditions, 95

confirm() method, 52

const keyword, 290-293

constructor functions, 111-114

for-of construct, 294

content, separating from style with CSS, 186

controllers, 298

controlling lighting effects, 214-217

converting

Celsius to Fahrenheit, 29-30

CSS3 property names to JavaScript, 214

data serialization, 155

strings to numbers, 71

cookies, 273-274

deleting, 280-281

document.cookie property, 274

domain attribute, 276

escaping and unescaping data, 275

expires date, 276

limitations of, 274

path attribute, 276

reading, 280

secure flag, 276

testing, 281-284

value, 276

retrieving, 283

setting multiple values, 284

writing, 276-279

creating

arrays, 81

date object

with current date and time, 60

with given date and time, 60

gradients

linear gradients, 209-210

radial gradients, 210-212

image rollovers, 33-35

nodes, 135-136

objects, 107-114

anonymous functions, 110-111

constructor functions, 111-114

direct instances, 107-110

with JSON, 159-163

CSS (Cascading Style Sheets)

classes, accessing, 192-193

DOM nodes

style property, 188-191

stylesheets, 194-199

naming conventions, 191

separating style and content, 186

style declarations

syntax of, 186-187

where to place, 187-188

CSS3

background-origin property, 208

background-size property, 207

backgrounds, 207-209

multiple background images, 208-209

border-radius property, 206-207

box-shadow property, 205

gradients, 209-212

gradients, creating

linear gradients, 209-210

radial gradients, 210-212

lighting effects, controlling, 214-217

properties

converting to JavaScript, 214

setting with vendor prefixes, 215-218

text effects

text shadow, 212

word wrap, 213

transitions, 204, 213-214

vendor prefixes, 203-205

D

[top]

data serialization, 155

data types

Boolean values, 75-79

JSON, 157-158

numbers, 69-72

floating-point numbers, 70

integers, 70

NaN, 71

strings, 72-75

empty strings, 72

escape sequences, 72-73

dataTransfer property (HTML5), 176

Date object, 276

creating with current date and time, 60

creating with given date and time, 60

editing dates and times, 61

methods, 377

date picker widget, 255-256

debugging

browser debugging tools, 344-347

code, 341

alert() method, 343

breakpoints, 353

conditional breakpoints, 354-355

editor, selecting, 342-343

grouping messages, 352-353

types of errors, 341-342

watch expressions, 355

extensions, 315

Firebug, 371

JSLint, 371

decrementing value of variables, 27-28

deleting cookies, 280-281

detecting browser features, 119-120

direct instances, 107-110

directives (AngularJS), 302-304

disabling stylesheets (DOM object), 194-195

do...while statement, 98

document object (DOM), 11

reading properties of, 16-17

document.cookie property, 274

document.write() method, 15-16

Dojo, 223

DOM (Document Object Model), 10-13

browser support for, 11

Date object, 60-61

methods, 377

document object, 11

reading properties, 16-17

document.write() method, 15-16

getComputedStyle() method, 214-217

history object, 55

location object, 56-57

Math object, 62-66

finding minimum and maximum, 62-63

generating random numbers, 63

with keyword, 64

mathematical constants, 64

properties, 376

rounding, 62

navigator object, 57-59

nodeName property, 130

nodes, 123-130

childNodes property, 126-129

types of, 125-126

values, 129-130

object notation, 12-13

parentNode property, 129

scripting, 123

window object, 11

window.alert() method, 13-14

DOM Inspector, 134-147

child nodes, manipulating, 136-141

dynamically loading JavaScript files, 141-147

editing element attributes, 141

nodes, creating, 135-136

DOM Level 0, 10

DOM nodes

style property, 188-191

stylesheets, 194

enabling, disabling, switching, 194-195

selecting, 195-199

dot notation, 12-13

downloading

jQuery, 231-232

drag and drop

in HTML5, 175-178

with jQuery UI, 247-250

draggable attribute (HTML5), 175

drawing with <canvas> tag (HTML5), 172-175

dynamic menu, creating, 142-147

E

[top]

ECMA (European Computer Manufacturers Association), 8

ECMAScript 6, 287

editor program, selecting, 369-370

elements

attributes

editing, 141

reading, 133-134

selecting

with getElementsByTagName() method, 130-132

by ID, 54-55

empty strings, 72

enabling stylesheets (DOM object), 194-195

encapsulation, 118-119

error handling, 335-338

escape() function, 275

escape sequences, 41, 72-73

eval() function, 153-154

event handlers, 31-35

jQuery, 239-243

onClick event handler, 31-32

onMouseOut, 32-33

onMouseOver, 32-33

events

for drag and drop, 175-178

mouse events, creating image rollovers, 33-35

expires date (cookies), 276

exponential notation, 70

extending

objects with prototype, 114-115

extensions

debugging, 315

Google Chrome extensions, writing, 312-316

launching, 315

packaging, 321

external stylesheets (CSS), referencing, 187-188

externalizing scripts, 363

F

[top]

fading elements, 237

“falsy” values, 76

faulty program logic, 342

feature detection, 119-120, 333-334

<figcaption> tag (HTML5), 168

<figure> tag (HTML5), 168

file access in HTML5, 179-182

File API (HTML5), 179-182

fill() method, 173

filters (AngularJS), 304

Firebug, 371

flickr.com, 153

floating-point numbers, 70

<footer> tag (HTML5), 168

for loops, 98

for...in loops, 99-100

for-of construct, 294

forms, Ajax, 268-270

frameworks, 297-298. See also libraries

AngularJS, 300-304

building an application, 305-308

directives, 302-304

filters, 304

ng- directives, 300-302

scopes, 302

MVC architecture, 298

example of, 298

for web apps, 299-300

functions, 37

$(), 225

$F(), 225

addTax(), testing, 365-366

anonymous functions, 110-111

arrow functions, 289-290

calling, 38-40

constructor functions, 111-114

escape(), 275

eval(), 153-154

getCss3Property(), 218

isFinite(), 71-72

jsonParse(), 156

parseFloat(), 71

parseInt(), 71

passing arguments to, 40-43

multiple arguments, 41

returning values from, 42-45

sending messages with, 41-43

simplicity in, 363

spam detector, 76-78, 91-93

storing JavaScript in head section, 39-40

syntax, 38

variables

global, 47

local, 46

scope of, 45-47

wrapper function (jQuery), 233-234

G

[top]

Geany, 370

generating random numbers, 63

get() method, 267

getComputedStyle() method, 214-217

getCss3Property() function, 218

getData() method, 176

getElements() method, 226-228

getElementsByTagName() method, 130-132

global variables, 47

Google Ajax API CDN, 232

Google Chrome extensions, writing, 312-316

HTML file, 317-320

launching the extension, 315

manifest.json file, 316-317

packaging the extension, 321

graceful degradation, 329-330

gradients, 209-212

gradients, creating

linear gradients, 209-210

radial gradients, 210-212

grouping messages, 352-353

H

[top]

<header> tag (HTML5), 168

“Hello World!” example, 15-16

hide() method, 236

history object, 55

history of JavaScript, 8-9

HTML (Hypertext Markup Language), 5

separating style and content with CSS, 186

html() method, 234

HTML5, 167

drag and drop, 175-178

element attributes, reading, 133-134

file access, 179-182

local storage, 178-179

src attribute, 22-23

tags

<article>, 168

<aside>, 168

<audio>, 171-172

<canvas>, 172-175

<figcaption>, 168

<figure>, 168

<footer>, 168

<header>, 168

<nav>, 168

new tags, 168

<script>, 9-10, 21

<section>, 168

<summary>, 168

<video>, 168-170

HTML5 Drag and Drop listing, 176

I

[top]

if() statement, 89-90, 94-95

image rollovers, creating, 33-35

implementing Ajax with jQuery, 266-270

ajax() method, 268

get() method, 267

load() method, 266-267

post() method, 267

incrementing value of variables, 27-28

indexOf() method, 74, 83

inheritance, 115-117

initializing arrays, 81-82

innerHTML property, 54-55

installing

QUnit test suite, 363

instances, 106

integers, 70

Interacting with the Local File System listing, 181

interactions, 247-252

drag and drop, 247-250

resize, 251

sort, 251-252

interpreted languages, 9

isFinite() function, 71-72

J

[top]

JavaScript

adding to HTML documents, 22-23

applications, 311-312

capabilities of, 7

dynamically loading files, 141-147

“Hello World!” example, 15-16

history of, 8-9

new features

arrow functions, 289-290

classes, 288

const keyword, 290-293

for-of construct, 294

let keyword, 290-293

modules, 290

template strings, 293-294

transpilation, 294-295

statements, 24-25

combining, 24

commenting, 24-25

storing in head section, 39-40

validating, 356

jEdit, 369

join() method, 83

jQuery, 224, 231. See also jQuery UI

$(document).ready handler, 233

Ajax, implementing, 266-270

animation, 238-241

fading elements, 237

sliding elements, 237-238

attr() method, 235

command chaining, 238-242

downloading, 231-232

event handlers, 239-243

hide() method, 236

html() method, 234

page elements, selecting, 233-234

remote versions, 232

show() method, 236

text() method, 234-235

toggle() method, 236-237

jQuery UI, 245-246

interactions, 247-252

drag and drop, 247-250

resize, 251

sort, 251-252

ThemeRoller, 246

widgets, 253-258

accordion, 253-254

date picker, 255-256

tabs, 256-258

JSLint, 371

JSON (JavaScript Object Notation), 151

accessing data

eval() function, 153-154

native browser support, 154

advantages of, 152-153

associative arrays, simulating, 158-159

data serialization, 155

data types, 157-158

objects

creating, 159-163

manipulating, 161-163

parameter/value pairs, 152

security, 163

strings, parsing, 155-157

syntax, 152-153

website, 151

jsonParse() function, 156

JSON.parse() method, 154

JSON.stringify() method, 155

K

[top]

keywords

const, 290-293

function, 38

let, 290-293

null, 79

object literals, 79

prototype keyword

extending objects, 114-115

inheritance, 115-117

return, 42

undefined, 79

var, 25

with, 64

L

[top]

lastIndexOf() method, 74, 83

launching Google Chrome extensions, 315

length property, 82

let keyword, 290-293

libraries

Dojo, 223

versus frameworks, 298

jQuery, 224, 231

$(document).ready handler, 233

animation, 238-241

attr() method, 235

command chaining, 238-242

downloading, 231-232

event handlers, 239-243

hide() method, 236

html() method, 234

page elements, selecting, 233-234

remote versions, 232

show() method, 236

text() method, 234-235

toggle() method, 236-237

MooTools, 223

Prototype Framework, 223

prototype.js, 224-228

$() function, 225

$F() function, 225

Form object, 226

getElements() method, 226-228

purpose of, 222

reasons for using, 221-222

Yahoo! UI library, 223

lighting effects, controlling, 214-217

limitations of cookies, 274

linear gradients, 209-210

listings

Changing Classes Using className, 192

HTML5 Drag and Drop, 176

Interacting with the Local File System, 181

Moving a Ball Using <canvas>, 174

Selecting Stylesheets by Title, 197

Styling Using the DOM style Object, 190

Toggling Between Stylesheets Using the styleSheets Property, 199

load() method, 266-267

local files, accessing in HTML5, 179-182

local storage in HTML5, 178-179

local variables, 46

location object (DOM), 56-57

logical operators, 96

loops

do...while statement, 98

for loop, 98

for...in, 99-100

terminating, 99

while statement, 97

loosely typed languages, 69

M

[top]

manifest.json file for Google Chrome extension, 316-317

manipulating

arrays, 84-86

child nodes, 136-141

JSON objects, 161-163

markup languages, 5

Math object, 62-66

finding minimum and maximum, 62-63

generating random numbers, 63

with keyword, 64

mathematical constants, 64

properties, 376

rounding, 62

messages, sending with functions, 41-43

methods

ajax(), 268

alert(), 51-52

attr(), 235

concat(), 74, 83

confirm(), 52

for Date object, 377

document.write() method, 15-16

get(), 267

getComputedStyle(), 214-217

getElements(), 226-228

getElementsByTagName(), 130-132

hide(), 236

html(), 234

indexOf(), 74, 83

join(), 83

JSON.parse(), 154

JSON.stringify(), 155

lastIndexOf(), 74, 83

load(), 266-267

on(), 243

post(), 267

prompt(), 52-53

replace(), 74

serialize(), 226

setInterval(), 101-102

setTimeout(), 101

show(), 236

simplicity in, 363

slice(), 84

sort(), 84

sortable(), 251-252

splice(), 84-86

split(), 74-75

string methods, 375

substr(), 75

text(), 234-235

toggle(), 236-237

toLowerCase(), 75

toString(), 83

toUpperCase(), 75

window.alert() method, 13-14

Microsoft CDN, 232

minimum and maximum, finding, 62-63

models, 298

modules, 290

modulus division operator, 27

MooTools, 223

mouse events

drag and drop, 247-250

event handlers, 31-35

onClick, 31-32

onMouseOut, 32-33

onMouseOver, 32-33

image rollovers, creating, 33-35

Moving a Ball Using <canvas> listing, 174

Mozilla Firefox, DOM Inspector, 134-147

attributes, editing, 141

dynamically loading JavaScript files, 141-147

nodes

child nodes, manipulating, 136-141

creating, 135-136

multiline comments, adding to statements, 24-25

multiple arguments, passing to functions, 41

multiple conditions

testing, 95

MVC (Model-View-Controller) architecture, 298

example of, 298

for web apps, 299-300

N

[top]

naming conventions

CSS (Cascading Style Sheets), 191

naming variables, 26

NaN (not a number), 71

native browser support, accessing JSON data, 154

<nav> tag (HTML5), 168

navigating with location object, 56

navigator object, 57-59

negation operator, 79

ng- directives, 300-302

nodeName property, 130

nodes (DOM), 123-130

child nodes, manipulating, 136-141

childNodes property, 126-129

creating, 135-136

nodeName property, 130

parentNode property, 129

types of, 125-126

values, 129-130

Notepad++, 369

null keyword, 79

numbers, 69-72

floating-point numbers, 70

Infinity, 71-72

integers, 70

NaN, 71

O

[top]

object-oriented languages, 106

objects

ActiveX, creating, 264

creating, 107-114

anonymous functions, 110-111

constructor functions, 111-114

direct instances, 107-110

with JSON, 159-163

Date object, 276

methods, 377

date object

creating with current date and time, 60

editing dates and times, 61

encapsulation, 118-119

extending with prototype, 114-115

Form, 226

history object, 55

inheritance, 115-117

instances, 106

JSON, manipulating, 161-163

location object, 56-57

looping through, 99-100

Math object, 62-66

finding minimum and maximum, 62-63

generating random numbers, 63

with keyword, 64

mathematical constants, 64

properties, 376

rounding, 62

navigator object, 57-59

serializing, 155

syntax, 12-13

XMLHttpRequest object, 263

properties, 264-265

on() method, 243

onClick event handler, 31-32

onMouseOut event handler, 32-33

onMouseOver event handler, 32-33

OOP (object-oriented programming), 105-106

advantages of, 106

encapsulation, 118-119

opening

JavaScript console, 347-351

opening JavaScript console, 344

OpenOffice.org, 312

operators, 26-30, 373

arithmetic operators, 27-28

incrementing/decrementing value of variables, 27-28

modulus division operator, 27

comparison operators, 90

logical operators, 96

negation operator, 79

precedence, 28

P

[top]

packaging Google Chrome extension, 321

parameters

for box-shadow property (CSS), 205

JSON, 152

passing to functions, 40-43

parentNode property, 129

parseFloat() function, 71

parseInt() function, 71

parsing JSON strings, 155-157

passing arguments to functions, 40-43

multiple arguments, 41

pause() command, 170

play() command, 170

playing

sound, <audio> tag (HTML5), 171-172

videos

pause() and play() commands, 170

<video> tag (HTML5), 168-170

post() method, 267

precedence rules for operators, 28

prefixes, CSS3, 203-205

procedural programming, 105

progressive enhancement, 330-331

prompt() method, 52-53

properties

of arrays, length, 82

background-origin property (CSS3), 208

background-size property (CSS3), 207

border-radius property (CSS3), 206-207

box-shadow property (CSS3), 205

childNodes property, 126-129

CSS3

setting with vendor prefixes, 215-218

CSS3, converting to JavaScript, 214

document.cookie property, 274

innerHTML, 54-55

of Math object, 376

nodeName property, 130

of objects, reading, 16-17

parentNode property, 129

prefixed versions, 205

text-shadow (CSS3), 212

word-wrap (CSS3), 213

of XMLHttpRequest object, 264-265

properties (HTML5). See attributes (HTML5)

Prototype Framework library, 223

prototype keyword

extending objects, 114-115

inheritance, 115-117

prototype.js, 224-228

$() function, 225

$F() function, 225

Form object, 226

getElements() method, 226-228

purpose of libraries, 222

Q

[top]

QUnit test suite, 363-366

addTax() function, testing, 365-366

installing, 363

setup, 364-365

R

[top]

radial gradients, creating, 210-212

random numbers, generating, 63

reading

cookies, 280

date and time, 64-66

element attributes, 133-134

properties of document object, 16-17

refactoring code, 363

referencing external stylesheets (CSS), 187-188

reloading current browser page, 57

remote versions of jQuery, 232

replace() method, 74

resize interaction, 251

return keyword, 42

returning values from functions, 42-45

reusing code, 328-329

rounding with Math object, 62

runtime errors, 342

S

[top]

SciTE, 370

scope of variables, 45-47

scopes (AngularJS), 302

<script> tag, 9-10, 21

src attribute, 22-23

scripts, 6

array manipulation script, 84-86

banner-cycling script, writing, 347-351

client-side scripting, 6

DOM, 123

externalizing, 363

server-side scripting, 6

<section> tag (HTML5), 168

security, JSON, 163

selecting

editor program, 369-370

elements

with getElementsByTagName() method, 130-132

by ID, 54-55

program editor, 342-343

stylesheets (DOM object), 195-199

Selecting Stylesheets by Title listing, 197

selectors (jQuery), 234

sending messages with functions, 41-43

separating style and content with CSS, 186

serialization, 155

serialize() method, 226

server-side scripting, 6

setData() method, 176

setInterval() method, 101-102, 174

setTimeout() method, 101

setting up

QUnit test suite, 364-365

show() method, 236

simulating associative arrays, 158-159

slice() method, 84

sliding elements, 237-238

software frameworks, 297-298

sort interaction, 251-252

sort() method, 84

sortable() method, 251-252

sound, playing, 171-172

spam detector function, 76-78, 91-93

splice() method, 84-86

split() method, 74-75

src attribute, 22-23

statements, 24-25

combining, 24

commenting, 24-25

conditional statements

if() statement, 89-90, 94-95

switch statement, 95-96

testing for equality, 91-94

testing multiple conditions, 95

do...while statement, 98

while statement, 97

storing

data in HTML5, 178-179

JavaScript in head section, 39-40

strings, 72-75

concatenating, 29

converting to numbers, 71

empty strings, 72

escape sequences, 72-73

JSON strings, parsing, 155-157

template strings, 293-294

stroke() method, 173

style, separating from content with CSS, 186

style declarations (CSS)

syntax of, 186-187

where to place, 187-188

style property (DOM nodes), 188-191

stylesheets (DOM object), 194

enabling, disabling, switching, 194-195

selecting, 195-199

Styling Using the DOM style Object listing, 190

substr() method, 75

<summary> tag (HTML5), 168

switch statement, 95-96

switching stylesheets (DOM object), 194-195

syntax

CamelCase convention, 25

DOM object notation, 12-13

errors, 341

functions, 38

JSON, 152-153

T

[top]

tabs widget, 256-258

tags, HTML5

<article>, 168

<aside>, 168

<audio>, 171-172

<canvas>, 172-175

<figcaption>, 168

<figure>, 168

<footer>, 168

<header>, 168

<nav>, 168

new tags, 168

<script>, 9-10, 21

<section>, 168

src attribute, 22-23

<summary>, 168

<video>, 168-170

template strings, 293-294

terminating loops, 99

testing

cookies, 281-284

for equality, 91-94

multiple conditions, 95

unit testing

explained, 359-360, 362

QUnit test suite, 363-366

refactoring code, 363

simple example, 360-362

video format support, canPlayType() method, 170

text effects

text shadow, 212

word wrap, 213

text() method, 234-235

text-shadow property (CSS3), 212

ThemeRoller, 246

timers

setInterval() method, 101-102

setTimeout() method, 101

toggle() method, 236-237

Toggling Between Stylesheets Using the styleSheets Property listing, 199

toLowerCase() method, 75

toString() method, 83

toUpperCase() method, 75

Traceur, 294-295

transformations, 213-214

transitions, 204, 213-214

transpilation, 294-295

“truthy” values, 76

U

[top]

undefined keyword, 79

unescaping data, 275

unit testing

explained, 359-360, 362

QUnit test suite, 363-366

addTax() function, testing, 365-366

installing, 363

setup, 364-365

refactoring code, 363

simple example, 360-362

V

[top]

validating JavaScript, 356

validators, 370

values

assigning to variables, 25-26

of cookies, 276

retrieving, 283

setting multiple values, 284

“falsy,” 76

in JSON objects, 157-158

of nodes, 129-130

returning from functions, 42-45

“truthy,” 76

var keyword, 25

variables, 25-26

arrays

associative arrays, simulating, 158-159

creating, 81

initializing, 81-82

length property, 82

manipulating, 84-86

methods, 82-86

assigning values to, 25-26

global variables, 47

incrementing/decrementing value of, 27-28

local variables, 46

naming, 26

scope of, 45-47

vendor prefixes, setting CSS3 properties, 215-218

<video> tag (HTML5), 168-170

videos

playing

pause() and play() commands, 170

<video> tag (HTML5), 168-170

testing format support, canPlayType() method, 170

views, 298

W

[top]

W3C (World Wide Web Consortium), 8

validation services, 370

watch expressions, 355

WDG (Web Design Group), 370

web apps, MVC architecture, 299-300

WebM website, 169

websites

CDNs, 232

Dojo, 223

flickr.com, 153

jQuery, 224

JSON, 151

MooTools, 223

Prototype Framework, 223

prototype.js, 224

ThemeRoller, 246

Traceur, 294-295

Yahoo! UI library, 223

while statement, 97

widgets (jQuery UI), 253-258

accordion widget, 253-254

date picker, 255-256

tabs, 256-258

window object (DOM), 11

window.alert() method, 13-14

with keyword, 64

word wrap, 213

word-wrap property (CSS3), 213

wrappers, $(“”), 233-234

writing

banner-cycling script, 347-351

code, best practices, 311-312, 329

commenting, 326-327

error handling, 335-338

feature detection, 333-334

graceful degradation, 329-330

naming conventions, 327-328

progressive enhancement, 330-331

reusing code, 328-329

writing unobtrusively, 331-333

cookies, 276-279

Google Chrome extensions, 312-316

HTML file, 317-320

manifest.json file, 316-317

packaging the extension, 321

X-Y-Z

[top]

XHTML, 167

XMLHttpRequest object, 263

properties, 264-265

Yahoo! UI library, 223