Home Register Members List Search Today's Posts Mark Forums Read

Go Back   TechFuels Forum > Technology Jargons - What is ....? > Software Jargons > Operating System

Reply
 
LinkBack Thread Tools
uncosto46
Senior Member
 

uncosto46 is offline  
Old 08-02-2008, 01:10 PM
  #1 (permalink)
Querying the DOM

The dojo. query function provides a natural segue into general-purpose DOM manipulation and is based on CSS3 selectors. For example, you might use the following logic to query the DOM for any anchor tags and temporarily highlight the background to be yellow for a mouse-over event:
. onmouseout (function levt)
dojo.style(evt.target, (background ""});

The statement inside the dojo. addOnLoad block queries the DOM for any anchor tags using the "a" CSS3 selector and returns a collection of nodes as a specialised subclass of Array called dojo.NodeList. Each of the dojo.NodeList methods is then successively applied to the collection of nodes with the final result being returned so that it can be captured into a variable if desired.

Name:  Querying the DOM.jpg
Views: 15
Size:  25.7 KB

The dojo.NodeList class provides a number of useful methods, such as addClass, removeClass, style and the various Array functions that you already have seen. For example, if you are seduced by the elegant dot notation that dojo.NodeList provides, you may find yourself with an expression like the following:

va! highlyManipula tedNodes = dojo. query ("di v > a") .addClass ("foo")
.onmouseover(function(evt) /' you ... 'Il)
.map(function(item) ( /' .. get *Il)
. filter (function (item) ( /' the 'Il)
.fo!Each(function(item) { /' idea ... 'Il);
It is especially noteworthy that the dojo.NodeList methods named after and triggered by DOM events, such as onmouseover or onblur, accept a single parameter that is a W3C standardised event object, so you are freed from the development and maintenance of yet another layer of subtle incompatibilities when developing a Web application. In fact, the next section investigates the very mechanism that makes this possible.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT +1. The time now is 12:33 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0
Copyright Techfuels


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98