简体   繁体   English

someObject。$()含义

[英]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.

相关问题 array.push(SomeObject)不复制SomeObject中包含的数组 - array.push(SomeObject) does not copy an array contained in SomeObject if(){} 中 $(this) 的含义 - meaning of $(this) in an if(){} TypeError:someobject.somefunction(…)。则不是函数 - TypeError: someobject.somefunction(…).then is not a function 茉莉花测试匹配器抛出someObject - Jasmine testing matcher for throw someObject 为什么 someObject = Object.assign({}, someObject, window.getSelection()) 和 {...window.getSelection()} 确实返回空对象? - Why someObject = Object.assign({}, someObject, window.getSelection()) and {...window.getSelection()} does return empty object? Javascript:为什么是Object.keys(someobject),而不是someobject.keys? - Javascript: why Object.keys(someobject), rather than someobject.keys? 角度模板:是否有类似{{someObject.someList.where(somePredicate).length}}的东西? - Angular template: Is there something like {{someObject.someList.where(somePredicate).length}}? 有没有办法在外部 javascript 文件中使用“&lt;%= someObject.ClientID %&gt;”? - Is there a way to use “<%= someObject.ClientID %>” in an external javascript file? `throw new Error` 和 `throw someObject` 有什么区别? - What is the difference between `throw new Error` and `throw someObject`? 为什么 $.extend(window, window, someobject) 会触发页面刷新? - Why $.extend(window, window, someobject) triggers page refresh?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM