本文整理匯總了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, ''));
});