[英]someObject.$() Meaning
What does someObject.$()
mean? someObject.$()
是什么意思?
I am going through the tilecontainer-dbg files in sapui5 toolkit and found this : 我正在浏览sapui5工具箱中的tilecontainer-dbg文件,发现了这一点:
var oDomRef = this.$();
or someObject.$()
$
is just a legal symbol in javascript. $
只是javascript中的合法符号。 So, this.$()
or someObject.$()
is just a method call on that object. 因此, this.$()
或someObject.$()
只是对该对象的方法调用。 That object has a property named $
that is a function (eg a method). 该对象具有名为$
的属性,该属性是一个函数(例如方法)。
Here's an exmaple: 这是一个例子:
var obj = {
"data": 3,
"$": function() {
return this.data;
}
};
var val = obj.$(); // returns 3
in SAPUI5 both $ & jQuery are globals used for accessing jQuery functionality 在SAPUI5中,$和jQuery都是用于访问jQuery功能的全局变量
this.$() is similar to jQuery('#this.sId')
or
document.getElementById(this.sId)
Returns the best suitable DOM node that represents this Element wrapped as jQuery object. 返回最合适的DOM节点,该节点表示包装为jQuery对象的此Element。
below is the code definition 下面是代码定义
/**
* Returns the best suitable DOM node that represents this Element wrapped as jQuery object.
* I.e. the element returned by {@link sap.ui.core.Element#getDomRef} is wrapped and returned.
*
* If an ID suffix is given, the ID of this Element is concatenated with the suffix
* (separated by a single dash) and the DOM node with that compound ID will be wrapped by jQuery.
* This matches the UI5 naming convention for named inner DOM nodes of a control.
*
* @param {string} [sSuffix] ID suffix to get a jQuery object for
* @return {jQuery} The jQuery wrapped element's DOM reference
* @protected
*/
sap.ui.core.Element.prototype.$ = function(sSuffix) {
return jQuery(this.getDomRef(sSuffix));
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.