Index

Symbols

2-D transformations, creating an animated UI, 291292

3-D transformations, creating an animated UI, 291292

@font-face keyword, 238

A

Abort method, 220

absolute positioning, 61, 259262

accessing data

consuming data, 218223

serializing, deserializing, and transmitting data, 224228

binary data, 225228

JSON data, 225

XMLHttpRequest object, 224225

validating user input, HTML5 elements, 190209

content attributes, 206209

input controls, 190206

validating user input, JavaScript, 211217

built-in functions, 216

preventing code injection, 216217

regular expressions, 211215

addColorStop method, 51

addEventListener method, 133134, 146

adding HTML5 elements, 2234

altering the DOM, 2834

DOM (Document Object Model), 2223

selecting items in the DOM, 2328

advanced arrays, 122125

:after pseudo-element, 304

AFunction method, 89

AJAX, creating dynamic webpages, 161165

AJAX call, parameters, 164165

alignment, applying to text, 240

allow-forms value (sandbox attribute), 217

allow-same-origin value (sandbox attribute), 217

allow-top-navigation value (sandbox attribute), 217

altering the DOM, 2834

altKey property, keyboard events, 141

animated UI (CSS3), creating, 288298

2-D and 3-D transformations, 291292

adjusting UI based on media queries, 292297

CSS transitions, 289290

hiding/disabling controls, 297298

anonymous functions

callbacks, 167169

event handling, 134135

APIs (Application Program Interfaces), 72-84

AppCache API, 7780

Geolocation API, 8184

WebSocket, bidirectional communication, 157161

Web Storage, 7277

Web Worker, 172177

AppCache API, 7780

appearance

styling HTML box properties, 244249

altering size, 244245

bordering, 245247

padding and margin, 247249

styling HTML text properties

bold, 237

color, 236237

italic, 238

appendChild method, 29

Application Programming Interfaces. See APIs

applying styles

elements, 6068

changing location of element, 6163

showing/hiding elements, 6768

transforms, 6367

HTML box properties, 244263

appearance attributes, 244249

element position, 258263

graphic effects, 249258

HTML text properties, 235242

alignment, 240

bold, 237

color, 236237

fonts, 238239

hyphenation, 241242

italic, 238

spacing, 241

arc method, 43

arrays, 117120

advanced, 122125

concat method, 118119

indexOf and lastIndexOf methods, 119

join method, 119

length property, 118119

reverse method, 119120

slice method, 120

sort method, 120

special types, 121122

splice method, 120

<article> element, 89

<aside> element, 1112

assignment event handling, 133134

attribute selectors (CSS3), 301

<audio> element, 3839

autoplay attribute, <video> element, 35

auto value

hyphen property, 241

wrap-flow property, 277

B

background-image property, 250251

background images, styling HTML apps, 250251

:before pseudo-element, 304

beginPath method, 41, 47

behavioral program flow, 111

Bezier curves, 4647

bezierCurveTo method, 43

BFunctionWithParam method, 89

bidirectional communication, WebSocket API, 157161

binary data, serializing and deserializing, 225228

blank <canvas> element, 40

blur events, 140

blur parameter

box-shadow property, 252253

text-shadow property, 256

bold, applying to text, 237

border-color property, 245

bordering, styling HTML apps, 245247

border-spacing property, 246

border-style property, 245

border-width property, 246

both value, wrap-flow property, 277

Bottom property, positioning elements, 61

box properties, styling HTML apps, 244263

appearance attributes, 244249

altering size, 244245

bordering, 245247

padding and margin, 247249

element position, 258263

graphic effects, 249258

background images, 250251

clipping, 257258

gradients, 251252

shadow effects, 252257

transparency/opacity, 249250

box-shadow property, 252

break keyword, 115, 129

bubbled events, 136138

built-in functions, validating user input, 216

button input element, validating user input, 203206

C

cache parameter, AJAX calls, 164

CACHE section, AppCache API manifest file, 78

callbacks, 156170

anonymous functions, 167169

bidirectional communication with WebSocket API, 157161

dynamic webpages, jQuery and AJAX, 161165

this pointer, 169170

wiring events with jQuery, 165167

canceling events, 135136

<canvas> element, 3958

drawing curves, 4347

drawing images, 5253

drawing lines, 4143

drawing text, 5355

fill method, 4952

path methods, 4748

rect method, 4849

CanvasGradient objects, filling, 5052

caret, regular expressions, 212

cascading style sheets. See CSS3 (cascading style sheets)

case statements, 115

catch block (try...catch...finally constructs), 150

center value, text-align property, 240

change events, 139140

changing location of elements, 6163

checkbox input type, validating user input, 200201

:checked pseudo-class, 302

checking for null values, exception handling, 154

checking value, app cache status property), 79

childNodes property, 31

clear method, 73

clear value, wrap-flow property, 277

click events, 141

clientX property, mouse events, 142

clientY property, mouse events, 142

clipping, styling HTML apps, 257258

