Information about http://www.manning.com/bibeault/excerpt_index.pdf

Tags: activex, ajax, animations, api, collisions, conflicts, css properties, element creation, jquery, libraries, life cycle, puff, request parameters, responsexml, submission, uploading files, wrapper method, xml,
Pages: 9
Language: english
Created: Sat Jan 19 13:30:26 2008
Display cached document
Page 1
image
Page 2
image
Page 3
image
Page 4
image
Page 5
image
Page 6
image
Page 7
image
Page 8
image
Page 9
image
                                                                                   index
Symbols                            $.trim() 9, 168                     request life cycle 223
                                   $.unique() 176                      request parameters 221
$                                                                      responses 223­224
    as function namespace 154      A                                   responseText 223
    as namespace prefix 9                                              responseXML 223
    avoiding name collisions       abbr element 262                    setting defaults 252­253
        189                        ActiveX control 218                 uploading files 284
    defining locally 164           Adaptive Path 218                   XML, not using 223
    in plugins 189                 add() 36, 247                     ajaxForm Lab 282, 284
    in ready handler 165           addClass() 59                     ajaxForm() 282
    naming conflicts 14            adding a wrapper method           ajaxFormUnbind() 282
    sharing with other libraries         199­201                     ajaxSubmit Lab 279­280
        164                        adding select options 159         ajaxSubmit() 277, 279
$() 6                              after() 73                        alpha filters 62
  adding wrapper methods           Ajax 218­226                      andSelf() 47
        216                          comprehensive 258­266           animate () 145, 148
  for element creation 11            comprehensive jQuery API        animations
$.ajax() 249, 261, 278                     249­252                     CSS properties 146
$.ajaxSetup() 252                      diagrammed 223                  custom drop 148­150
$.browser 157, 247                     Form Plugin, using 276­284      custom fading 147
$.each() 169                           form submission via 276­        custom puff 150­151
$.extend() 177, 191, 210, 261              284                         custom scale 148
$.fn 199, 246, 259                     GET 235­236                     easing 147
$.get() 236, 252                       Global Callback Info object     stopping 145
$.getJSON() 237, 241                       253                         using Flash 127
$.getScript() 180                      global functions 254­258      anonymous event handler
$.grep() 170                           growth catalyst 2                 86
$.inArray() 175                        HTTP requests 233­234         anonymous functions 165
$.livequery.run() 294                  iframes, using 218            anonymous listeners 86
$.makeArray() 175                      initilizing 219               API. See jQuery API
$.map() 172                            loading content 226           append() 70
$.noConflict() 164, 189, 192           loadng scripts 181            appending content 70, 72
$.post() 248, 252                      POST requests 248­249         appendTo() 71
$.styleFloat 163                       ready state handler 221       appetizer menu 113­124


                                                   339
340        INDEX




Application Programming          chain 7                           custom animations 145­151
     Interface. See jQuery API      managing 45­47                 custom attributes 52­53
arrays, filtering 170­172        chaining 45­47                    custom properties 211
assigning properties 51          change() 102, 231                 custom selectors 27­30
Asynchronous JavaScript and      child selector 21
     XML. See Ajax               children() 43                     D
attr() 52, 54­55                 class names
attribute selectors 22              adding, removing 58­60         data conversion 173
attributes 49                       fetching 67                    data translation 172­176
  applying 56­58                 Clear and Reset Lab 274           Date 195
  diagrammed 50                  clearForm() 275                   date formatting 195­199
  Internet Explorer limita-      click() 102, 107                  dblclick() 102
       tions 56                  clone() 45, 78                    defining functions 193
  normalized values 53           closures 84, 90, 211, 334­337     dependent dropdowns 237
  removing 56                    code consistency, reusability     DHTML 49
  setting 54­56                      186                           dimensions 286­289
  values, fetching 52­54         collapsible list, implementing    Dimensions Plugin 285­291
augmenting wrapped sets 38           128­134                         height() 285
                                 collecting properties 52            innerHeight() 286
B                                collisions, naming 187­189          innerWidth() 286
                                 command chain 7                     offset() 290
