本文整理汇总了TypeScript中vs/base/browser/dom.hasClass函数的典型用法代码示例。如果您正苦于以下问题:TypeScript hasClass函数的具体用法?TypeScript hasClass怎么用?TypeScript hasClass使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hasClass函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: doSetWorked
private doSetWorked(value: number): ProgressBar {
assert.ok(!isNaN(this.totalWork), 'Total work not set');
this.workedVal = value;
this.workedVal = Math.min(this.totalWork, this.workedVal);
if (hasClass(this.element, css_infinite)) {
removeClass(this.element, css_infinite);
}
if (hasClass(this.element, css_done)) {
removeClass(this.element, css_done);
}
if (!hasClass(this.element, css_active)) {
addClass(this.element, css_active);
}
if (!hasClass(this.element, css_discrete)) {
addClass(this.element, css_discrete);
}
this.bit.style.width = 100 * (this.workedVal / this.totalWork) + '%';
return this;
}
示例2: doDone
private doDone(delayed: boolean): ProgressBar {
addClass(this.element, css_done);
// let it grow to 100% width and hide afterwards
if (!hasClass(this.element, css_infinite)) {
this.bit.style.width = 'inherit';
if (delayed) {
setTimeout(200, () => this.off());
} else {
this.off();
}
}
// let it fade out and hide afterwards
else {
this.bit.style.opacity = '0';
if (delayed) {
setTimeout(200, () => this.off());
} else {
this.off();
}
}
return this;
}
示例3: test
test('hasClass', () => {
var element = document.createElement('div');
element.className = 'foobar boo far';
assert(dom.hasClass(element, 'foobar'));
assert(dom.hasClass(element, 'boo'));
assert(dom.hasClass(element, 'far'));
assert(!dom.hasClass(element, 'bar'));
assert(!dom.hasClass(element, 'foo'));
assert(!dom.hasClass(element, ''));
});