Dojo   发布时间:2022-04-21  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Selector in the Dojo大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

1. dom SELEctor

In dojo/dom.js,dojo offers dojo.byId() to get the dom element node.

dom.byId = function(id,doC){
			// inline'd type check.
			// be sure to return null per documentation,to match IE branch.
			return ((typeof id == "String") ? (doc || win.doC).getElementById(id) : id) || null; // DOMNode
		};

2. query API

dojo/query.js provides the query API to get the NodeList.

var query = queryForENGIne(defaultENGIne,NodeList);
function queryForENGIne(ENGIne,NodeList){
		var query = function(/*String*/ query,/*String|DOMNode?*/ root){
			// sumMary:
			//		Returns nodes which match the given CSS SELEctor,searching the
			//		entire document by default but optionally taking a node to scope
			//		the search by. Returns an instance of NodeList.
			if(typeof root == "String"){
				root = dom.byId(root);
				if(!root){
					return new NodeList([]);
				}
			}
			var results = typeof query == "String" ? ENGIne(query,root) : query ? query.orphan ? query : [query] : [];
			if(results.orphan){
				// already wrapped
				return results;
			}
			return new NodeList(results);
		};
		query.matches = ENGIne.match || function(node,SELEctor,root){
			// sumMary:
			//		Test to see if a node matches a SELEctor
			return query.filter([node],root).length > 0;
		};
		// the ENGIne provides a filtering function,use it to for matching
		query.filter = ENGIne.filter || function(nodes,root){
			// sumMary:
			//		Filters an array of nodes. Note that this does not guarantee to return a NodeList,just an array.
			return query(SELEctor,root).filter(function(nodE){
				return array.indexOf(nodes,nodE) > -1;
			});
		};
		if(typeof ENGIne != "function"){
			var search = ENGIne.search;
			ENGIne = function(SELEctor,root){
				// Slick does it BACkWARDs (or everyone else does it BACkWARDs,probably the latter)
				return search(root || document,SELEctor);
			};
		}
		return query;
	}
3. widget SELEctor

We can find thebyId() method in the dijit/registry.js

byId: function(/*String|Widget*/ id){
			// sumMary:
			//		Find a widget by it's id.
			//		If passed a widget then just returns the widget.
			return typeof id == "String" ? hash[id] : id;	// dijit/_WidgetBase
		},

大佬总结

以上是大佬教程为你收集整理的Selector in the Dojo全部内容,希望文章能够帮你解决Selector in the Dojo所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:dojoselector