首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网络技术 > 网络基础 >

dijit.Contained源码

2012-11-22 
dijit._Contained源码define(dijit/_Contained, [dojo, dijit], function(dojo, dijit) {dojo.decla

dijit._Contained源码

define("dijit/_Contained", ["dojo", "dijit"], function(dojo, dijit) {dojo.declare("dijit._Contained",null,{// summary://Mixin for widgets that are children of a container widget//// example:// | // make a basic custom widget that knows about it's parents// |dojo.declare("my.customClass",[dijit._Widget,dijit._Contained],{});getParent: function(){// summary://Returns the parent widget of this widget, assuming the parent//specifies isContainervar parent = dijit.getEnclosingWidget(this.domNode.parentNode);return parent && parent.isContainer ? parent : null;},_getSibling: function(/*String*/ which){// summary://      Returns next or previous sibling// which://      Either "next" or "previous"// tags://      privatevar node = this.domNode;do{node = node[which+"Sibling"];}while(node && node.nodeType != 1);return node && dijit.byNode(node);// dijit._Widget},getPreviousSibling: function(){// summary://Returns null if this is the first child of the parent,//otherwise returns the next element sibling to the "left".return this._getSibling("previous"); // dijit._Widget},getNextSibling: function(){// summary://Returns null if this is the last child of the parent,//otherwise returns the next element sibling to the "right".return this._getSibling("next"); // dijit._Widget},getIndexInParent: function(){// summary://Returns the index of this widget within its container parent.//It returns -1 if the parent does not exist, or if the parent//is not a dijit._Containervar p = this.getParent();if(!p || !p.getIndexOfChild){return -1; // int}return p.getIndexOfChild(this); // int}});return dijit._Contained;});
?

热点排行