Basic Event Model 84               managing 45­47                    offsetParent() 290
before() 73                      commands 17                         outerHeight() 286
behavior, separating from        commerce 229                        outerWidth() 286
     structure 4                 container selector 23               position() 290
bind() 98, 293                   contains() 44                       scrollLeft() 287
black box 225                    content scrolling 287               scrollTop() 287
blur() 102, 107                  contents() 43                       width() 285
Boot Closet page 264­266         copying                           Dimensions Plugin Scrolling
box model 161, 286                 address information 202­            Lab 287
  diagrammed 162                       206                           exercises 289
browser detection 155­161          elements 78                     disabling form elements 13
  alternatives 156­157           creating DOM elements 11          DOCTYPE 161
  jQuery flags 157­163           creating utility functions 194,   Document Object Model
bubble phase 94                      196­199                           (DOM) 10, 17, 49­58
bubbling 88­90                   cross-browser Ajax 219              cloning elements 78
  stopping 91                    CSS                                 copying elements 70, 78­80
                                   absolute positioning 150          creating new elements 11
C                                  hiding elements 128               event bubbling 88­90
                                   inline vs block 128               form elements 79­80
callback functions 329­330         offset parent 289                 generating elements 31­32
Camino 155­160, 328                opacity 142, 147                  manipulation 68
  reloading 306                    overflow 289                      moving elements 70­80
capability detection 156           relative positioning 149          NodeList 50
capture phase 94                   styling lists 132                 removing elements 76­77
cascading dropdowns 237­245        See also Cascading Style          replacing elements 77
Cascading Style Sheets 2                Sheet                        setting content 68
  class names 58, 67             css() 61­62, 132, 200               wrapping elements 75
  comma operator 38              CSS3 6                            document ready handler 9
                                                                               INDEX       341



document scrolling 288                hide 127                    event models
DOM elements, positioning             show 127                      Basic 85­87
    285­291                           sliding 143­144               DOM Level 0 85­87
DOM Level 0 85­87                   elements                        DOM Level 2 91­96
DOM Level 1 84                        abbr 262                      Internet Explorer 97
DOM Level 2 91­96                     animating 135­145             jQuery 98­124
DOM manipulation 258                  attributes 49­58              Netscape 85­87
DOM. See Document Object              cloning 78                  event propagation 106
    Model (DOM)                       content 68­70                 diagrammed 95
Double Submit Problem 57              copying 70, 78­80           event, toggling 108
drag-and-drop 300                     event handlers 85           event-driven interfaces 83
draggable() 300, 304                  fading 140                  events 112­124
draggableDestroy() 303                form elements 79­80           addEventListener() 92
draggableDisable() 304                listeners 85                  attachEvent() 97
draggableEnable() 304                 moving 70­80                  binding 98
draggables 300­308                    properties 49­58              bubble phase 94
  axis of movement 307                removing 76­77                bubbling 88­90
  constraining 307                    replacing 77                  cancelling propagation 91
  containment 307                     selecting 17                  capture phase 94
  grid 308                            setting content 68            establishing multiple 92­94
  required files 301                  showing and hiding 127­       Event instance 88
  suitability concept 309                 130                       key codes 105
dropdowns 237                         sliding 143­144               modifier keys 105
droppable() 308                       span 262                      propagation 94­96
droppableDestroy() 314                styling 58­68                 semantic actions 106
droppableDisable() 315                title attribute 258           srcElement 88
droppableEnable() 315                 toggling 134                  stopping propagation 106
droppables 308­315                    wrapping 75                   target element 88
  drop event 309                    empty() 77                      triggering 106­107
  options 309                       emptying select elements      expando 211
  required files 308                    246                       expire() 295
  state transition diagram          encodeURIComponent() 221      extending jQuery 13, 186­216
       309                          end() 46                        comprehensive examples
  states 309                        error callback 253                  245
dynamically loading scripts         error() 102                     defining wrapper methods
    180­183                         event handlers 83                   199­216
                                      anonymous 86                  emptying select elements
E                                     as attributes 86                  246
                                      removing 103                  implementation functions
each() 13, 51, 90, 148, 200, 211,     toggling 108­110                  212­214
    246, 337                        event handling                  in $ namespace 192­193
