]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/_Contained.js.uncompressed.js
1 define("dijit/_Contained", [
2 "dojo/_base/declare", // declare
3 "./registry" // registry.getEnclosingWidget(), registry.byNode()
4 ], function(declare
, registry
){
9 // Mixin for widgets that are children of a container widget
11 return declare("dijit._Contained", null, {
13 // Mixin for widgets that are children of a container widget
16 // | // make a basic custom widget that knows about it's parents
17 // | declare("my.customClass",[dijit._Widget,dijit._Contained],{});
19 _getSibling: function(/*String*/ which
){
21 // Returns next or previous sibling
23 // Either "next" or "previous"
26 var node
= this.domNode
;
28 node
= node
[which
+"Sibling"];
29 }while(node
&& node
.nodeType
!= 1);
30 return node
&& registry
.byNode(node
); // dijit._Widget
33 getPreviousSibling: function(){
35 // Returns null if this is the first child of the parent,
36 // otherwise returns the next element sibling to the "left".
38 return this._getSibling("previous"); // dijit._Widget
41 getNextSibling: function(){
43 // Returns null if this is the last child of the parent,
44 // otherwise returns the next element sibling to the "right".
46 return this._getSibling("next"); // dijit._Widget
49 getIndexInParent: function(){
51 // Returns the index of this widget within its container parent.
52 // It returns -1 if the parent does not exist, or if the parent
53 // is not a dijit._Container
55 var p
= this.getParent();
56 if(!p
|| !p
.getIndexOfChild
){
59 return p
.getIndexOfChild(this); // int