]> git.wh0rd.org - tt-rss.git/blame - lib/dojo/_base/NodeList.js.uncompressed.js
update dojo to 1.7.3
[tt-rss.git] / lib / dojo / _base / NodeList.js.uncompressed.js
CommitLineData
1354d172
AD
1define("dojo/_base/NodeList", ["./kernel", "../query", "./array", "./html", "../NodeList-dom"], function(dojo, query, array){
2 // module:
3 // dojo/_base/NodeList
4 // summary:
5 // This module defines dojo.NodeList.
6
7var NodeList = query.NodeList;
8
9 /*=====
10 dojo.extend(dojo.NodeList, {
11 connect: function(methodName, objOrFunc, funcName){
12 // summary:
13 // attach event handlers to every item of the NodeList. Uses dojo.connect()
14 // so event properties are normalized
15 // methodName: String
16 // the name of the method to attach to. For DOM events, this should be
17 // the lower-case name of the event
18 // objOrFunc: Object|Function|String
19 // if 2 arguments are passed (methodName, objOrFunc), objOrFunc should
20 // reference a function or be the name of the function in the global
21 // namespace to attach. If 3 arguments are provided
22 // (methodName, objOrFunc, funcName), objOrFunc must be the scope to
23 // locate the bound function in
24 // funcName: String?
25 // optional. A string naming the function in objOrFunc to bind to the
26 // event. May also be a function reference.
27 // example:
28 // add an onclick handler to every button on the page
29 // | dojo.query("div:nth-child(odd)").connect("onclick", function(e){
30 // | console.log("clicked!");
31 // | });
32 // example:
33 // attach foo.bar() to every odd div's onmouseover
34 // | dojo.query("div:nth-child(odd)").connect("onmouseover", foo, "bar");
35 },
36 coords: function(){
37 // summary:
38 // Deprecated: Use position() for border-box x/y/w/h
39 // or marginBox() for margin-box w/h/l/t.
40 // Returns the box objects of all elements in a node list as
41 // an Array (*not* a NodeList). Acts like `dojo.coords`, though assumes
42 // the node passed is each node in this list.
43
44 return dojo.map(this, dojo.coords); // Array
45 }
46 });
47
48 var NodeList = dojo.NodeList;
49 =====*/
50 var nlp = NodeList.prototype;
51
52 // don't bind early to dojo.connect since we no longer explicitly depend on it
53 nlp.connect = NodeList._adaptAsForEach(function(){
54 return dojo.connect.apply(this, arguments);
55 });
56 nlp.coords = NodeList._adaptAsMap(dojo.coords);
57
58 NodeList.events = [
59 // summary:
60 // list of all DOM events used in NodeList
61 "blur", "focus", "change", "click", "error", "keydown", "keypress",
62 "keyup", "load", "mousedown", "mouseenter", "mouseleave", "mousemove",
63 "mouseout", "mouseover", "mouseup", "submit"
64 ];
65
66 // FIXME: pseudo-doc the above automatically generated on-event functions
67
68 // syntactic sugar for DOM events
69 array.forEach(NodeList.events, function(evt){
70 var _oe = "on" + evt;
71 nlp[_oe] = function(a, b){
72 return this.connect(_oe, a, b);
73 };
74 // FIXME: should these events trigger publishes?
75 /*
76 return (a ? this.connect(_oe, a, b) :
77 this.forEach(function(n){
78 // FIXME:
79 // listeners get buried by
80 // addEventListener and can't be dug back
81 // out to be triggered externally.
82 // see:
83 // http://developer.mozilla.org/en/docs/DOM:element
84
85 console.log(n, evt, _oe);
86
87 // FIXME: need synthetic event support!
88 var _e = { target: n, faux: true, type: evt };
89 // dojo._event_listener._synthesizeEvent({}, { target: n, faux: true, type: evt });
90 try{ n[evt](_e); }catch(e){ console.log(e); }
91 try{ n[_oe](_e); }catch(e){ console.log(e); }
92 })
93 );
94 */
95 }
96 );
97
98 dojo.NodeList = NodeList;
99 return dojo.NodeList;
100});