easing 147                            hovering 110­112              loading select elements 246
Easing Plugin 147                     proactive 292­293             motivations 186­187
effects 127                         Event instance 87, 104          naming files 188
  custom drop 148                     cancelBubble 91               The Termifier 260­264
  custom fading 147                   normalizing 104               utility functions 192­193
  custom puff 150                     preventDefault() 106        extending objects 176­180
  custom scale 148                    stopPropagation() 91, 106
  fading 140                          target 107
342         INDEX




F                                 resetForm() 275                 H
                                  uploading files 284
fadeIn() 141                    form submission                   halting form submission 91
fadeOut() 141                     hijacking 281­284               hasClass() 67
fadeTo() 142                      semantic events 282             hash as parameter 190­192
fieldSerialize() 272              via Ajax 281­284                height() 63­64, 285
fieldValue() 270­272              via focusable element 284       hide() 127, 135
filesystem browsing 128         formatting fixed-width out-       hover() 111
filter selectors 29                 put 194                       hovering 110­112
filter() 41, 202                forms, serializing 227            HTML 5 Draft Specification
filtering data 170­172          formSerialize() 272                     262
filtering wrapped sets 40       Function                          HTML Specification 270
find selectors 29                 apply() 331                     html() 7, 68
find() 44                         as first-class object 326       HTML, generation 31­32
Firebug 321                       call() 331                      HTTP. See Hypertext Trans-
Firefox 155, 160, 321, 328        function keyword opera-            fer Protocol (HTTP)
   reload vs. refresh 140              tion 327                   Hypertext Transfer Protocol
   reloading 306                  naming 327­328                     (HTTP) 83, 248
fixed-width output 193­         function context 84, 200,           methods 221, 227
      194                           330­331                             effects on caching 234
flags 154                       functional programming 334            status codes 222
   $.boxModel 161               functions
   $.browser 157                  as callbacks 329­330            I
   $.styleFloat 163               as methods 328, 334
Flash 127                         assigning context 331           idempotent requests 234
float styles, browser differ-     context 330                     iframe 284
      ences 163                   function literal 327            implementation functions 213
flyout 258                        top-level 327                   index() 36
focus() 102, 107                                                  information overload 128, 130
form controls                   G                                 inheritance 176
   clearing 274­276                                               innerHeight() 286
   resetting 274­276            Gecko 158, 328                    innerWidth() 286
   serializing 272­274          GET 221, 227, 234, 261            insertAfter() 73
   submission order 273         Get Form Value(s) Lab 271,        insertBefore() 73
   successful concept 270           273                           inserting dynamic HTML 74
form elements 79­80             get() 35                          Internet Explorer 155, 158,
Form Plugin 80, 269­284         GIF 266                                 160
   ajaxForm Lab 282             global Ajax functions 253­258         box model 161
   ajaxForm() 282               Global Callback Info object 253       event handling limitations
   ajaxFormUnbind() 282         global flags 154                          96
   ajaxSubmit Lab 279           global namespace 14                  Event Model 97
   ajaxSubmit() 277               polluting 198                   inverting selectors 29­30
   Clear and Reset Lab 274      Google 218                        is() 45, 67, 132, 135
   clearForm() 275              Graphical User Interface          iterating 51
   download location 269             (GUI) 83                        properties and collections
   fieldSerialize() 272           drag-and-drop 300                       169­170
   fieldValue() 271             grep 170
   formSerialize() 272          GUI. See Graphical User
   Get Form Value Lab 271            Interface (GUI)
                                                                             INDEX     343



J                                    Unobtrusive JavaScript 3­5   $.noConflict 164
                                     var keyword explained 325    $.post() 248
