root / branches / api-spec / alex / NodeList.txt

Revision 7539, 2.4 kB (checked in by alex, 2 years ago)

more work on API consensus with Owen

Line 
1API outline for a dojo.Elem class:
2
3        dojo.NodeList = function(){
4        }
5
6        dojo.NodeList.prototype = new Array;
7
8        dojo.lang.extend(
9                dojo.NodeList.prototype,
10                {
11                        // http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array#Methods
12                        // must implement the following JS 1.6 methods:
13                        //              forEach()
14                        //              every()
15                        //              some()
16                        //              map()
17                        //              filter()
18                        //              indexOf()
19                        //              lastIndexOf()
20
21                        coords: function(){
22                                // returns the box objects all elements in a node list as an
23                                // Array
24                        },
25
26                        style: function(prop){
27                        },
28                        style: function(key, value){
29                        }
30
31                        // style: function(props /*...*/){
32                        // },
33
34                        styles: function(prop){
35                        },
36                        styles: function(key, value){
37                        },
38
39                        // styles: function(props /*...*/){
40                        // },
41
42                        place: function(queryOrNode, position){
43                                // placement always relative to the first element matched by
44                                // queryOrNode
45
46                                // position can be one of:
47                                //              "last"||"end" (default)
48                                //              "first||"start"
49                                //              "before"
50                                //              "after"
51                                // or an offset in the childNodes property
52                        },
53
54                        orphan: function(filter){
55                                // removes elements in this list that match filter from their
56                                // parents and returns them as a new NodeList.
57                        },
58
59                        adopt: function(queryOrListOrNode, position){
60                                // places any/all elements in queryOrListOrNode at a position
61                                // relative to the first element in this list.
62
63                                // position can be one of:
64                                //              "last"||"end" (default)
65                                //              "first||"start"
66                                //              "before"
67                                //              "after"
68                                // or an offset in the childNodes property
69                        },
70
71                        // may have name changed to "get" if dojo.query becomes dojo.get
72                        // FIXME: do we need this?
73                        query: function(queryStr){
74                                // returns a new NodeList. Elements of the new NodeList satisfy
75                                // the passed query but use elements of the current NodeList as
76                                // query roots.
77                        },
78
79                        filter: function(simpleQuery){
80                                // "masks" the built-in javascript filter() method to support
81                                // passing a simple string filter in addition to supporting
82                                // filtering function objects.
83
84                                // simpleQuery may be a CSS class, ID, attribute, or pseudo
85                                // selector that further filters the contents of this NodeList.
86                                // A new NodeList with the resulting elements is returned.
87                        },
88
89                        addContent: function(content, position){
90                                // position can be one of:
91                                //              "last"||"end" (default)
92                                //              "first||"start"
93                                //              "before"
94                                //              "after"
95                                // or an offset in the childNodes property
96                        }
97                }
98        );
99
100vim:et:ts=4
Note: See TracBrowser for help on using the browser.