removeClass

说明

移除指定DOM的单个类名

源码

用法

removeClass.test.ts
1
import { removeClass } from "../../utility/dom/removeClass";
2
3
describe('removeClass', () => {
4
test('removeClass should remove the class from a DOM object', () => {
5
document.body.innerHTML = `
6
<div id="app" class="c1 c2"></div>
7
`;
8
9
removeClass(
10
(document.getElementById('app') as HTMLElement),
11
'c2',
12
);
13
14
expect(
15
(document.getElementById('app') as HTMLElement).classList.contains('c2')
16
).toBeFalsy();
17
});
18
});
Copied!
最近更新 1yr ago
复制链接