Java Swing 83                        window properties 325        $.styleFloat 163
JavaScript                           XML and 223                  $.trim() 9, 168
  . operator 323                   Jedi mind tricks 327           $.unique() 176
  adding select options 158        Jesse James Garrett 218        addClass() 59
  advanced example 258             jQuery 2­5                     after() 73
  closure variables 335              $() 6                        ajaxComplete() 254
  closures 84, 211, 334­337          add() 36                     ajaxError() 254
  creating objects 320               browser detection flags      ajaxSend() 254
  Date 195                               157­163                  ajaxStart() 254
  dot operator 323                   chaining 7, 186, 200, 261    ajaxStop() 254
  dynamic creation of                chains 45­47                 ajaxSuccess() 254
       properties 321                commands 17                  andSelf() 47
  essential concepts 320             contains() 44                animate() 145
  extending objects 176              CSS implementation 20        append() 70
  for loop 169                       custom selectors 27­30       appendTo() 71
  for-in loop 169                    document ready handler 9     attr() 52, 54­55
  Function 84                        DOM manipulation 17          before() 73
  function contexts 84, 200          essential JavaScript         bind() 98
  function keyword 327                    concepts 319            blur() 102, 107
  functions 326                      Event Model 99               change() 102
  general reference operator         extending 12­13, 186­216     children() 43
        323                          flags 154                    click() 102, 107
    getAttribute() 53                global Ajax commands 254     clone() 78
    isNaN() 173                      manipulating objects 167­    contents() 43
    libraries 14                         180                      css() 61­62
    libraries, using with jQuery     plugins 268­317              dblclick() 102
        163­167                      selectors 17­30              each() 13, 51
    NaN 173                          translating data 172­176     empty() 77
    navigator 155                    trimming strings 168         end() 46
    new operator 320                 using with other libraries   error() 102
    nonstandard property                 14, 163­167              fadeIn() 141
        names 323                    utility functions 8, 154     fadeOut() 141
    Number 174                       wrapper 6­7                  fadeTo() 142
    Object 84, 320­326             jQuery API                     filter() 41
    object hash 191                  $.ajax() 249                 find() 44
    Object literals 324­325          $.ajaxSetup 252              focus() 102, 107
    object properties 321­323        $.boxModel 161               get() 35
    object property diagram          $.browser 157                hasClass() 67
        322                          $.each() 169                 height() 63­64
    object-oriented 176              $.extend() 177               hide() 135
    property references 322          $.get() 234­236              hover() 111
    prototype property 177           $.getJSON() 237              html() 7, 68
    regular expressions 172,         $.getScript() 180            index() 36
        198                          $.grep() 170                 insertAfter() 73
    setAttribute() 53                $.inArray() 175              insertBefore() 73
    String 168, 172, 174             $.makeArray() 175            is() 45
    top-level scope 325              $.map() 172                  jQuery() 6
344        INDEX




jQuery API (continued)           as Ajax response 223            M
  keydown() 102                  JavaScript Dates and 324
  keypress() 102                 object example 324              match handler 298
  keyup() 102                  JSP 225                           match listeners 294
  load() 102, 226                                                merging objects 179
  mousedown() 102              K                                 merging options 210
  mousemove() 102                                                method 334
  mouseout() 102               keydown() 102                     Microsoft 218
  mouseup() 102                keypress() 102                    MIME type in Ajax response
  next() 43                    keyup() 102                           223
  nextAll() 43                 Konqueror 161                     mismatch handler 298
  noConflict() 14                                                mismatch listeners 294
  not() 39                     L                                 mousedown() 102
  one() 102                                                      mousemove() 102
  parent() 43                  Laboratory pages                  mouseout() 102
  parents() 43                    ajaxForm Lab 282               mouseup() 102
  prepend() 73                    ajaxSubmit Lab 279             Move and Copy Lab 72
  prependTo() 73                  Clear and Reset Lab 274        -moz-opacity 62
  prev() 43                       Dimensions Plugin Scrolling    multi-browser support 159
  prevAll() 43                         Lab 287                   multipart forms 284
  ready() 10                      Get Form Value Lab 271         multiple class names 58
  removeAttr() 56                 Get Form Values 271
  removeClass() 59                Live Query Lab 296             N
  resize() 102                    Move and Copy Lab 72
  scroll() 102                    Selectors Lab 17               name collisions 187­189
  select() 102, 107               UI Draggables Lab 304          namespace, global 198
  serialize() 227                 UI Droppables Lab 311          NaN 174
  serializeArray() 228            Wrapped Set Lab 33             navigator object 155
  show() 136                   leveraging jQuery 186             nesting selectors 23
  siblings() 43                libraries, using with jQuery 14   .NET framework 83
  size() 34                    listeners 83                      Netscape Communications
  slice() 42                      match and mismatch 294             Corporation 84
  slideDown() 143                 proactive 292­293              Netscape Event Model 84
  slideToggle() 144            Live Query Lab 296                Netscape Navigator 84
  slideUp() 144                Live Query Plugin 292­299         next() 43
  stop() 145                      $.livequery.run() 294          nextAll() 43
  submit() 102, 107               capabilities 292               noConflict() 14
  toggle() 108, 137               expire() 295                   NodeList 50, 175
  toggleClass() 59                expiring listeners 295         non-idempotent requests
  trigger() 106                   forcing evaluation 294             234
  unbind() 103                 livequery() 293­294               normalizing event targets 88
  unload() 102                 load() 102, 226, 231, 252, 263    not() 39
  val() 79­80                  loading content                   Number.NaN 174
  width() 63­64                   Ajax 224­226
  wrap() 75                       dynamic data 229­233           O
