本文整理汇总了TypeScript中dojo/query.query函数的典型用法代码示例。如果您正苦于以下问题:TypeScript query函数的具体用法?TypeScript query怎么用?TypeScript query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了query函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: override
clearSelection: override(function (inherited) {
inherited(arguments);
query("input[type=checkbox]", this.domNode).forEach(function (node) {
node.checked = false;
node.indeterminate = false;
});
}),
开发者ID:Michael-Gardner,项目名称:HPCC-Platform,代码行数:7,代码来源:ESPUtil.ts
示例2: query
def.callback(function (xmlDoc) {
var results = query('bar', xmlDoc);
assert.strictEqual(results.length, 2);
}),
开发者ID:dasa,项目名称:typings,代码行数:5,代码来源:xhr.ts
示例3: query
import * as query from 'dojo/query';
/* An example of working with query and NodeLists */
/* Querying all the nodes of the current document. The will default to the node
list being an array of Nodes */
const results = query('*');
/* Now we are going to assert that we will be only returning HTML elements,
this now means resulting functions will be typed appropriately */
results
.filter<HTMLElement>((node) => node.parentElement === document.body)
.forEach((item) => {
/* item is typed as HTMLElement */
console.log(item.tagName);
});
/* If we want to assert what types of nodes our query will return, we can do that
upfront */
const myDiv = document.createElement('div');
const myP = document.createElement('p');
query<HTMLDivElement>('div')
.concat(myDiv)
.forEach((div) => {
console.log(div.noWrap);
});
/* it will also type guard us, for example, if you uncomment the below, you will
throw a type error */
开发者ID:ca0v,项目名称:typings,代码行数:31,代码来源:main.ts
注:本文中的dojo/query.query函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论