clip property, 257258

CLOSED value, readyState property), 161

close method, WebSocket objects, 161

closePath method, 47

CLOSING value, readyState property, 161

code, writing code to interact with UI controls, 2258

adding/modifying HTML elements, 2234

implementing graphics with <canvas> element, 3958

implementing media controls, 3439

SVG (Scalable Vector Graphics), 5558

code injection, preventing, 216217

collapse value, visibility property, 68

color, applying to text, 236237

color input element, 193

color parameter

box-shadow property, 252

text-shadow property, 256

color property, 236

color stop...n paramater, linear-gradient function, 252

column-count property, multi-columns, 274

column-gap property, multi-columns, 274

column-rule-color property, multi-columns, 274

column-rule property, multi-columns, 274

column-rule-style property, multi-columns, 274

column-rule-width property, multi-columns, 274

column-span property, multi-columns, 274

Columns property, multi-columns, 274

column-width property, multi-columns, 274

combining transformations, 67

concat method, arrays, 118119

conditional operators, 112

conditional program flow, 111

configuration options, background images, 250

configuring timeouts and intervals, web worker process, 180

CONNECTING value, readyState property, 161

consuming data, 218223

JSON and XML, 219

XMLHttpRequest object, 219223

content attributes, validating user input, 206209

pattern specification, 207208

placeholder attribute, 208

read-only controls, 206207

required controls, 208209

spell checker, 207

content elements

<article>, 89

<section>, 910

content layout, 266287

flexible box model, 266273

grid alignment, 280285

multi-column layout, 273276

position, floating, and exclusions, 276279

regions, grouping, and nesting, 286287

control2X parameter, bezierCurveTo method, 46

control2Y parameter, bezierCurveTo method, 46

controls, input. See input controls

controls attribute, <video> element, 35

controlX parameter, 45, bezierCurveTo method, 46

controlY parameter, 45, bezierCurveTo method, 46

coordinate system, <canvas> element, 40

coords property, 83

core structure, HTML5 page, 34

counterclockwise parameter, drawing arcs, 44

counter increment, for loops, 126

counter variable, for loops, 126

createPattern method, 52

createRadialGradient method, 51

creating

animated UI (CSS3), 288298

2-D and 3-D transformations, 291292

adjusting UI based on media queries, 292297

CSS transitions, 289290

hiding/disabling controls, 297298

custom events, 146

document structure, 219

HTML5 semantic markup, 215

layout containers, 1516

optimizing for screen readers, 1719

optimizing for search engines, 1617

dynamic webpages, jQuery and AJAX, 161165

objects and methods, 93100

custom objects, 9598

inheritance, 99100

native objects, 94

web worker process, 172180

configuring timeouts and intervals, 180

using web workers, 178179

Web Worker API, 172177

web worker limitations, 179180

CSS3 (cascading style sheets)

creating an animated UI, 288298

2-D and 3-D transformations, 291292

adjusting UI based on media queries, 292297

CSS transitions, 289290

hiding/disabling controls, 297298

finding elements using CSS selectors and jQuery, 300304

flexible content layout, 266287

flexible box model, 266273

grid alignment, 280285

multi-column layout, 273276

position, floating, and exclusions, 276279

regions, grouping, and nesting, 286287

structuring CSS files using CSS selectors, 305308

styling HTML

box properties, 244263

text properties, 235242

CSS files, structuring with CSS selectors, 305308

CSS selectors

finding elements, 300304

structuring CSS files, 305308

CSS transitions, animating objects, 289290

ctrlKey property, keyboard events, 141

cubic-bezier value, transition-timing property, 290

currentTime method, <video> element, 38

curves, drawing with <canvas> element, 4347

customEventHandler function, 146

CustomEvent object constructor, 146

custom events, 146

custom image elements, <video> element, 37

custom objects, creating and implementing, 9598

D

data

access and security

consuming data, 218223

serializing, deserializing, and transmitting data, 224228

validating user input, HTML5 elements, 190209

validating user input, JavaScript, 211217

dynamic, 189

static, 189

date input element, 193

datetime input element, 193

dblclick events, 142

declarative event handling, 132

declaring

bubbled events, 136138

variables, 87

default audio controls, 39

default media controls, 36

deserializing data, 224228

binary data, 225228

JSON data, 225

determinate progress tasks, 13

direction parameter, linear-gradient function, 252

:disabled pseudo-class, 303

disabling controls, CSS3, 297298

dispatchEvent method, 146

display property, 67, 297

<div> element, 1516, 266267

document.createElement method, 29

Document Object Model (DOM)

adding/modifying HTML5 elements, 2223

altering, 2834

selecting items, 2328

documents, creating structure, 219

HTML5 semantic markup, 215

layout containers, 1516

optimizing for search engines, 1617

screen readers, 1719

DOM (Document Object Model)

adding/modifying HTML5 elements, 2223

altering, 2834

events, 139146

change events, 139140

drag-and-drop functionality, 143146

focus events, 140141

keyboard events, 140141

mouse events, 141143

selecting items, 2328

do...while loops, 128129

downloading value (app cache status property), 79

drag-and-drop functionality, DOM events, 143146

dragend events, 143

dragenter events, 143

drag events, 143

dragleave events, 143

dragover events, 143

dragstart events, 143

drawImage method, 52

drawing, <canvas> element

curves, 4347

images, 5253

lines, 4143

text, 5355

drop events, 143

dynamic data, 189

dynamic webpages, creating with jQuery and AJAX, 161165

E

ease-in-out value, transition-timing property, 290

ease-in value, transition-timing property, 290

ease-out value, transition-timing property, 290

ease value, transition-timing property, 290

elements

adding/modifying, 2234

altering the DOM, 2834

DOM (Document Object Model), 2223

selecting items in the DOM, 2328

applying styles, 6068

changing location of element, 6163

showing/hiding elements, 6768

transforms, 6367

<article>, 89

<aside>, 1112

<div>, 1516, 266267

<figcaption>, 1213

<figure>, 1213

Finding, CSS selectors and jQuery, 300304

<header> and <footer>, 5

<hgroup>, 7

<mark>, 14

<nav>, 6

position, styling HTML apps, 258263

<progress>, 1314

<section>, 910

<table>, 1516

validating user input, 190209

button element, 205206

button input type, 203205

checkbox input type, 200201

content attributes, 206209

email input type, 198199

password input control, 197198

pattern specification, 207208

placeholder attribute, 208

radio input type, 201202

range input type, 202203

read-only controls, 206207

required controls, 208209

spell checker, 207

text and textarea input types, 193195

url input type, 195197

writing code to interact with UI controls, 2258

adding/modifying HTML elements, 2234

implementing graphics with <canvas> element, 3958

implementing media controls, 3439

