]>
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 return declare("dijit._Contained", null, {
11 // Mixin for widgets that are children of a container widget
14 // | // make a basic custom widget that knows about it's parents
15 // | declare("my.customClass",[dijit._Widget,dijit._Contained],{});
17 _getSibling: function(/*String*/ which
){
19 // Returns next or previous sibling
21 // Either "next" or "previous"
24 var node
= this.domNode
;
26 node
= node
[which
+"Sibling"];
27 }while(node
&& node
.nodeType
!= 1);
28 return node
&& registry
.byNode(node
); // dijit/_WidgetBase
31 getPreviousSibling: function(){
33 // Returns null if this is the first child of the parent,
34 // otherwise returns the next element sibling to the "left".
36 return this._getSibling("previous"); // dijit/_WidgetBase
39 getNextSibling: function(){
41 // Returns null if this is the last child of the parent,
42 // otherwise returns the next element sibling to the "right".
44 return this._getSibling("next"); // dijit/_WidgetBase
47 getIndexInParent: function(){
49 // Returns the index of this widget within its container parent.
50 // It returns -1 if the parent does not exist, or if the parent
51 // is not a dijit._Container
53 var p
= this.getParent();
54 if(!p
|| !p
.getIndexOfChild
){
57 return p
.getIndexOfChild(this); // int