jQuery Effects Lab 138­144        jQuery 226­228
JSON 236, 241, 263, 277, 324      select elements 246            Object
  array example 325                                               literals 324­325
  array notation 241                                              properties 321­323
                                                                                INDEX         345



object detection 156, 247      Photomatic jQuery extension       ready state handler 222­223
  feasibility 158                 206­216                        ready() 10
  for Ajax 219                 PHP 225                           real-time data 229
object hash 190­192            plain text response 223           regular expression 170
object orientation 176         plugins 268­317                   relational selectors 20
object-oriented JavaScript       creating 186­216                removeAttr() 56
      176                        Dimensions 149                  removeClass() 59
objects, extending 176           Dimensions Plugin 285­291       removing elements 77
Observable pattern 92            Easing 147                      removing wrapped set
offset parent 289                Form Plugin 269­284                  elements 39
offset() 290                     Live Query Plugin 292­299       rendering
offsetParent() 290               on the web 269                    quirks mode 161
offsets 289­291                  strategy 269                      strict mode 161
OmniWeb 155, 157, 160            UI Plugin 299­316               rendering engine 158
one() 102                      PNG files 266                     replacing elements 77
online retailers 229           position() 290                    reporting Ajax errors 253
onload handler, alternative    positional selectors 24­27        request header 155
     to 9                      positioning 289                   request parameters 221, 227,
onresize 65                    positions 289­291                     236, 264
Opera 155, 157, 160, 247       POST 221, 227, 234, 248­249       requests
operator 323                   prepend() 73                        idempotent 234
options hash 190­192, 261      prependTo() 73                      non-idempotent 234, 248
  extensive example 208        prev() 43                         resetForm() 275
  used for wrapper method      prevAll() 43                      resize() 102
        261                    proactive event handling 292      resources
OS X, dragging images from     product description page            Form Plugin download 269
    browser 305                    231­233                         jQuery plugins 188
outerHeight() 286              progressive disclosure 113, 128     plugins 269
outerWidth() 286               propagation of events 94­96         quirksmode.org 161
Outlook Web Access 218         properties 49                       UI Plugin URL 300
overflow 289                     diagrammed 50                   response 223­224
                                 of JavaScript objects 321­        JSON 236
P                                    323                         responseText 220, 223, 226
                               property referencing 322          responseXML 223
page rendering 161             Prototype 192                     retail web sites 229
parameters 190­192               using with jQuery 14, 163­      reusability 186
parent() 43                          167                         reusable components 167
parents() 43                   prototype 177, 199                RIA. See Rich Internet Appli-
parsing ZIP codes 172                                                 cation (RIA)
patterns                       Q                                 Rich Internet Application
  necessity in Rich Internet                                          (RIA) 2, 17, 92, 218, 237
      Applications 5           query string 221, 227, 274
  Observable 92                quirks mode 161                   S
  options hash 192
  progressive disclosure       R                                 Safari 155, 160, 247
        113                                                        problems loading scripts
    repetitiveness 186         read-only status, applying              181
    responsibilities and 5         201­206                       scripts, dynamic loading 180­
    structure and 4            ready handler 165                     183