SVG (Scalable Vector Graphics, 5558

element selectors (CSS3), 300301

else keyword, 113

email input type, validating user input, 198199

:enabled pseudo-class, 303

enableHighAccuracy property (PositionOptions object), 81

endAngle parameter, drawing arcs, 44

end value, wrap-flow property, 277

endX parameter, bezierCurveTo method, 45-46

endY parameter, bezierCurveTo method, 45-46

equality operators, 113

error handling, XMLHttpRequest object, 221

error method, 83

eval function, preventing code injection, 217

evaluating expressions, 112116

if statements, 113115

switch statements, 115116

ternary operators, 116

evenNumberCheck method, 123, 124

event bubbling, 138

event listeners, 131

event objects, 131132

events

oncached, 80

onchecking, 80

ondownloading, 80

onerror, 80

onnoupdate, 80

onobsolete, 80

onprogress, 80

onreadystatechange, 219

ontimeout, 219

onupdateready, 80

raising and handling, 130147

addEventListener and removeEventListener methods, 133134

anonymous functions, 134135

assignment event handling, 133134

bubbled events, 136138

canceling events, 135136

custom events, 146

declarative event handling, 132

DOM events, 139146

event objects, 131132

wiring with jQuery, 165167

every method, 122123

exception handling, 111, 149154

checking for null values, 154

try...catch...finally constructs, 149154

exclusions, flexible content layout, 276279

expression element, for loops, 126

expressions

evaluating, 112116

if statements, 113115

switch statements, 115116

ternary operators, 116

regular, validating user input, 211215

F

FALLBACK section, AppCache API manifest file, 78

<figcaption> element, 1213

<figure> element, 1213

fill method, <canvas> element, 4952

fillRect method, 49

fillStyle property, 50

filter method, 124

finally block (try...catch...finally constructs), 151

:first-child pseudo-element, 303

firstChild property, 31

:first-letter pseudo-element, 303

:first-line pseudo-element, 304

fixed positioning, 258259

flex-direction style, flexible box, 267

flexible box model, content layout, 266273

flexible content layout, 266287

flexible box model, 266273

grid alignment, 280285

multi-column layout, 273276

position, floating, and exclusions, 276279

regions, grouping, and nesting, 286287

flex-pack style, flexible box, 267

flex-wrap property, 272273

float

flexible content layout, 276279

property, 262263

flow-from property, 286

flow-into property, 286

focus events, 140141

focusin events, 140

focusout events, 140

font-family property, 238

font object

applying bold to text, 237

applying italic to text, 238

fonts, applying styles to, 238239

font-size property, 239

font typeface property, 238

font-weight CSS property, 237

<footer> element, 5

forEach method, 124

for...in loops, 127

for loops, 126127

Form.Submit method, serializing and deserializing binary data, 226227

G

Geolocation API, 8184

getAllResponseHeaders method, 220

getCurrentPosition method, Geolocation API, 8183

getElementById method, 23, 25, 30, 60

getElementsByClassName method, 23, 26

getElementsByTagName method, 23, 26

getItem method, 73

getResponseHeader method, 220

global namespace, avoiding use when establishing object scope, 9091

global scope variables, 87

gradients

filling CanvasGradient objects, 5052

styling HTML apps, 251252

graphic effects, styling HTML apps, 249258

background images, 250251

clipping, 257258

gradients, 251252

implementing <canvas> element, 3958

drawing curves, 4347

drawing images, 5253

drawing lines, 4143

drawing text, 5355

fill method, 4952

path methods, 4748

rect method, 4849

shadow effects, 252257

transparency/opacity, 249250

grid alignment, content layout, 280285

grid-column-span property, 285

grid-columns property, 282

grid-row-span property, 285

grid-rows property, 282

grouping content, 286287

H

handling

errors, XMLHttpRequest object, 221

events, 130147

addEventListener and removeEventListener methods, 133134

anonymous functions, 134135

assignment event handling, 133134

bubbled events, 136138

canceling events, 135136

custom events, 146

declarative event handling, 132

DOM events, 139146

event objects, 131132

exceptions, 111, 149154

checking for null values, 154

try...catch...finally constructs, 149154

hasChildNodes property, 31

<header> element, 5

height attribute, <video> element, 35

height parameter, rect method, 48

hexadecimal value, color property, 236

<hgroup> element, 7

hidden value, visibility property, 68

hiding

controls, CSS3, 297298

elements, 6768

hooking up events, 131

:hover pseudo-class, 302

h-shadow parameter

box-shadow property, 252

text-shadow property, 256

HTML5 APIs, 7284

AppCache API, 7780

Geolocation API, 8184

Web Storage, 7277

HTML5 documents

creating and implementing objects and methods, 93100

custom objects, 9598

inheritance, 99100

native objects, 94

creating structure, 219

HTML5 semantic markup, 215

layout containers, 1516

optimizing for search engines, 1617

screen readers, 1719

establishing scope of objects and variables, 8691

avoiding use of global namespace, 9091

leveraging the this keyword, 91

lifetime, 8790

HTML5 APIs, 7284

AppCache API, 7780

Geolocation API, 8184

Web Storage, 7277

HTML5 elements. See also HTML5 semantic markup

adding/modifying, 2234

altering the DOM, 2834

DOM (Document Object Model), 2223

selecting items in the DOM, 2328

applying styles, 6068

changing location of element, 6163

showing/hiding elements, 6768

transforms, 6367

<table>, 1516

validating user input, 190209

button element, 205206

button input type, 203205

checkbox input type, 200201

content attributes, 206209

email input type, 198199

password input control, 197198

pattern specification, 207208

placeholder attribute, 208

radio input type, 201202

range input type, 202203

read-only controls, 206207

required controls, 208209

spell checker, 207

text and textarea input types, 193195

url input type, 195197

writing code to interact with UI controls, 2258

adding/modifying HTML elements, 2234

implementing graphics with <canvas> element, 3958

implementing media controls, 3439

SVG (Scalable Vector Graphics, 5558

HTML5 semantic markup, 215. See also HTML5 elements

<article> element, 89

<aside> element, 1112

core structure of an HTML5 page, 34

<div> element, 1516

<figcaption> and <figure> elements, 1213

<header> and <footer> elements, 5

<hgroup> element, 7

<mark> element, 14

<nav> element, 6

<progress> element, 1314

<section> element, 910

HTML applications, styling

box properties, 244263

appearance attributes, 244249

element position, 258263

graphic effects, 249258

text properties, 235242

alignment, 240

bold, 237

color, 236237

fonts, 238239

hyphenation, 241242

italic, 238

spacing, 241

hyphenation, applying to text, 241242

hyphen property, 241

I

identity operators, 113

idle value, app cache staus property, 79

if keyword, 113

iFrames, preventing code injection, 217

if statements, 113115

images, drawing with <canvas> element, 5253

implementation

document structure and objects

applying styling to HTML5 elements, 6068

creating and implementing objects and methods, 93100

creating document structure, 219

establishing scope of objects and variables, 8691

HTML5 APIs, 7284

graphics, <canvas> element, 3958

media controls, 3439

<audio> element, 3839

<video> element, 3538

program flow, 112129

advanced arrays, 122125

arrays, 117120

callbacks, 156170

evaluating expressions, 112116

exception handling, 149154

iterative control flow, 125129

raising and handling events, 130147

special types of arrays, 121122

web worker process, 172180

!important keyword, overriding inheritance, 307308

increment, for loops, 126

indeterminate progress tasks, 14

indexed positions, arrays, 117

indexOf method, 119

inheritance, 99100, 307308

inherit value, visibility property, 68

inline display, 68

input controls, validating user input, 190206

button element, 205206

button input type, 203205

checkbox input type, 200201

email input type, 198199

password input control, 197198

radio input type, 201202

range input type, 202203

text and textarea input types, 193195

url input type, 195197

insertBefore method, 30

inset parameter, box-shadow property, 252, 255

intervals, web worker process, 180

isFinite function, validating data, 216

isNaN function, validating data, 216

italic, applying to text, 238

iterative flow control, 125129

do...while loops, 128129

for...in loops, 127

for loops, 126127

short circuiting loops, 129

while loops, 127128

iterative program flow, 111

J

JavaScript

validating user input, 211217

built-in functions, 216

preventing code injection, 216217

regular expressions, 211215

writing code to interact with UI controls, 2258

adding/modifying HTML elements, 2234

implementing graphics with <canvas> element, 3958

implementing media controls, 3439

SVG (Scalable Vector Graphics, 5558

JavaScript alert method, 25

JavaScript messaging framework, Web Worker API and, 176

JavaScript Object Notification (JSON) strings, 76

join method, 119

jQuery, 28

creating dynamic webpages, 161165

finding elements, 300304

wiring events, 165167

jQuery.serialize method, serializing and deserializing binary data, 227228

JSON data

consuming data, 219

serializing and deserializing, 225

JSON (JavaScript Object Notification) strings, 76

justify value, text-align property, 240

K

keyboard events, 140141

keyCode property, keyboard events, 141

keydown events, 140

key method, 73

keypress events, 140

keyup events, 140

keywords

break, 115, 129

else, 113

@font-face, 238

if, 113

!important, overriding inheritance, 307308

leveraging this keyword, 91

new, 117

optional default, 115

self, 177

switch, 115

throw, 153

var, declaring variables, 87

L

lastChild property, 31

lastIndexOf method, 119

layout containers, creating document structure, 1516

layout, content, 266287

flexible box model, 266273

grid alignment, 280285

multi-column layout, 273276

position, floating, and exclusions, 276279

regions, grouping, and nesting, 286287

left property, positioning elements, 61

left value, text-align property, 240

length property

arrays, 118119

storage objects, 73

leveraging, this keyword, 91

lifetime, variables and variable scope, 8790

limitations, web workers, 179180

linear-gradient function, 251252

linear gradients, 51

linear value, transition-timing property, 290

lineCap property, 43

lines, drawing with <canvas> element, 4143

lineTo method, 41

lineWidth property, 42

:link pseudo-class, 302

LoadFromStorage method, 74

local scope variables, 87

localStorage object, 72

local Web storage, 72

location services, Geolocation API, 8184

logical operators, 112

loop attribute, <video> element, 35

loops

do...while, 128129

for, 126127

for...in, 127

short circuiting, 129

while, 127128

M

manifest file, AppCache API, 7779

manipulation, document structure and objects

applying styling to HTML5 elements, 6068

creating and implementing objects and methods, 93100

creating document structure, 219

establishing scope of objects and variables, 8691

HTML5 APIs, 7284

manual value, hyphen property, 241

map method, 125

margins, styling HTML apps, 247249

<mark> element, 14

matrix 3-D transformation, 291

max attribute, <progress> element, 13

maximumAge property (PositionOptions object), 82

maximum value, wrap-flow property, 277

media controls, 3439

<audio> element, 3839

<video> element, 3538

media queries, adjusting UI animation, 292297

message property, exception objects, 150

methods

Abort, 220

addColorStop, 51

addEventListener, 133134, 146

AFunction, 89

appendChild, 29

arc, 43

beginPath, 41, 47

bezierCurveTo, 43

BFunctionWithParam, 89

clear, 73

closePath, 47

close, WebSocket objects, 161

concat, 118119

createPattern, 52

createRadialGradient, 51

creating and implementing, 93100

custom objects, 9598

inheritance, 99100

native objects, 94

currentTime, 38

dispatchEvent, 146

document.createElement, 29

drawImage, 52

error, 83

evenNumberCheck, 123, 124

every, 122123

fill, <canvas> element, 4952

fillRect, 49

filter, 124

forEach, 124

Form.Submit, serializing and deserializing binary data, 226227

getAllResponseHeaders, 220

getCurrentPosition (Geolocation API), 8183

getElementById, 23, 25, 30, 60

getElementsByClassName, 23, 26

getElementsByTagName, 23, 26

getItem, 73

getResponseHeader, 220

indexOf, 119

insertBefore, 30

JavaScript alert, 25

join, 119

jQuery.serialize, serializing and deserializing binary data, 227228

key, 73

lastIndexOf, 119

lineTo, 41

LoadFromStorage, 74

map, 125

moveTo, 41, 45

multiplyNumbers, 154

MyCallBack, 156

object.create, 99

onerror, Worker objects, 177

onmessage, Worker objects, 176

Open, 220

path, <canvas> element, 4748

pause(), 38

play(), 38

pop, 121

postMessage

passing parameters, 179

Worker objects, 176

push, 121

quadradicCurveTo, 43

quadraticArc, 45

quadraticCurveTo, 45

querySelector, 23, 2728

querySelectorAll, 23, 2728

rect, <canvas> element, 4849

reduce, 125

reduceRight, 125

removeChild, 32

removeEventListener, 133134

removeItem, 73

removeNode, 32

replaceChild, 33

replaceNode, 33

reverse, 119120

rotate, applying transforms to elements, 6465

scale, applying transforms to elements, 66

Send, 220

setInterval, 180

setItem, 73

setRequestHeader, 220

setTimeout, 180

shift, 121122

skew, applying transforms to elements, 66

slice, 120

some, 123

sort, 120

splice, 120

stroke, 41

strokeText, 53

success, 83

swapCache, 79

terminate, Worker objects, 176

translate, applying transforms to elements, 65

translateX, 65

translateY, 65

unshift, 121122

update, 79

volume, 38

watchPosition (Geolocation API), 8384

WillCallBackWhenDone, 156

WorkWithCanvas, 153

modifying HTML5 elements, 2234

altering the DOM, 2834

DOM (Document Object Model), 2223

selecting items in the DOM, 2328

month input element, 193

mousedown events, 142

mouseenter events, 142

mouse events, 141143

mouseleave events, 142

mousemove events, 142

mouseover events, 142

mouseup events, 142

moveTo method, 41, 45

multi-column layout, content, 273276

multi-dimensional arrays, 117

multiplyNumbers method, 154

MyCallBack function, 156

N

named flow, 286

name property, exception objects, 150

native objects, creating and implementing, 94

<nav> element, 6

nesting conditional statements, 114

nesting content, 286287

NETWORK section, AppCache API manifest file, 78

new keyword, 117

none value, hyphen property, 241

null values, exception handling, 154

number input element, 193

number property, exception objects, 150

O

object.create method, 99

object inheritance, 99100

objects

creating and implementing, 93100

custom objects, 9598

inheritance, 99100

native objects, 94

scope, 8691

avoiding use of global namespace, 9091

leveraging the this keyword, 91

lifetime, 8790

Obsolete value, app cache status property, 79

offsetX property, mouse events, 142

offsetY property, mouse events, 142

oncached event, 80

onchecking event, 80

ondownloading event, 80

onerror event, 80

onerror method, Worker objects, 177

onmessage event handlers, 160

onmessage method, Worker objects, 176

onnoupdate event, 80

onobsolete event, 80

onprogress event, 80

onreadystatechange event, 219

ontimeout event, 219

onupdateready event, 80

opacity property, 249250

opacity, styling HTML apps, 249250

Open method, 220

OPEN value, readyState property, 161

operators

conditional, 112

equality, 113

identity, 113

logical, 112

ternary, 116

optional default keyword, 115

OR logical operator, 114

overriding inheritance, !important keyword, 307308

P

padding, styling HTML apps, 247249

parameters

AJAX call, 164165

bezierCurveTo method, 46

box-shadow property, 252

drawing arcs, 44

linear-gradient function, 251252

postMessage method, 179

quadraticCurveTo method, 4546

rect method, 48

text-shadow property, 256257

WebSocket constructors, 159

XMLHttpRequest open method, 221

passing parameters, postMessage method, 179

password input control, validating user input, 197198

path methods, <canvas> element, 4748

pattern attribute, validating user input, 207208

pause() method, <video> element, 38

placeholder attribute, validating user input, 208

play() method, <video> object, 38

polyline, 42

pop method, 121

positionError object, 83

PositionOptions object, properties available, 81

position property, 258259

poster attribute, <video> element, 35

postMessage method, passing parameters, 179

preventing code injection, 216217

program flow, 112129

advanced arrays, 122125

arrays, 117120

behavioral, 111

callbacks, 156170

anonymous functions, 167169

bidirectional communication with WebSocket API, 157161

dynamic webpages, jQuery and AJAX, 161165

this pointer, 169170

wiring events with jQuery, 165167

conditional, 111

evaluating expressions, 112116

if statements, 113115

switch statements, 115116

ternary operators, 116

exception handling, 149154

checking for null values, 154

try...catch...finally constructs, 149154

iterative, 111

iterative flow control, 125129

raising and handling events, 130147

addEventListener and removeEventListener methods, 133134

anonymous functions, 134135

assignment event handling, 133134

bubbled events, 136138

canceling events, 135136

custom events, 146

declarative event handling, 132

DOM events, 139146

event objects, 131132

special types of arrays, 121122

web worker process, 172180

configuring timeouts and intervals, 180

using web workers, 178179

Web Worker API, 172177

web worker limitations, 179180

<progress> element, 1314

properties

background-image, 250251

border-color, 245

border-spacing, 246

border-style, 245

border-width, 246

Bottom, 61

box-shadow, 252

clip, 257258

color, 236

coords, 83

display, 67, 297

DOM elements, 31

exception objects, 150

fillStyle, 50

flex-wrap, 272273

float, 262263

flow-from, 286

flow-into, 286

font-family, 238

font-size, 239

font typeface, 238

font-weight, 237

grid-columns, 282

grid-column-span, 285

grid-rows, 282

grid-row-span, 285

hyphen, 241

keyboard events, 141

Left, 61

length

arrays, 118119

storage objects, 73

lineCap, 43

lineWidth, 42

mouse events, 142

multi-column, 274

opacity, 249250

position, 258259

PositionOptions object, 81

readyState, 160161

Right, 61

success, AJAX calls, 164

text-align, 240

textAlign, 54

text-indent, 240

text-shadow, 252, 256257

timestamp, 83

Top, 61

transform, 63

transition-delay, 290

transition-duration, 290

transition-property, 290

transition-timing, 290

<video> element, 35, 38

visibility, 68, 297

visibility CSS, 68

window.navigator, 81

wrap-flow, 276279

wrap-margin, 278

XMLHttpRequest object, 220

z-index, 261

pseudo-classes, finding elements, 301304

pseudo-elements, finding elements, 301304

push method, 121

Q

quadraticArc method, 45

quadraticCurveTo method, 43, 45

querySelectorAll method, 23, 2728

querySelector method, 23, 2728

queues (arrays), 121

R

radial gradients, 51

radio input type, validating user input, 201202

radius parameter, drawing arcs, 44

raising an error (throwing an exception), 153

raising events, 130147

addEventListener and removeEventListener methods, 133134

anonymous functions, 134135

assignment event handling, 133134

bubbled events, 136138

canceling events, 135136

custom events, 146

declarative event handling, 132

DOM events, 139146

event objects, 131132

range input type, validating user input, 202203

readonly attribute, validating user input, 206207

readyState property, 160161, 220

rect method, <canvas> element, 4849

reduce method, 125

reduceRight method, 125

referencing elements, CSS files, 306307

regions, content layout, 286287

regular expressions, validating user input, 211215

relative positioning, 61, 259261

removeChild method, 32

removeEventListener method, 133134

removeItem method, 73

removeNode method, 32

replaceChild method, 33

replaceNode method, 33

:required pseudo-class, 302

required controls, validating user input, 208209

reset input element, 193, 204

responseBody property (XMLHttpRequest object), 220

Response property (XMLHttpRequest object), 220

responseText property (XMLHttpRequest object), 220

responseType property (XMLHttpRequest object), 220

responseXML property (XMLHttpRequest object), 220

reverse method, 119120

RGB function, color property, 236

Right property, positioning elements, 61

right value, text-align property, 240

rotate 3-D transformation, 291

rotate method, applying transforms to elements, 6465

row-reverse, flexbox content, 269

S

sandbox attribute values, 217

Scalable Vector Graphics (SVG), 5558

scale 3-D transformation, 291

scale method, applying transforms to elements, 66

scope, objects and variables, 8691

avoiding use of global namespace, 9091

leveraging the this keyword, 91

lifetime, 8790

screen readers, creating document structure, 1719

screenX property, mouse events, 142

screenY property, mouse events, 142

search engine optimization (SEO), 1617

search engines, creating document structure, 1617

<section> element, 910

secure data

consuming data, 218223

serializing, deserializing, and transmitting data, 224228

binary data, 225228

JSON data, 225

XMLHttpRequest object, 224225

validating user input, HTML5 elements, 190209

content attributes, 206209

input controls, 190206

validating user input, JavaScript, 211217

built-in functions, 216

preventing code injection, 216217

regular expressions, 211215

selectors (CSS3), finding elements, 300304

choosing the correct selector to reference an element, 301

defining element, style, and attribute selectors, 300301

selector syntax, jQuery, 165

self keyword, 177

Send function, WebSocket API, 160

Send method, 220

SEO (search engine optimization), 1617

serializing data, 224228

binary data, 225228

JSON data, 225

sessionStorage object, 72

session Web storage, 72

setInterval method, 180

setItem method, 73

setRequestHeader method, 220

setTimeout method, 180

shadow effects, styling HTML apps, 252257

shapes

fill method, 4952

rect method, 4849

shiftKey property, keyboard events, 141

shift method, 121122

short circuiting loops, 129

showing elements, 6768

size, styling HTML box properties, 244245

sizing arrays, 117

skew method, applying transforms to elements, 66

slice method, 120

some method, 123

sort method, 120

spacing, applying to text, 241

special arrays, 121122

special characters, regular expressions, 212213

spellcheck attribute, validating user input, 207

splice method, 120

spread parameter, box-shadow property, 252-254

src attribute, <video> element, 35

stacked case statements, 116

stacks (arrays), 121

startAngle parameter, drawing arcs, 44

start value, wrap-flow property, 277

statements

if, 113115

switch, 115116

static data, 189

static layout, 258

status property

AppCace API, 79

XMLHttpRequest object, 220

statusText property (XMLHttpRequest object), 220

stroke method, 41

strokeText method, 53

structure, creating document structure, 219

HTML5 semantic markup, 215

layout containers, 1516

optimizing for search engines, 1617

screen readers, 1719

structuring CSS files, CSS selectors, 305308

style selectors (CSS3), 300301

styles, flexible boxes, 267

styling HTML, 60-68

box properties, 244263

appearance attributes, 244249

element position, 258263

graphic effects, 249258

text properties, 235242

alignment, 240

bold, 237

color, 236237

fonts, 238239

hyphenation, 241242

italic, 238

spacing, 241

submit input element, 193, 204

subworkers, web worker process, 180

success method, 83

success property, AJAX calls, 164

SVG (Scalable Vector Graphics), 5558

swapCache method, 79

switch keyword, 115

switch statements, 115116

T

<table> element, 1516

tel input element, 193

terminate method, Worker objects, 176

ternary operators, 116

text-align property, 54, 240

textarea input control, validating user input, 193195

text, drawing with <canvas> element, 5355

text drop shadows. See shadow effect

text-indent property, 240

text input control, validating user input, 193195

text-shadow property, 252, 256257

text, styling HTML properties, 235242

alignment, 240

bold, 237

color, 236237

fonts, 238239

hyphenation, 241242

italic, 238

spacing, 241

this keyword, leveraging, 91

this pointer, 169170

throwing an exception (raising an error), 153

throw keyword, 153

time input element, 193

timeout property

PositionOptions object, 81

XMLHttpRequest object, 220

timeouts, web worker process, 180

timestamp property, 83

top property, positioning elements, 61

transformations, creating an animated UI, 291292

transform property, 63

transforms, applying to HTML5 elements, 6367

transition-delay property, 290

transition-duration property, 290

transition-property property, 290

transitions (CSS), animating objects, 289290

transition-timing-property, 290

translate 3-D transformation, 291

translate method, applying transforms to elements, 65

translateX method, 65

translateY method, 65

transmitting data, 224228

transparency, styling HTML apps, 249250

try block (try...catch...finally constructs), 150

try...catch block (try...catch...finally constructs), 150

try...catch...finally constructs, exception handling, 149154

two-dimensional arrays, 118

U

UI controls, writing code to interact with, 2258

adding/modifying HTML elements, 2234

implementing graphics with <canvas> element, 3958

implementing media controls, 3439

SVG (Scalable Vector Graphics, 5558

Uncached value, app cache status property, 79

unshift method, 121122

update method, 79

UpdateReady value, app cache status property, 79

url input type, validating user input, 195197

user input, validating

HTML5 elements, 190209

button element, 205206

button input type, 203205

checkbox input type, 200201

content attributes, 206209

email input type, 198199

password input control, 197198

pattern specification, 207208

placeholder attribute, 208

radio input type, 201202

range input type, 202203

read-only controls, 206207

required controls, 208209

spell checker, 207

text and textarea input types, 193195

url input type, 195197

JavaScript, 211217

built-in functions, 216

preventing code injection, 216217

regular expressions, 211215

V

validating user input

HTML5 elements, 190209

button element, 205206

button input type, 203205

checkbox input type, 200201

content attributes, 206209

email input type, 198199

password input control, 197198

pattern specification, 207208

placeholder attribute, 208

radio input type, 201202

range input type, 202203

read-only controls, 206207

required controls, 208209

spell checker, 207

text and textarea input types, 193195

url input type, 195197

JavaScript, 211217

built-in functions, 216

preventing code injection, 216217

regular expressions, 211215

value attribute, <progress> element, 13

values

hyphen property, 241

status property (AppCace API), 79

text-align property, 240

visibility property, 68

variables, scope, 8691

avoiding use of global namespace, 9091

leveraging the this keyword, 91

lifetime, 8790

var keyword, declaring variables, 87

<video> element, 3538

visibility property, 68, 297

visible value, visibility property, 68

:visited pseudo-class, 302

volume method, <video> element, 38

v-shadow parameter

box-shadow property, 252

text-shadow property, 256

W

watchPosition method, Geolocation API, 8384

web services, consuming JSON and XML data, 219

WebSocket API, bidirectional communication, 157161

WebSocket constructors, parameters, 159

Web Storage API, 7277

Web Worker API, 172177

web worker process, creating, 172180

configuring timeouts and intervals, 180

using web workers, 178179

Web Worker API, 172177

web worker limitations, 179180

web workers, 178179

week input element, 193

while loops, 127128

width parameter

rect method, 48

<video> element, 35

WillCallBackWhenDone function, 156

window.navigator property, 81

wiring events, jQuery, 165167

withCredentials property (XMLHttpRequest object), 220

Worker objects, 176

WorkWithCanvas method, 153

wrap-flow property, 276279

wrap-margin property, 278

writing code, interaction with UI controls, 2258

adding/modifying HTML elements, 2234

implementing graphics with <canvas> element, 3958

implementing media controls, 3439

SVG (Scalable Vector Graphics, 5558

X

XML data, consuming data, 219

XMLHttpRequest object

consuming data, 219223

properties, 220

transmitting data, 224225

x, y parameter, rect method, 48

Z

z-index property, 261

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.178.181