本文整理匯總了TypeScript中vs/base/browser/dom.removeClass函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript removeClass函數的具體用法?TypeScript removeClass怎麽用?TypeScript removeClass使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了removeClass函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: test
test('removeClass', () => {
var element = document.createElement('div');
element.className = 'foobar boo far';
dom.removeClass(element, 'boo');
assert(dom.hasClass(element, 'far'));
assert(!dom.hasClass(element, 'boo'));
assert(dom.hasClass(element, 'foobar'));
assert.equal(element.className, 'foobar far');
element = document.createElement('div');
element.className = 'foobar boo far';
dom.removeClass(element, 'far');
assert(!dom.hasClass(element, 'far'));
assert(dom.hasClass(element, 'boo'));
assert(dom.hasClass(element, 'foobar'));
assert.equal(element.className, 'foobar boo');
dom.removeClass(element, 'boo');
assert(!dom.hasClass(element, 'far'));
assert(!dom.hasClass(element, 'boo'));
assert(dom.hasClass(element, 'foobar'));
assert.equal(element.className, 'foobar');
dom.removeClass(element, 'foobar');
assert(!dom.hasClass(element, 'far'));
assert(!dom.hasClass(element, 'boo'));
assert(!dom.hasClass(element, 'foobar'));
assert.equal(element.className, '');
});
示例3: doRefresh
protected doRefresh(): void {
const group = this.context;
const editor = group && group.activeEditor;
if (!editor) {
this.editorLabel.clear();
this.clearEditorActionsToolbar();
return; // return early if we are being closed
}
const isPinned = group.isPinned(group.activeEditor);
const isActive = this.stacks.isActive(group);
// Activity state
if (isActive) {
DOM.addClass(this.titleContainer, 'active');
} else {
DOM.removeClass(this.titleContainer, 'active');
}
// Dirty state
if (editor.isDirty()) {
DOM.addClass(this.titleContainer, 'dirty');
} else {
DOM.removeClass(this.titleContainer, 'dirty');
}
// Editor Label
const resource = toResource(editor, { supportSideBySide: true });
const name = editor.getName() || '';
const labelFormat = this.editorGroupService.getTabOptions().labelFormat;
let description: string;
if (labelFormat === 'default' && !isActive) {
description = ''; // hide description when group is not active and style is 'default'
} else {
description = editor.getDescription(this.getVerbosity(labelFormat)) || '';
}
let title = editor.getTitle(Verbosity.LONG);
if (description === title) {
title = ''; // dont repeat what is already shown
}
this.editorLabel.setLabel({ name, description, resource }, { title, italic: !isPinned, extraClasses: ['title-label'] });
if (isActive) {
this.editorLabel.element.style.color = this.getColor(TAB_ACTIVE_FOREGROUND);
} else {
this.editorLabel.element.style.color = this.getColor(TAB_UNFOCUSED_ACTIVE_FOREGROUND);
}
// Update Editor Actions Toolbar
this.updateEditorActionsToolbar();
}
示例4: addClass
this.ifEditorIsActive(editor, () => {
if (editor.isDirty()) {
addClass(this.titleContainer, 'dirty');
} else {
removeClass(this.titleContainer, 'dirty');
}
});
示例5: release
/**
* Releases the row for eventual reuse. The row's domNode
* will eventually be removed from its parent, given that
* it is not the currently scrolling row (for OS X ballistic
* scrolling).
*/
release(row: IRow): void {
if (!row.domNode) {
return;
}
var lastScrollTime = getLastScrollTime(row.domNode);
if (!lastScrollTime) {
removeFromParent(row.domNode);
this.getTemplateCache(row.templateId).push(row);
return;
}
if (this.scrollingRow) {
var lastKnownScrollTime = getLastScrollTime(this.scrollingRow.domNode);
if (lastKnownScrollTime > lastScrollTime) {
removeFromParent(row.domNode);
this.getTemplateCache(row.templateId).push(row);
return;
}
if (this.scrollingRow.domNode.parentElement) {
removeFromParent(this.scrollingRow.domNode);
removeClass(this.scrollingRow.domNode, 'scrolling');
this.getTemplateCache(this.scrollingRow.templateId).push(this.scrollingRow);
}
}
this.scrollingRow = row;
addClass(this.scrollingRow.domNode, 'scrolling');
}
示例6: redraw
private redraw(): void {
const editor = this.group.activeEditor;
this.lastRenderedActiveEditor = editor;
const isEditorPinned = this.group.isPinned(this.group.activeEditor);
const isGroupActive = this.accessor.activeGroup === this.group;
// Update Breadcrumbs
if (this.breadcrumbsControl) {
if (isGroupActive) {
this.breadcrumbsControl.update();
toggleClass(this.breadcrumbsControl.domNode, 'preview', !isEditorPinned);
} else {
this.breadcrumbsControl.hide();
}
}
// Clear if there is no editor
if (!editor) {
removeClass(this.titleContainer, 'dirty');
this.editorLabel.clear();
this.clearEditorActionsToolbar();
}
// Otherwise render it
else {
// Dirty state
this.updateEditorDirty(editor);
// Editor Label
const resource = toResource(editor, { supportSideBySide: true });
const name = editor.getName() || '';
const { labelFormat } = this.accessor.partOptions;
let description: string;
if (this.breadcrumbsControl && !this.breadcrumbsControl.isHidden()) {
description = ''; // hide description when showing breadcrumbs
} else if (labelFormat === 'default' && !isGroupActive) {
description = ''; // hide description when group is not active and style is 'default'
} else {
description = editor.getDescription(this.getVerbosity(labelFormat)) || '';
}
let title = editor.getTitle(Verbosity.LONG);
if (description === title) {
title = ''; // dont repeat what is already shown
}
this.editorLabel.setLabel({ name, description, resource }, { title, italic: !isEditorPinned, extraClasses: ['no-tabs', 'title-label'] });
if (isGroupActive) {
this.editorLabel.element.style.color = this.getColor(TAB_ACTIVE_FOREGROUND);
} else {
this.editorLabel.element.style.color = this.getColor(TAB_UNFOCUSED_ACTIVE_FOREGROUND);
}
// Update Editor Actions Toolbar
this.updateEditorActionsToolbar();
}
}
示例7: releaseRow
private releaseRow(row: IRow): void {
const {domNode, templateId} = row;
removeClass(domNode, 'scrolling');
removeFromParent(domNode);
const cache = this.getTemplateCache(templateId);
cache.push(row);
}
示例8: onHide
private onHide(): void {
this.hide();
removeClass(this.element, 'active');
}