diff --git a/packages/happy-dom/src/nodes/html-element/HTMLElement.ts b/packages/happy-dom/src/nodes/html-element/HTMLElement.ts
index 0ef464a72..b553de173 100644
--- a/packages/happy-dom/src/nodes/html-element/HTMLElement.ts
+++ b/packages/happy-dom/src/nodes/html-element/HTMLElement.ts
@@ -398,6 +398,28 @@ export default class HTMLElement extends Element {
}
}
+ /**
+ * Returns inert.
+ *
+ * @returns Inert.
+ */
+ public get inert(): boolean {
+ return this.getAttribute('inert') !== null;
+ }
+
+ /**
+ * Returns inert.
+ *
+ * @param inert Inert.
+ */
+ public set inert(inert: boolean) {
+ if (!inert) {
+ this.removeAttribute('inert');
+ } else {
+ this.setAttribute('inert', '');
+ }
+ }
+
/**
* Returns language.
*
diff --git a/packages/happy-dom/test/nodes/html-element/HTMLElement.test.ts b/packages/happy-dom/test/nodes/html-element/HTMLElement.test.ts
index 6e59ccb60..7c2324583 100644
--- a/packages/happy-dom/test/nodes/html-element/HTMLElement.test.ts
+++ b/packages/happy-dom/test/nodes/html-element/HTMLElement.test.ts
@@ -361,6 +361,24 @@ describe('HTMLElement', () => {
});
});
+ describe('get inert()', () => {
+ it('Returns the attribute "inert".', () => {
+ const div = document.createElement('div');
+ div.setAttribute('inert', '');
+ expect(div.inert).toBe(true);
+ });
+ });
+
+ describe('set inert()', () => {
+ it('Sets the attribute "inert".', () => {
+ const div = document.createElement('div');
+ div.inert = true;
+ expect(div.getAttribute('inert')).toBe('');
+ div.inert = false;
+ expect(div.getAttribute('inert')).toBe(null);
+ });
+ });
+
for (const property of ['lang', 'title']) {
describe(`get ${property}`, () => {
it(`Returns the attribute "${property}".`, () => {