346        INDEX




scroll() 102                   string trimming 168               droppableDestroy() 314
scrollbars 288                 styles, setting 61­67             droppableDisable() 315
scrolling dimensions 287­289   styling 58­68                     droppableEnable() 315
scrollLeft() 287               submit() 102, 107                 droppables 308­315
scrollTop() 287                submitting forms                  Droppables Lab 311
select() 102, 107                 Ajax 276­284                   magnify 316
selecting check boxes 27       subsettting wrapped sets 42­      mouse interactions 300­315
selectors 3, 6, 17­30, 258         43                            required files 301
  attribute 20, 22­24                                            resizables 315
  basic 19­20                  T                                 selectables 315
  child 20­24                                                    slider 316
  container 20, 23­24          Termifier, The 259                sortables 315
  CSS syntax 17                test-driven development           table 316
  custom 27­30                     208                           tabs 316
  filter 29                    text() 69                         UI Draggables Lab 304
  find 29                      this 330­334                      widgets 316
  form-related 29              thumbnail images 206            UI principles
  inverting 29­30              timers 83                         gradual transition 135
  nesting 23                   title attribute 258, 261          progrssive disclosure 128
  positional 24­27             toggle() 108, 134­137           unbind() 103, 295
  regular expression syntax    toggleClass() 59                United States Postal Codes
      22                       toggling display state 134          172
   relational 20­24            Tomcat web server 225           unload() 102
   XPath plugin 30             tooltip 258                     Unobtrusive JavaScript 3, 87,
Selectors Lab 17               top-level flags and functions       115, 230, 292
self-disabling form 57             154                           practical application 209
semantic actions 83, 106       translating data 173            unsuccessful form elements
serialize() 227                translation 172­176                 79
serializeArray() 228           Trash 300                       uploading via Ajax 284
serializeForm() 276            trigger() 106                   URI encoding 221, 227
server setup 225               trimming 168                    URL 221, 227
server-side                                                      encoding 272
   resources 225               U                               user agent detection 155­161
   state 248                                                   user interface, annoyances 49
   templating 230              UI Draggables Lab 304­305       utility functions 8, 154
servlet 225                    UI Droppables Lab 311­313
setting width 63               UI Plugin 299­316               V
show() 127, 136                 accordian 316
siblings() 43                   calendar 316                   val() 79­80, 231, 270
size() 34                       dialog 316                     variables as part of closure
slice() 42                      download location 300              335
slideDown() 143                 draggable() 300                viewport scrolling 287
slideshows 206­209              draggableDestroy() 303
slideToggle() 144               draggableDisable() 304         W
slideUp() 144                   draggableEnable() 304
sniffing 155­161                draggables 300­308             W3C 159
spoofing 155                    drop shadow 316                 box model 161
stop() 145                      drop zones 312                 W3C DOM Specification 84
strict mode 161                 droppable() 308                Wastebasket 300
                                                                       INDEX         347



web server 225                 obtaining elements from   XML 236, 277
width and height 64                34­36                 XML DOM 223
width() 63­64, 285           removing elements 39­42     XMLHTTP 218
wiki 57                      subsetting 42­43            XMLHttpRequest (XHR) 218
window                     Wrapped Set Lab 33             instance creation 219
  origin 289               wrapper 7                      instantiating 219
  properties 325           wrapper methods                making the request 221­222
  scrolling 288              applying multiple opera-     methods and properties
window.event 87, 97, 104         tions 201­206                 219
window.setInterval() 335     defining 199­216             ready state handler 221
window.setTimeout() 329      implementation functions     responses 223­224
wrap() 75                          212­214                responseText 223
wrapped set 7, 32, 43­44       mainaining state 210       responseXML 223
  adding elements 36­39                                   status 222
  as array 34              X                             XPath selectors plugin 30
  augmenting 36­43
  determining size 34      X11 83                        Z
  filtering 40             XHR. See XMLHttpRequest
  iterating over 51           (XHR)                      zebra-striping 2
  manipulation 32          XHTML 53                      ZIP Codes 172