Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: capricorn86/happy-dom
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v9.20.3
Choose a base ref
...
head repository: capricorn86/happy-dom
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v10.0.0
Choose a head ref
  • 11 commits
  • 384 files changed
  • 1 contributor

Commits on May 24, 2023

  1. #873@major: Adds support for ESM. Happy DOM will still have support f…

    …or CommonJS, but as there might be build environments that doesn't support this configuration, it is released as a potentially breaking change.
    capricorn86 committed May 24, 2023
    Copy the full SHA
    e205a9f View commit details
  2. Copy the full SHA
    f8c2d82 View commit details
  3. Copy the full SHA
    ed63415 View commit details

Commits on May 25, 2023

  1. Copy the full SHA
    b656257 View commit details
  2. Copy the full SHA
    5d28f9e View commit details

Commits on Jul 4, 2023

  1. Copy the full SHA
    bd2ac68 View commit details

Commits on Jul 5, 2023

  1. Copy the full SHA
    2d1d820 View commit details
  2. Copy the full SHA
    e2b294b View commit details
  3. Copy the full SHA
    29a1f43 View commit details
  4. Copy the full SHA
    0d06916 View commit details
  5. Merge pull request #936 from capricorn86/task/873-add-support-for-esm

    #873@major: Adds support for ESM. Happy DOM will still have support f…
    capricorn86 authored Jul 5, 2023
    Copy the full SHA
    002a2ba View commit details
Showing 384 changed files with 7,748 additions and 5,443 deletions.
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -38,6 +38,10 @@ And much more..

- [Vue](https://vuejs.org/)

### Module Systems

[Happy DOM](https://github.com/capricorn86/happy-dom) has support for both [ESM](https://nodejs.org/api/esm.html#introduction) and [CommonJS](https://nodejs.org/api/modules.html#modules-commonjs-modules).

# Packages

This repository is a _Monorepo_. Each package lives under `packages/<package>`.
@@ -58,14 +62,6 @@ This package makes it possible to use Happy DOM with [Jest](https://jestjs.io/).

A utility that registers Happy DOM globally, which makes it possible to use Happy DOM for testing in a Node environment.

---

### [![Published on npm](https://img.shields.io/npm/v/@happy-dom/server-rendering.svg)](https://www.npmjs.com/package/@happy-dom/server-rendering) [server-rendering](https://github.com/capricorn86/happy-dom/tree/master/packages/server-rendering)

This package has been deprecated.

Happy DOM now supports [Declarative Shadow DOM](https://github.com/capricorn86/happy-dom/tree/master/packages/happy-dom#server-side-rendering-of-web-components) which can be used for server-side rendering of web components.

# Performance

| Operation | JSDOM | Happy DOM |
Binary file modified docs/happy-dom-logo.jpg

Unable to render rich display

Invalid image source.

Binary file added docs/happy-dom-logo.jpg~
Binary file not shown.
2,409 changes: 2,107 additions & 302 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -14,26 +14,23 @@
},
"devDependencies": {
"@types/he": "^1.1.2",
"@types/jest": "^29.4.0",
"@types/node": "^15.6.0",
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"chalk": "^4.1.0",
"eslint": "^8.11.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest": "^26.1.2",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsdoc": "^38.0.6",
"eslint-plugin-json": "^3.1.0",
"eslint-plugin-prettier": "^4.0.0",
"husky": "2.3.0",
"jest": "^29.4.0",
"vitest": "^0.32.4",
"prettier": "^2.6.0",
"semver": "^7.3.5",
"ts-jest": "^29.0.5",
"turbo": "^1.7.3",
"typescript": "^4.6.2"
"typescript": "^5.0.4"
},
"engines": {
"node": ">=12.13"
1 change: 1 addition & 0 deletions packages/global-registrator/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('happy-dom/.eslintrc.cjs');
1 change: 0 additions & 1 deletion packages/global-registrator/.eslintrc.js

This file was deleted.

3 changes: 2 additions & 1 deletion packages/global-registrator/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
tmp
lib
lib
cjs
2 changes: 2 additions & 0 deletions packages/global-registrator/.npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
tmp
test
.turbo
npm-shrinkwrap.json
1 change: 1 addition & 0 deletions packages/global-registrator/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../happy-dom/.prettierrc.cjs');
1 change: 0 additions & 1 deletion packages/global-registrator/.prettierrc.js

This file was deleted.

8 changes: 8 additions & 0 deletions packages/global-registrator/README.md
Original file line number Diff line number Diff line change
@@ -38,6 +38,10 @@ And much more..

- [Vue](https://vuejs.org/)

### Module Systems

[Happy DOM](https://github.com/capricorn86/happy-dom) has support for both [ESM](https://nodejs.org/api/esm.html#introduction) and [CommonJS](https://nodejs.org/api/modules.html#modules-commonjs-modules).

# Installation

```bash
@@ -74,6 +78,10 @@ GlobalRegistrator.unregister();
console.log(global.document);
```

# Documentation

Read more about how Happy DOM works in our [documentation](https://github.com/capricorn86/happy-dom/wiki).

# Performance

| Operation | JSDOM | Happy DOM |
51 changes: 46 additions & 5 deletions packages/global-registrator/package.json
Original file line number Diff line number Diff line change
@@ -7,6 +7,47 @@
"author": "David Ortner",
"description": "Use Happy DOM globally in a Node.js environment for testing.",
"main": "lib/index.js",
"type": "module",
"exports": {
".": {
"import": "./lib/index.js",
"require": "./cjs/index.cjs",
"default": "./lib/index.js"
},
"./lib/*.js": {
"import": "./lib/*.js",
"require": "./cjs/*.cjs",
"default": "./lib/*.js"
},
"./lib/*.ts": {
"import": "./lib/*.ts",
"require": "./cjs/*.ts",
"default": "./lib/*.ts"
},
"./lib/*.map": {
"import": "./lib/*.map",
"require": "./cjs/*.map",
"default": "./lib/*.map"
},
"./cjs/*.js": {
"import": "./cjs/*.cjs",
"require": "./cjs/*.cjs",
"default": "./cjs/*.cjs"
},
"./cjs/*.ts": {
"import": "./cjs/*.ts",
"require": "./cjs/*.ts",
"default": "./cjs/*.ts"
},
"./cjs/*.map": {
"import": "./cjs/*.map",
"require": "./cjs/*.map",
"default": "./cjs/*.map"
},
"./src/*.ts": "./src/*.ts",
"./package.json": "./package.json",
"./.eslintrc": "./.eslintrc.js"
},
"keywords": [
"jsdom",
"happy",
@@ -24,11 +65,12 @@
"access": "public"
},
"scripts": {
"compile": "tsc",
"compile": "tsc && tsc --module CommonJS --outDir cjs && npm run change-cjs-file-extension",
"change-cjs-file-extension": "node ../happy-dom/bin/change-file-extension.cjs --dir=./cjs --fromExt=.js --toExt=.cjs",
"watch": "npm run compile && tsc -w --preserveWatchOutput",
"lint": "eslint --ignore-path .gitignore --max-warnings 0 .",
"lint:fix": "eslint --ignore-path .gitignore --max-warnings 0 --fix .",
"test": "tsc --project ./test && node ./tmp/react/React.test.js",
"test": "tsc --project ./test && node ../happy-dom/bin/change-file-extension.cjs --dir=./tmp --fromExt=.js --toExt=.cjs && node ./tmp/react/React.test.cjs",
"test:debug": "tsc --project ./test && node --inspect-brk ./tmp/react/React.test.js"
},
"dependencies": {
@@ -42,13 +84,12 @@
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest": "^26.1.2",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsdoc": "^38.0.6",
"eslint-plugin-json": "^3.1.0",
"eslint-plugin-turbo": "^0.0.7",
"prettier": "^2.6.0",
"typescript": "^4.6.2",
"typescript": "^5.0.4",
"react": "^17.0.2",
"react-dom": "^17.0.2"
}
2 changes: 1 addition & 1 deletion packages/global-registrator/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import GlobalRegistrator from './GlobalRegistrator';
import GlobalRegistrator from './GlobalRegistrator.js';

export { GlobalRegistrator };
4 changes: 2 additions & 2 deletions packages/global-registrator/test/react/React.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import GlobalRegistrator from '../../lib/GlobalRegistrator';
import GlobalRegistrator from '../../cjs/GlobalRegistrator.cjs';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactComponent from './ReactComponent';
import ReactComponent from './ReactComponent.js';

GlobalRegistrator.register();

1 change: 1 addition & 0 deletions packages/global-registrator/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
"rootDir": "../test",
"tsBuildInfoFile": "../tmp/.tsbuildinfo-test",
"jsx": "react",
"module": "CommonJS",
"lib": [
"es2015",
"es2016",
7 changes: 2 additions & 5 deletions packages/global-registrator/tsconfig.json
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@
"target": "es2020",
"declaration": true,
"declarationMap": true,
"module": "CommonJS",
"moduleResolution": "node",
"module": "es2020",
"moduleResolution": "node16",
"esModuleInterop": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
@@ -22,9 +22,6 @@
"composite": true,
"incremental": true,
"jsx": "react",
"typeRoots": [
"node_modules/@types"
],
"types": [
"node"
],
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ const ERROR = 'error';
const OFF = 'off';

const COMMON_CONFIG = {
plugins: ['turbo', 'jsdoc', 'filenames', 'jest', 'import', 'prettier'],
plugins: ['turbo', 'jsdoc', 'filenames', 'import', 'prettier'],
extends: ['plugin:@typescript-eslint/recommended', 'prettier', 'plugin:prettier/recommended'],
rules: {
'prettier/prettier': WARN,
@@ -48,18 +48,6 @@ const COMMON_CONFIG = {
'jsdoc/require-returns-description': WARN,
'jsdoc/valid-types': WARN,
'filenames/match-exported': WARN,
'jest/consistent-test-it': [WARN, { fn: 'it', withinDescribe: 'it' }],
'jest/valid-title': [
WARN,
{
mustMatch: {
// Describe: '^[A-Z][a-zA-Z0-9]+$|^[a-z][a-zA-Z0-9]+\\(\\)$',
it: '^[A-Z](.+).$'
}
}
],
'jest/prefer-hooks-on-top': WARN,
'jest/no-duplicate-hooks': WARN,
'no-useless-constructor': WARN,
'jsdoc/require-jsdoc': [
WARN,
@@ -92,8 +80,7 @@ module.exports = {
env: {
es6: true,
browser: true,
node: true,
jest: true
node: true
},
overrides: [
{
@@ -115,7 +102,7 @@ module.exports = {
{
files: ['*.json'],
plugins: ['json'],
extends: ['eslint:recommended', 'plugin:json/recommended', 'plugin:jest/recommended']
extends: ['eslint:recommended', 'plugin:json/recommended']
},
{
files: ['*.ts', '*.tsx'],
@@ -153,6 +140,7 @@ module.exports = {
'import/named': WARN,
'import/no-named-as-default': WARN,
'import/no-extraneous-dependencies': WARN,
'import/no-absolute-path': WARN,
'@typescript-eslint/naming-convention': [
WARN,
{
1 change: 1 addition & 0 deletions packages/happy-dom/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
tmp
lib
cjs
.DS_Store
1 change: 1 addition & 0 deletions packages/happy-dom/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
tmp
test
.turbo
npm-shrinkwrap.json
File renamed without changes.
265 changes: 14 additions & 251 deletions packages/happy-dom/README.md
Original file line number Diff line number Diff line change
@@ -36,6 +36,10 @@ And much more..

- [Vue](https://vuejs.org/)

### Module Systems

[Happy DOM](https://github.com/capricorn86/happy-dom) has support for both [ESM](https://nodejs.org/api/esm.html#introduction) and [CommonJS](https://nodejs.org/api/modules.html#modules-commonjs-modules).

# Installation

```bash
@@ -44,14 +48,16 @@ npm install happy-dom

# Usage

## Basic Usage

A simple example of how you can use Happy DOM.

```javascript
import { Window } from 'happy-dom';

const window = new Window();
const window = new Window({
url: 'https://localhost:8080',
width: 1024,
height: 768
});
const document = window.document;

document.body.innerHTML = '<div class="container"></div>';
@@ -65,254 +71,7 @@ container.appendChild(button);
console.log(document.body.innerHTML);
```

## VM Context

The default Window class is a [VM context](https://nodejs.org/api/vm.html#vm_vm_createcontext_sandbox_options). A [VM context](https://nodejs.org/api/vm.html#vm_vm_createcontext_sandbox_options) will execute JavaScript code scoped within the context where the Window instance will be the global object.

```javascript
import { Window } from 'happy-dom';

const window = new Window({
innerWidth: 1024,
innerHeight: 768,
url: 'http://localhost:8080'
});
const document = window.document;

document.write(`
<html>
<head>
<title>Test page</title>
</head>
<body>
<div class="container">
<!–– Content will be added here -->
</div>
<script>
const element = document.createElement('div');
const container = document.querySelector('.container');
element.innerHTML = 'Test';
container.appendChild(element);
</script>
</body>
</html>
`);

// Will output "Test"
console.log(document.querySelector('.container div').innerHTML);
```

## Global Context

Happy DOM exports a class called GlobalWindow, which can be used to run Happy DOM in the global context instead of the default behaviour of running in a [VM context](https://nodejs.org/api/vm.html#vm_vm_createcontext_sandbox_options).

```javascript
import { Window, GlobalWindow } from 'happy-dom';

const vmWindow = new Window();
const globalWindow = new GlobalWindow();

// Will output "false"
console.log(vmWindow.Array === global.Array);

// Will output "true"
console.log(globalWindow.Array === global.Array);

globalWindow.eval('global.test = 1');

// Will output "1"
console.log(global.test);
```

## Server-Side Rendering of Web Components

The example below will show you how to server-side render a page with custom elements (web components) in Happy DOM. In the example we will use a new web feature called [Declarative Shadow DOM](https://chromestatus.com/feature/5191745052606464) to include the shadow roots in the HTML output.

[Declarative Shadow DOM](https://chromestatus.com/feature/5191745052606464) is only supported by Chromium based browsers. Unsupported browsers will safely fallback to being rendered using Javascript.

```javascript
import { Window } from 'happy-dom';

const window = new Window({
innerWidth: 1024,
innerHeight: 768,
url: 'http://localhost:8080'
});
const document = window.document;

document.write(`
<html>
<head>
<title>Test page</title>
</head>
<body>
<div>
<my-custom-element>
<span>Slotted content</span>
</my-custom-element>
</div>
<script>
class MyCustomElement extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
connectedCallback() {
this.shadowRoot.innerHTML = \`
<style>
:host {
display: inline-block;
background: red;
}
</style>
<div><slot></slot></div>
\`;
}
}
customElements.define('my-custom-element', MyCustomElement);
</script>
</body>
</html>
`);

/*
Will output:
<my-custom-element>
<span>Slotted content</span>
<template shadowroot="open">
<style>
:host {
display: inline-block;
background: red;
}
</style>
<div><slot></slot></div>
</template>
</my-custom-element>
*/
console.log(document.body.querySelector('div').getInnerHTML({ includeShadowRoots: true }));
```

## Additional Features

**whenAsyncComplete()**

Returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that is resolved when all async tasks has been completed.

```javascript
window.happyDOM.whenAsyncComplete().then(() => {
// Do something when all async tasks are completed.
});
```

**cancelAsync()**

This method will cancel all running async tasks.

```javascript
window.setTimeout(() => {
// This timeout will be canceled
});
window.happyDOM.cancelAsync();
```

**setInnerWidth()**

Sets the property `window.innerWidth` and dispatches a "resize" event.

```javascript
window.happyDOM.setInnerWidth(1920);
```

**setInnerHeight()**

Sets the property `window.innerHeight` and dispatches a "resize" event.

```javascript
window.happyDOM.setInnerHeight(1080);
```

**setURL()**

Sets the property `window.location.href`.

```javascript
window.happyDOM.setURL('https://localhost:3000');
```

## Settings

Settings can be sent to the constructor or by setting them on the "window.happyDOM.settings" property.

Set by constructor:

```javascript
const window = new Window({
innerWidth: 1920,
innerHeight: 1080,
url: 'https://localhost:8080',
settings: {
disableJavaScriptFileLoading: true,
disableJavaScriptEvaluation: true,
disableCSSFileLoading: true,
disableIframePageLoading: true,
disableComputedStyleRendering: true,
enableFileSystemHttpRequests: true,
device: {
mediaType: 'print',
prefersColorScheme = 'dark
}
}
});
```
Set by property:
```javascript
const window = new Window();
window.happyDOM.settings.disableJavaScriptFileLoading = true;
window.happyDOM.settings.disableJavaScriptEvaluation = true;
window.happyDOM.settings.disableCSSFileLoading = true;
window.happyDOM.settings.disableIframePageLoading = true;
window.happyDOM.settings.disableComputedStyleRendering = true;
window.happyDOM.settings.enableFileSystemHttpRequests = true;
window.happyDOM.settings.device.mediaType = 'print';
window.happyDOM.settings.device.prefersColorScheme = 'dark';
```
**disableJavaScriptFileLoading**
Set it to "true" to disable JavaScript file loading. Defaults to "false".
**disableJavaScriptEvaluation**
Set it to "true" to completely disable JavaScript evaluation. Defaults to "false".
**disableCSSFileLoading**
Set it to "true" to disable CSS file loading in HTMLLinkElement. Defaults to "false".
**disableIframePageLoading**
Set it to "true" to disable page loading in HTMLIFrameElement. Defaults to "false".
**disableComputedStyleRendering**
Set it to "true" to disable the simulation of rendering when calculating computed style. The rendering process will convert values such as "rem", "em", "cm" etc. to pixels. However, it is currently very limited and will therefore not give the same result as the browser. Defaults to "false".
**enableFileSystemHttpRequests**
Set it to "true" to enable file system HTTP requests using XMLHttpRequest. Defaults to "false".
**device.mediaType**
Used by media queries. Acceptable values are "screen" or "print". Defaults to "screen".
**device.prefersColorScheme**
Used by media queries. Acceptable values are "light" or "dark". Defaults to "dark".
[Read more in our documentation](https://github.com/capricorn86/happy-dom/wiki)

# Performance

@@ -334,6 +93,10 @@ Used by media queries. Acceptable values are "light" or "dark". Defaults to "dar

Happy DOM provide with a package called [@happy-dom/jest-environment](https://github.com/capricorn86/happy-dom/tree/master/packages/jest-environment) that makes it possible to use Happy DOM with [Jest](https://jestjs.io/).

# Vitest

[Vitest](https://github.com/vitest-dev/vitest) supports Happy DOM out of the box.

# Global Registration

Happy DOM provide with a package called [@happy-dom/global-registrator](https://github.com/capricorn86/happy-dom/tree/master/packages/global-registrator) that can register Happy DOM globally. It makes it possible to use Happy DOM for testing in a Node environment.
101 changes: 101 additions & 0 deletions packages/happy-dom/bin/change-file-extension.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/* eslint-disable no-console*/
/* eslint-disable @typescript-eslint/no-var-requires*/

const Path = require('path');
const FS = require('fs');

process.on('unhandledRejection', (reason) => {
console.error(reason);
process.exit(1);
});

main();

function getArguments() {
const args = {
dir: null,
fromExt: null,
toExt: null
};

for (const arg of process.argv) {
if (arg.startsWith('--dir=')) {
args.dir = arg.split('=')[1];
} else if (arg.startsWith('--fromExt=')) {
args.fromExt = arg.split('=')[1];
} else if (arg.startsWith('--toExt=')) {
args.toExt = arg.split('=')[1];
}
}

return args;
}

async function readDirectory(directory) {
const resolvedDirectory = Path.resolve(directory);
const files = await FS.promises.readdir(resolvedDirectory);
const statsPromises = [];
let allFiles = [];

for (const file of files) {
const filePath = Path.join(resolvedDirectory, file);
statsPromises.push(
FS.promises.stat(filePath).then((stats) => {
if (stats.isDirectory()) {
return readDirectory(filePath).then((files) => (allFiles = allFiles.concat(files)));
}
allFiles.push(filePath);
})
);
}

await Promise.all(statsPromises);

return allFiles;
}

async function renameFiles(files, args) {
const newFiles = files.map((file) => ({
oldPath: file,
newPath: file.replace(args.fromExt, args.toExt)
}));
const writePromises = [];

for (const file of newFiles) {
writePromises.push(
FS.promises.readFile(file.oldPath).then((content) => {
debugger;
return FS.promises
.writeFile(
file.newPath,
content
.toString()
.replace(
new RegExp(`${args.fromExt.replace('.', '\\.')}\\.map`, 'g'),
`${args.toExt}.map`
)
.replace(
new RegExp(`${args.fromExt.replace('.', '\\.')}(["'])`, 'g'),
`${args.toExt}$1`
)
)
.then(() => {
if (file.oldPath !== file.newPath) {
return FS.promises.unlink(file.oldPath);
}
});
})
);
}

await Promise.all(writePromises);
}

async function main() {
const args = getArguments();
if (!args.dir || !args.fromExt || !args.toExt) {
throw new Error('Invalid arguments');
}
const files = await readDirectory(args.dir);
await renameFiles(files, args);
}
75 changes: 50 additions & 25 deletions packages/happy-dom/package.json
Original file line number Diff line number Diff line change
@@ -7,6 +7,48 @@
"author": "David Ortner",
"description": "Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. It includes many web standards from WHATWG DOM and HTML.",
"main": "lib/index.js",
"type": "module",
"exports": {
".": {
"import": "./lib/index.js",
"require": "./cjs/index.cjs",
"default": "./lib/index.js"
},
"./lib/*.js": {
"import": "./lib/*.js",
"require": "./cjs/*.cjs",
"default": "./lib/*.js"
},
"./lib/*.ts": {
"import": "./lib/*.ts",
"require": "./cjs/*.ts",
"default": "./lib/*.ts"
},
"./lib/*.map": {
"import": "./lib/*.map",
"require": "./cjs/*.map",
"default": "./lib/*.map"
},
"./cjs/*.js": {
"import": "./cjs/*.cjs",
"require": "./cjs/*.cjs",
"default": "./cjs/*.cjs"
},
"./cjs/*.ts": {
"import": "./cjs/*.ts",
"require": "./cjs/*.ts",
"default": "./cjs/*.ts"
},
"./cjs/*.map": {
"import": "./cjs/*.map",
"require": "./cjs/*.map",
"default": "./cjs/*.map"
},
"./src/*.ts": "./src/*.ts",
"./package.json": "./package.json",
"./.eslintrc.cjs": "./.eslintrc.cjs",
"./.prettierrc.cjs": "./.prettierrc.cjs"
},
"keywords": [
"jsdom",
"dom",
@@ -23,28 +65,14 @@
"access": "public"
},
"scripts": {
"compile": "tsc",
"compile": "tsc && tsc --module CommonJS --outDir cjs && npm run change-cjs-file-extension",
"change-cjs-file-extension": "node ./bin/change-file-extension.cjs --dir=./cjs --fromExt=.js --toExt=.cjs",
"watch": "tsc -w --preserveWatchOutput",
"lint": "eslint --ignore-path .gitignore --max-warnings 0 .",
"lint:fix": "eslint --ignore-path .gitignore --max-warnings 0 --fix .",
"test": "jest --setupFilesAfterEnv ./test/setup.js",
"test:coverage": "jest --setupFilesAfterEnv ./test/setup.js --collectCoverage",
"test:watch": "jest --setupFilesAfterEnv ./test/setup.js --watch",
"test:debug": "node --inspect-brk ../../node_modules/.bin/jest --setupFilesAfterEnv ./test/setup.js --runInBand"
},
"jest": {
"transform": {
"^.+\\.ts?$": [
"ts-jest",
{
"tsconfig": "./test/tsconfig.json"
}
]
},
"testMatch": [
"**/test/**/*.test.ts"
],
"testEnvironment": "node"
"test": "vitest run",
"test:watch": "vitest",
"test:debug": "vitest --inspect-brk --threads false"
},
"dependencies": {
"css.escape": "^1.5.1",
@@ -55,23 +83,20 @@
"iconv-lite": "^0.6.3"
},
"devDependencies": {
"@types/jest": "^29.4.0",
"@types/node": "^15.6.0",
"@types/node-fetch": "^2.6.1",
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"eslint": "^8.11.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest": "^26.1.2",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsdoc": "^38.0.6",
"eslint-plugin-json": "^3.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-turbo": "^0.0.7",
"jest": "^29.4.0",
"vitest": "^0.32.4",
"prettier": "^2.6.0",
"ts-jest": "^29.0.5",
"typescript": "^4.6.2"
"typescript": "^5.0.4"
}
}
4 changes: 2 additions & 2 deletions packages/happy-dom/src/base64/Base64.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import DOMException from '../exception/DOMException';
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum';
import DOMException from '../exception/DOMException.js';
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum.js';

const BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';

48 changes: 24 additions & 24 deletions packages/happy-dom/src/config/ElementTag.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import HTMLElement from '../nodes/html-element/HTMLElement';
import HTMLTemplateElement from '../nodes/html-template-element/HTMLTemplateElement';
import HTMLFormElement from '../nodes/html-form-element/HTMLFormElement';
import HTMLInputElement from '../nodes/html-input-element/HTMLInputElement';
import HTMLTextAreaElement from '../nodes/html-text-area-element/HTMLTextAreaElement';
import SVGSVGElement from '../nodes/svg-element/SVGSVGElement';
import SVGElement from '../nodes/svg-element/SVGElement';
import HTMLScriptElement from '../nodes/html-script-element/HTMLScriptElement';
import HTMLImageElement from '../nodes/html-image-element/HTMLImageElement';
import HTMLLinkElement from '../nodes/html-link-element/HTMLLinkElement';
import HTMLStyleElement from '../nodes/html-style-element/HTMLStyleElement';
import HTMLLabelElement from '../nodes/html-label-element/HTMLLabelElement';
import HTMLSlotElement from '../nodes/html-slot-element/HTMLSlotElement';
import HTMLMetaElement from '../nodes/html-meta-element/HTMLMetaElement';
import HTMLBaseElement from '../nodes/html-base-element/HTMLBaseElement';
import HTMLSelectElement from '../nodes/html-select-element/HTMLSelectElement';
import HTMLOptionElement from '../nodes/html-option-element/HTMLOptionElement';
import HTMLOptGroupElement from '../nodes/html-opt-group-element/HTMLOptGroupElement';
import HTMLDialogElement from '../nodes/html-dialog-element/HTMLDialogElement';
import HTMLButtonElement from '../nodes/html-button-element/HTMLButtonElement';
import HTMLAudioElement from '../nodes/html-audio-element/HTMLAudioElement';
import HTMLVideoElement from '../nodes/html-video-element/HTMLVideoElement';
import HTMLAnchorElement from '../nodes/html-anchor-element/HTMLAnchorElement';
import HTMLIFrameElement from '../nodes/html-iframe-element/HTMLIFrameElement';
import HTMLElement from '../nodes/html-element/HTMLElement.js';
import HTMLTemplateElement from '../nodes/html-template-element/HTMLTemplateElement.js';
import HTMLFormElement from '../nodes/html-form-element/HTMLFormElement.js';
import HTMLInputElement from '../nodes/html-input-element/HTMLInputElement.js';
import HTMLTextAreaElement from '../nodes/html-text-area-element/HTMLTextAreaElement.js';
import SVGSVGElement from '../nodes/svg-element/SVGSVGElement.js';
import SVGElement from '../nodes/svg-element/SVGElement.js';
import HTMLScriptElement from '../nodes/html-script-element/HTMLScriptElement.js';
import HTMLImageElement from '../nodes/html-image-element/HTMLImageElement.js';
import HTMLLinkElement from '../nodes/html-link-element/HTMLLinkElement.js';
import HTMLStyleElement from '../nodes/html-style-element/HTMLStyleElement.js';
import HTMLLabelElement from '../nodes/html-label-element/HTMLLabelElement.js';
import HTMLSlotElement from '../nodes/html-slot-element/HTMLSlotElement.js';
import HTMLMetaElement from '../nodes/html-meta-element/HTMLMetaElement.js';
import HTMLBaseElement from '../nodes/html-base-element/HTMLBaseElement.js';
import HTMLSelectElement from '../nodes/html-select-element/HTMLSelectElement.js';
import HTMLOptionElement from '../nodes/html-option-element/HTMLOptionElement.js';
import HTMLOptGroupElement from '../nodes/html-opt-group-element/HTMLOptGroupElement.js';
import HTMLDialogElement from '../nodes/html-dialog-element/HTMLDialogElement.js';
import HTMLButtonElement from '../nodes/html-button-element/HTMLButtonElement.js';
import HTMLAudioElement from '../nodes/html-audio-element/HTMLAudioElement.js';
import HTMLVideoElement from '../nodes/html-video-element/HTMLVideoElement.js';
import HTMLAnchorElement from '../nodes/html-anchor-element/HTMLAnchorElement.js';
import HTMLIFrameElement from '../nodes/html-iframe-element/HTMLIFrameElement.js';

export default {
A: HTMLAnchorElement,
6 changes: 3 additions & 3 deletions packages/happy-dom/src/cookie/Cookie.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import DOMException from '../exception/DOMException';
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum';
import CookieSameSiteEnum from './CookieSameSiteEnum';
import DOMException from '../exception/DOMException.js';
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum.js';
import CookieSameSiteEnum from './CookieSameSiteEnum.js';
import { URL } from 'url';

/**
4 changes: 2 additions & 2 deletions packages/happy-dom/src/cookie/CookieJar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Cookie from './Cookie';
import CookieSameSiteEnum from './CookieSameSiteEnum';
import Cookie from './Cookie.js';
import CookieSameSiteEnum from './CookieSameSiteEnum.js';
import { URL } from 'url';

/**
4 changes: 2 additions & 2 deletions packages/happy-dom/src/css/CSS.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CSSUnitValue from './CSSUnitValue';
import CSSUnits from './CSSUnits';
import CSSUnitValue from './CSSUnitValue.js';
import CSSUnits from './CSSUnits.js';
import CSSEscape from 'css.escape';

/**
16 changes: 8 additions & 8 deletions packages/happy-dom/src/css/CSSParser.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import CSSRule from './CSSRule';
import CSSStyleSheet from './CSSStyleSheet';
import CSSStyleRule from './rules/CSSStyleRule';
import CSSKeyframeRule from './rules/CSSKeyframeRule';
import CSSKeyframesRule from './rules/CSSKeyframesRule';
import CSSMediaRule from './rules/CSSMediaRule';
import CSSContainerRule from './rules/CSSContainerRule';
import CSSSupportsRule from './rules/CSSSupportsRule';
import CSSRule from './CSSRule.js';
import CSSStyleSheet from './CSSStyleSheet.js';
import CSSStyleRule from './rules/CSSStyleRule.js';
import CSSKeyframeRule from './rules/CSSKeyframeRule.js';
import CSSKeyframesRule from './rules/CSSKeyframesRule.js';
import CSSMediaRule from './rules/CSSMediaRule.js';
import CSSContainerRule from './rules/CSSContainerRule.js';
import CSSSupportsRule from './rules/CSSSupportsRule.js';

const COMMENT_REGEXP = /\/\*[\s\S]*?\*\//gm;

4 changes: 2 additions & 2 deletions packages/happy-dom/src/css/CSSRule.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CSSStyleSheet from './CSSStyleSheet';
import CSSRuleTypeEnum from './CSSRuleTypeEnum';
import CSSStyleSheet from './CSSStyleSheet.js';
import CSSRuleTypeEnum from './CSSRuleTypeEnum.js';

/**
* CSSRule interface.
10 changes: 5 additions & 5 deletions packages/happy-dom/src/css/CSSStyleSheet.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import DOMException from '../exception/DOMException';
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum';
import CSSParser from './CSSParser';
import CSSRule from './CSSRule';
import MediaList from './MediaList';
import DOMException from '../exception/DOMException.js';
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum.js';
import CSSParser from './CSSParser.js';
import CSSRule from './CSSRule.js';
import MediaList from './MediaList.js';

/**
* CSS StyleSheet.
2 changes: 1 addition & 1 deletion packages/happy-dom/src/css/CSSUnitValue.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import CSSUnits from './CSSUnits';
import CSSUnits from './CSSUnits.js';

/**
* CSS unit value.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import IElement from '../../nodes/element/IElement';
import Attr from '../../nodes/attr/Attr';
import CSSRule from '../CSSRule';
import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum';
import DOMException from '../../exception/DOMException';
import CSSStyleDeclarationElementStyle from './element-style/CSSStyleDeclarationElementStyle';
import CSSStyleDeclarationPropertyManager from './property-manager/CSSStyleDeclarationPropertyManager';
import IElement from '../../nodes/element/IElement.js';
import Attr from '../../nodes/attr/Attr.js';
import CSSRule from '../CSSRule.js';
import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum.js';
import DOMException from '../../exception/DOMException.js';
import CSSStyleDeclarationElementStyle from './element-style/CSSStyleDeclarationElementStyle.js';
import CSSStyleDeclarationPropertyManager from './property-manager/CSSStyleDeclarationPropertyManager.js';

/**
* CSS Style Declaration.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import AbstractCSSStyleDeclaration from './AbstractCSSStyleDeclaration';
import AbstractCSSStyleDeclaration from './AbstractCSSStyleDeclaration.js';

/* eslint-disable jsdoc/require-jsdoc */

Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import IShadowRoot from '../../../nodes/shadow-root/IShadowRoot';
import IElement from '../../../nodes/element/IElement';
import IDocument from '../../../nodes/document/IDocument';
import IHTMLStyleElement from '../../../nodes/html-style-element/IHTMLStyleElement';
import INodeList from '../../../nodes/node/INodeList';
import CSSStyleDeclarationPropertyManager from '../property-manager/CSSStyleDeclarationPropertyManager';
import NodeTypeEnum from '../../../nodes/node/NodeTypeEnum';
import CSSRuleTypeEnum from '../../CSSRuleTypeEnum';
import CSSMediaRule from '../../rules/CSSMediaRule';
import CSSRule from '../../CSSRule';
import CSSStyleRule from '../../rules/CSSStyleRule';
import CSSStyleDeclarationElementDefaultCSS from './config/CSSStyleDeclarationElementDefaultCSS';
import CSSStyleDeclarationElementInheritedProperties from './config/CSSStyleDeclarationElementInheritedProperties';
import CSSStyleDeclarationElementMeasurementProperties from './config/CSSStyleDeclarationElementMeasurementProperties';
import CSSStyleDeclarationCSSParser from '../css-parser/CSSStyleDeclarationCSSParser';
import QuerySelector from '../../../query-selector/QuerySelector';
import CSSMeasurementConverter from '../measurement-converter/CSSMeasurementConverter';
import MediaQueryList from '../../../match-media/MediaQueryList';
import IShadowRoot from '../../../nodes/shadow-root/IShadowRoot.js';
import IElement from '../../../nodes/element/IElement.js';
import IDocument from '../../../nodes/document/IDocument.js';
import IHTMLStyleElement from '../../../nodes/html-style-element/IHTMLStyleElement.js';
import INodeList from '../../../nodes/node/INodeList.js';
import CSSStyleDeclarationPropertyManager from '../property-manager/CSSStyleDeclarationPropertyManager.js';
import NodeTypeEnum from '../../../nodes/node/NodeTypeEnum.js';
import CSSRuleTypeEnum from '../../CSSRuleTypeEnum.js';
import CSSMediaRule from '../../rules/CSSMediaRule.js';
import CSSRule from '../../CSSRule.js';
import CSSStyleRule from '../../rules/CSSStyleRule.js';
import CSSStyleDeclarationElementDefaultCSS from './config/CSSStyleDeclarationElementDefaultCSS.js';
import CSSStyleDeclarationElementInheritedProperties from './config/CSSStyleDeclarationElementInheritedProperties.js';
import CSSStyleDeclarationElementMeasurementProperties from './config/CSSStyleDeclarationElementMeasurementProperties.js';
import CSSStyleDeclarationCSSParser from '../css-parser/CSSStyleDeclarationCSSParser.js';
import QuerySelector from '../../../query-selector/QuerySelector.js';
import CSSMeasurementConverter from '../measurement-converter/CSSMeasurementConverter.js';
import MediaQueryList from '../../../match-media/MediaQueryList.js';

const CSS_VARIABLE_REGEXP = /var\( *(--[^) ]+)\)/g;
const CSS_MEASUREMENT_REGEXP = /[0-9.]+(px|rem|em|vw|vh|%|vmin|vmax|cm|mm|in|pt|pc|Q)/g;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IWindow from '../../../window/IWindow';
import IWindow from '../../../window/IWindow.js';

/**
* CSS Measurement Converter.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CSSStyleDeclarationValueParser from './CSSStyleDeclarationValueParser';
import ICSSStyleDeclarationPropertyValue from './ICSSStyleDeclarationPropertyValue';
import CSSStyleDeclarationValueParser from './CSSStyleDeclarationValueParser.js';
import ICSSStyleDeclarationPropertyValue from './ICSSStyleDeclarationPropertyValue.js';

/**
* Computed style property parser.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import ICSSStyleDeclarationPropertyValue from './ICSSStyleDeclarationPropertyValue';
import CSSStyleDeclarationPropertySetParser from './CSSStyleDeclarationPropertySetParser';
import CSSStyleDeclarationValueParser from './CSSStyleDeclarationValueParser';
import CSSStyleDeclarationPropertyGetParser from './CSSStyleDeclarationPropertyGetParser';
import CSSStyleDeclarationCSSParser from '../css-parser/CSSStyleDeclarationCSSParser';
import ICSSStyleDeclarationPropertyValue from './ICSSStyleDeclarationPropertyValue.js';
import CSSStyleDeclarationPropertySetParser from './CSSStyleDeclarationPropertySetParser.js';
import CSSStyleDeclarationValueParser from './CSSStyleDeclarationValueParser.js';
import CSSStyleDeclarationPropertyGetParser from './CSSStyleDeclarationPropertyGetParser.js';
import CSSStyleDeclarationCSSParser from '../css-parser/CSSStyleDeclarationCSSParser.js';

const TO_STRING_SHORTHAND_PROPERTIES = [
['margin'],
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CSSStyleDeclarationValueParser from './CSSStyleDeclarationValueParser';
import ICSSStyleDeclarationPropertyValue from './ICSSStyleDeclarationPropertyValue';
import CSSStyleDeclarationValueParser from './CSSStyleDeclarationValueParser.js';
import ICSSStyleDeclarationPropertyValue from './ICSSStyleDeclarationPropertyValue.js';

const RECT_REGEXP = /^rect\((.*)\)$/i;
const BORDER_STYLE = [
2 changes: 1 addition & 1 deletion packages/happy-dom/src/css/rules/CSSContainerRule.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import CSSRule from '../CSSRule';
import CSSRule from '../CSSRule.js';

/**
* CSSRule interface.
4 changes: 2 additions & 2 deletions packages/happy-dom/src/css/rules/CSSFontFaceRule.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CSSRule from '../CSSRule';
import CSSStyleDeclaration from '../declaration/CSSStyleDeclaration';
import CSSRule from '../CSSRule.js';
import CSSStyleDeclaration from '../declaration/CSSStyleDeclaration.js';

/**
* CSSRule interface.
4 changes: 2 additions & 2 deletions packages/happy-dom/src/css/rules/CSSKeyframeRule.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CSSRule from '../CSSRule';
import CSSStyleDeclaration from '../declaration/CSSStyleDeclaration';
import CSSRule from '../CSSRule.js';
import CSSStyleDeclaration from '../declaration/CSSStyleDeclaration.js';

/**
* CSSRule interface.
6 changes: 3 additions & 3 deletions packages/happy-dom/src/css/rules/CSSKeyframesRule.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CSSRule from '../CSSRule';
import CSSStyleDeclaration from '../declaration/CSSStyleDeclaration';
import CSSKeyframeRule from './CSSKeyframeRule';
import CSSRule from '../CSSRule.js';
import CSSStyleDeclaration from '../declaration/CSSStyleDeclaration.js';
import CSSKeyframeRule from './CSSKeyframeRule.js';

const CSS_RULE_REGEXP = /([^{]+){([^}]+)}/;

4 changes: 2 additions & 2 deletions packages/happy-dom/src/css/rules/CSSMediaRule.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CSSRule from '../CSSRule';
import MediaList from '../MediaList';
import CSSRule from '../CSSRule.js';
import MediaList from '../MediaList.js';

/**
* CSSRule interface.
4 changes: 2 additions & 2 deletions packages/happy-dom/src/css/rules/CSSStyleRule.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CSSRule from '../CSSRule';
import CSSStyleDeclaration from '../declaration/CSSStyleDeclaration';
import CSSRule from '../CSSRule.js';
import CSSStyleDeclaration from '../declaration/CSSStyleDeclaration.js';

/**
* CSSRule interface.
2 changes: 1 addition & 1 deletion packages/happy-dom/src/css/rules/CSSSupportsRule.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import CSSRule from '../CSSRule';
import CSSRule from '../CSSRule.js';

/**
* CSSRule interface.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import DOMException from '../exception/DOMException';
import HTMLElement from '../nodes/html-element/HTMLElement';
import Node from '../nodes/node/Node';
import DOMException from '../exception/DOMException.js';
import HTMLElement from '../nodes/html-element/HTMLElement.js';
import Node from '../nodes/node/Node.js';

/**
* Custom elements registry.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import DocumentType from '../nodes/document-type/DocumentType';
import IDocument from '../nodes/document/IDocument';
import DocumentType from '../nodes/document-type/DocumentType.js';
import IDocument from '../nodes/document/IDocument.js';

/**
* The DOMImplementation interface represents an object providing methods which are not dependent on any particular document. Such an object is returned by the.
16 changes: 8 additions & 8 deletions packages/happy-dom/src/dom-parser/DOMParser.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import IDocument from '../nodes/document/IDocument';
import XMLParser from '../xml-parser/XMLParser';
import Node from '../nodes/node/Node';
import DOMException from '../exception/DOMException';
import HTMLDocument from '../nodes/html-document/HTMLDocument';
import XMLDocument from '../nodes/xml-document/XMLDocument';
import SVGDocument from '../nodes/svg-document/SVGDocument';
import IWindow from '../window/IWindow';
import IDocument from '../nodes/document/IDocument.js';
import XMLParser from '../xml-parser/XMLParser.js';
import Node from '../nodes/node/Node.js';
import DOMException from '../exception/DOMException.js';
import HTMLDocument from '../nodes/html-document/HTMLDocument.js';
import XMLDocument from '../nodes/xml-document/XMLDocument.js';
import SVGDocument from '../nodes/svg-document/SVGDocument.js';
import IWindow from '../window/IWindow.js';

/**
* DOM parser.
4 changes: 2 additions & 2 deletions packages/happy-dom/src/dom-token-list/DOMTokenList.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Element from '../nodes/element/Element';
import IDOMTokenList from './IDOMTokenList';
import Element from '../nodes/element/Element.js';
import IDOMTokenList from './IDOMTokenList.js';

/**
* DOM Token List.
4 changes: 2 additions & 2 deletions packages/happy-dom/src/event/DataTransfer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import File from '../file/File';
import DataTransferItemList from './DataTransferItemList';
import File from '../file/File.js';
import DataTransferItemList from './DataTransferItemList.js';

/**
*
2 changes: 1 addition & 1 deletion packages/happy-dom/src/event/DataTransferItem.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import File from '../file/File';
import File from '../file/File.js';

/**
*
4 changes: 2 additions & 2 deletions packages/happy-dom/src/event/DataTransferItemList.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import File from '../file/File';
import DataTransferItem from './DataTransferItem';
import File from '../file/File.js';
import DataTransferItem from './DataTransferItem.js';

/**
*
16 changes: 8 additions & 8 deletions packages/happy-dom/src/event/Event.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import IEventInit from './IEventInit';
import INode from '../nodes/node/INode';
import IWindow from '../window/IWindow';
import IShadowRoot from '../nodes/shadow-root/IShadowRoot';
import IEventTarget from './IEventTarget';
import NodeTypeEnum from '../nodes/node/NodeTypeEnum';
import IEventInit from './IEventInit.js';
import INode from '../nodes/node/INode.js';
import IWindow from '../window/IWindow.js';
import IShadowRoot from '../nodes/shadow-root/IShadowRoot.js';
import IEventTarget from './IEventTarget.js';
import NodeTypeEnum from '../nodes/node/NodeTypeEnum.js';
import { performance } from 'perf_hooks';
import EventPhaseEnum from './EventPhaseEnum';
import IDocument from '../nodes/document/IDocument';
import EventPhaseEnum from './EventPhaseEnum.js';
import IDocument from '../nodes/document/IDocument.js';

/**
* Event.
16 changes: 8 additions & 8 deletions packages/happy-dom/src/event/EventTarget.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import IEventListener from './IEventListener';
import Event from './Event';
import IEventTarget from './IEventTarget';
import IEventListenerOptions from './IEventListenerOptions';
import EventPhaseEnum from './EventPhaseEnum';
import INode from '../nodes/node/INode';
import IDocument from '../nodes/document/IDocument';
import IWindow from '../window/IWindow';
import IEventListener from './IEventListener.js';
import Event from './Event.js';
import IEventTarget from './IEventTarget.js';
import IEventListenerOptions from './IEventListenerOptions.js';
import EventPhaseEnum from './EventPhaseEnum.js';
import INode from '../nodes/node/INode.js';
import IDocument from '../nodes/document/IDocument.js';
import IWindow from '../window/IWindow.js';

/**
* Handles events.
2 changes: 1 addition & 1 deletion packages/happy-dom/src/event/IEventListener.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Event from './Event';
import Event from './Event.js';

/**
* Event listener.
6 changes: 3 additions & 3 deletions packages/happy-dom/src/event/IEventTarget.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import IEventListener from './IEventListener';
import Event from './Event';
import IEventListenerOptions from './IEventListenerOptions';
import IEventListener from './IEventListener.js';
import Event from './Event.js';
import IEventListenerOptions from './IEventListenerOptions.js';

/**
* Handles events.
2 changes: 1 addition & 1 deletion packages/happy-dom/src/event/IMessagePort.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IEventTarget from './IEventTarget';
import IEventTarget from './IEventTarget.js';

/**
* Message port.
4 changes: 2 additions & 2 deletions packages/happy-dom/src/event/IUIEventInit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import IWindow from '../window/IWindow';
import IEventInit from './IEventInit';
import IWindow from '../window/IWindow.js';
import IEventInit from './IEventInit.js';

export default interface IUIEventInit extends IEventInit {
detail?: number;
4 changes: 2 additions & 2 deletions packages/happy-dom/src/event/MessagePort.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import EventTarget from './EventTarget';
import IMessagePort from './IMessagePort';
import EventTarget from './EventTarget.js';
import IMessagePort from './IMessagePort.js';

/**
* Message port.
6 changes: 3 additions & 3 deletions packages/happy-dom/src/event/UIEvent.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import IWindow from '../window/IWindow';
import Event from './Event';
import IUIEventInit from './IUIEventInit';
import IWindow from '../window/IWindow.js';
import Event from './Event.js';
import IUIEventInit from './IUIEventInit.js';

/**
*
4 changes: 2 additions & 2 deletions packages/happy-dom/src/event/events/AnimationEvent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Event from '../Event';
import IAnimationEventInit from './IAnimationEventInit';
import Event from '../Event.js';
import IAnimationEventInit from './IAnimationEventInit.js';

/**
*
4 changes: 2 additions & 2 deletions packages/happy-dom/src/event/events/CustomEvent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Event from '../Event';
import ICustomEventInit from './ICustomEventInit';
import Event from '../Event.js';
import ICustomEventInit from './ICustomEventInit.js';

/**
*
6 changes: 3 additions & 3 deletions packages/happy-dom/src/event/events/ErrorEvent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import UIEvent from '../UIEvent';
import IErrorEventInit from './IErrorEventInit';
import UIEvent from '../UIEvent.js';
import IErrorEventInit from './IErrorEventInit.js';

/**
*
@@ -9,7 +9,7 @@ export default class ErrorEvent extends UIEvent {
public readonly filename: string = '';
public readonly lineno: number = 0;
public readonly colno: number = 0;
public readonly error: object = null;
public readonly error: Error | null = null;

/**
* Constructor.
6 changes: 3 additions & 3 deletions packages/happy-dom/src/event/events/FocusEvent.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import UIEvent from '../UIEvent';
import EventTarget from '../EventTarget';
import IFocusEventInit from './IFocusEventInit';
import UIEvent from '../UIEvent.js';
import EventTarget from '../EventTarget.js';
import IFocusEventInit from './IFocusEventInit.js';

/**
*
2 changes: 1 addition & 1 deletion packages/happy-dom/src/event/events/IAnimationEventInit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IEventInit from '../IEventInit';
import IEventInit from '../IEventInit.js';

export default interface IAnimationEventInit extends IEventInit {
animationName?: string;
4 changes: 2 additions & 2 deletions packages/happy-dom/src/event/events/ICustomEventInit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import IEventInit from '../IEventInit';
import IEventInit from '../IEventInit.js';

export default interface ICustomEventInit extends IEventInit {
detail?: object;
detail?: object | null;
}
4 changes: 2 additions & 2 deletions packages/happy-dom/src/event/events/IErrorEventInit.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import IEventInit from '../IEventInit';
import IEventInit from '../IEventInit.js';

export default interface IErrorEventInit extends IEventInit {
message?: string;
filename?: string;
lineno?: number;
colno?: number;
error?: object;
error?: Error;
}
4 changes: 2 additions & 2 deletions packages/happy-dom/src/event/events/IFocusEventInit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import EventTarget from '../EventTarget';
import IUIEventInit from '../IUIEventInit';
import EventTarget from '../EventTarget.js';
import IUIEventInit from '../IUIEventInit.js';

export default interface IFocusEventInit extends IUIEventInit {
relatedTarget?: EventTarget;
4 changes: 2 additions & 2 deletions packages/happy-dom/src/event/events/IInputEventInit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import DataTransfer from '../DataTransfer';
import IUIEventInit from '../IUIEventInit';
import DataTransfer from '../DataTransfer.js';
import IUIEventInit from '../IUIEventInit.js';

export default interface IInputEventInit extends IUIEventInit {
inputType?: string;
2 changes: 1 addition & 1 deletion packages/happy-dom/src/event/events/IKeyboardEventInit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IUIEventInit from '../IUIEventInit';
import IUIEventInit from '../IUIEventInit.js';

export default interface IKeyboardEventInit extends IUIEventInit {
key?: string;
2 changes: 1 addition & 1 deletion packages/happy-dom/src/event/events/IMediaQueryListInit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IEventInit from '../IEventInit';
import IEventInit from '../IEventInit.js';

export default interface IMediaQueryListInit extends IEventInit {
matches?: boolean;
6 changes: 3 additions & 3 deletions packages/happy-dom/src/event/events/IMessageEventInit.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import IEventInit from '../IEventInit';
import IWindow from '../../window/IWindow';
import IMessagePort from '../IMessagePort';
import IEventInit from '../IEventInit.js';
import IWindow from '../../window/IWindow.js';
import IMessagePort from '../IMessagePort.js';

export default interface IMessageEventInit extends IEventInit {
data?: unknown | null;
4 changes: 2 additions & 2 deletions packages/happy-dom/src/event/events/IMouseEventInit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import EventTarget from '../EventTarget';
import IUIEventInit from '../IUIEventInit';
import EventTarget from '../EventTarget.js';
import IUIEventInit from '../IUIEventInit.js';

export default interface IMouseEventInit extends IUIEventInit {
screenX?: number;
2 changes: 1 addition & 1 deletion packages/happy-dom/src/event/events/IPointerEventInit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IMouseEventInit from './IMouseEventInit';
import IMouseEventInit from './IMouseEventInit.js';

export default interface IPointerEventInit extends IMouseEventInit {
pointerId?: number;
2 changes: 1 addition & 1 deletion packages/happy-dom/src/event/events/IProgressEventInit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IEventInit from '../IEventInit';
import IEventInit from '../IEventInit.js';

export default interface IProgressEventInit extends IEventInit {
lengthComputable?: boolean;
4 changes: 2 additions & 2 deletions packages/happy-dom/src/event/events/IStorageEventInit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import IEventInit from '../IEventInit';
import Storage from '../../storage/Storage';
import IEventInit from '../IEventInit.js';
import Storage from '../../storage/Storage.js';

export default interface IStorageEventInit extends IEventInit {
key?: string;
4 changes: 2 additions & 2 deletions packages/happy-dom/src/event/events/ISubmitEventInit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import IHTMLElement from '../../nodes/html-element/IHTMLElement';
import IEventInit from '../IEventInit';
import IHTMLElement from '../../nodes/html-element/IHTMLElement.js';
import IEventInit from '../IEventInit.js';

export default interface ISubmitEventInit extends IEventInit {
submitter?: IHTMLElement;
2 changes: 1 addition & 1 deletion packages/happy-dom/src/event/events/IWheelEventInit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IUIEventInit from '../IUIEventInit';
import IUIEventInit from '../IUIEventInit.js';

export default interface IWheelEventInit extends IUIEventInit {
deltaX?: number;
6 changes: 3 additions & 3 deletions packages/happy-dom/src/event/events/InputEvent.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import DataTransfer from '../DataTransfer';
import UIEvent from '../UIEvent';
import IInputEventInit from './IInputEventInit';
import DataTransfer from '../DataTransfer.js';
import UIEvent from '../UIEvent.js';
import IInputEventInit from './IInputEventInit.js';

/**
*
4 changes: 2 additions & 2 deletions packages/happy-dom/src/event/events/KeyboardEvent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import UIEvent from '../UIEvent';
import IKeyboardEventInit from './IKeyboardEventInit';
import UIEvent from '../UIEvent.js';
import IKeyboardEventInit from './IKeyboardEventInit.js';

/**
*
4 changes: 2 additions & 2 deletions packages/happy-dom/src/event/events/MediaQueryListEvent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Event from '../Event';
import IMediaQueryListInit from './IMediaQueryListInit';
import Event from '../Event.js';
import IMediaQueryListInit from './IMediaQueryListInit.js';

/**
*
8 changes: 4 additions & 4 deletions packages/happy-dom/src/event/events/MessageEvent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import IWindow from '../../window/IWindow';
import Event from '../Event';
import IMessagePort from '../IMessagePort';
import IMessageEventInit from './IMessageEventInit';
import IWindow from '../../window/IWindow.js';
import Event from '../Event.js';
import IMessagePort from '../IMessagePort.js';
import IMessageEventInit from './IMessageEventInit.js';

/**
* Message event.
6 changes: 3 additions & 3 deletions packages/happy-dom/src/event/events/MouseEvent.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import UIEvent from '../UIEvent';
import EventTarget from '../EventTarget';
import IMouseEventInit from './IMouseEventInit';
import UIEvent from '../UIEvent.js';
import EventTarget from '../EventTarget.js';
import IMouseEventInit from './IMouseEventInit.js';

/**
*
4 changes: 2 additions & 2 deletions packages/happy-dom/src/event/events/PointerEvent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import MouseEvent from './MouseEvent';
import IPointerEventInit from './IPointerEventInit';
import MouseEvent from './MouseEvent.js';
import IPointerEventInit from './IPointerEventInit.js';

/**
*
4 changes: 2 additions & 2 deletions packages/happy-dom/src/event/events/ProgressEvent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Event from '../Event';
import IProgressEventInit from './IProgressEventInit';
import Event from '../Event.js';
import IProgressEventInit from './IProgressEventInit.js';

/**
*
6 changes: 3 additions & 3 deletions packages/happy-dom/src/event/events/StorageEvent.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Event from '../Event';
import IStorageEventInit from './IStorageEventInit';
import Storage from '../../storage/Storage';
import Event from '../Event.js';
import IStorageEventInit from './IStorageEventInit.js';
import Storage from '../../storage/Storage.js';

/**
*
6 changes: 3 additions & 3 deletions packages/happy-dom/src/event/events/SubmitEvent.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Event from '../Event';
import ISubmitEventInit from './ISubmitEventInit';
import IHTMLElement from '../../nodes/html-element/IHTMLElement';
import Event from '../Event.js';
import ISubmitEventInit from './ISubmitEventInit.js';
import IHTMLElement from '../../nodes/html-element/IHTMLElement.js';

/**
* An event triggered by form submit buttons.
4 changes: 2 additions & 2 deletions packages/happy-dom/src/event/events/WheelEvent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import UIEvent from '../UIEvent';
import IWheelEventInit from './IWheelEventInit';
import UIEvent from '../UIEvent.js';
import IWheelEventInit from './IWheelEventInit.js';

/**
*
2 changes: 1 addition & 1 deletion packages/happy-dom/src/exception/DOMException.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import DOMExceptionNameEnum from './DOMExceptionNameEnum';
import DOMExceptionNameEnum from './DOMExceptionNameEnum.js';

/**
* DOM Exception.
2 changes: 1 addition & 1 deletion packages/happy-dom/src/fetch/AbortController.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import AbortSignal from './AbortSignal';
import AbortSignal from './AbortSignal.js';

/**
* AbortController.
4 changes: 2 additions & 2 deletions packages/happy-dom/src/fetch/AbortSignal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import EventTarget from '../event/EventTarget';
import Event from '../event/Event';
import EventTarget from '../event/EventTarget.js';
import Event from '../event/Event.js';

/**
* AbortSignal.
27 changes: 14 additions & 13 deletions packages/happy-dom/src/fetch/Fetch.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import IRequestInit from './types/IRequestInit';
import IDocument from '../nodes/document/IDocument';
import IResponse from './types/IResponse';
import Request from './Request';
import IRequestInfo from './types/IRequestInfo';
import Headers from './Headers';
import FetchRequestReferrerUtility from './utilities/FetchRequestReferrerUtility';
import DOMException from '../exception/DOMException';
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum';
import Response from './Response';
import IRequestInit from './types/IRequestInit.js';
import IDocument from '../nodes/document/IDocument.js';
import IResponse from './types/IResponse.js';
import Request from './Request.js';
import IRequestInfo from './types/IRequestInfo.js';
import Headers from './Headers.js';
import FetchRequestReferrerUtility from './utilities/FetchRequestReferrerUtility.js';
import DOMException from '../exception/DOMException.js';
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum.js';
import Response from './Response.js';
import HTTP, { IncomingMessage } from 'http';
import HTTPS from 'https';
import Zlib from 'zlib';
import { URL } from 'url';
import { Socket } from 'net';
import Stream from 'stream';
import DataURIParser from './data-uri/DataURIParser';
import FetchCORSUtility from './utilities/FetchCORSUtility';
import CookieJar from '../cookie/CookieJar';
import DataURIParser from './data-uri/DataURIParser.js';
import FetchCORSUtility from './utilities/FetchCORSUtility.js';
import CookieJar from '../cookie/CookieJar.js';

const SUPPORTED_SCHEMAS = ['data:', 'http:', 'https:'];
const REDIRECT_STATUS_CODES = [301, 302, 303, 307, 308];
@@ -195,6 +195,7 @@ export default class Fetch {
*/
private onError(error: Error): void {
this.finalizeRequest();
this.ownerDocument.defaultView.console.error(error);
this.reject(
new DOMException(
`Fetch to "${this.request.url}" failed. Error: ${error.message}`,
8 changes: 4 additions & 4 deletions packages/happy-dom/src/fetch/Headers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DOMException from '../exception/DOMException';
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum';
import IHeaders from './types/IHeaders';
import IHeadersInit from './types/IHeadersInit';
import DOMException from '../exception/DOMException.js';
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum.js';
import IHeaders from './types/IHeaders.js';
import IHeadersInit from './types/IHeadersInit.js';

/**
* Fetch headers.
38 changes: 19 additions & 19 deletions packages/happy-dom/src/fetch/Request.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import IBlob from '../file/IBlob';
import IDocument from '../nodes/document/IDocument';
import IRequestInit from './types/IRequestInit';
import IBlob from '../file/IBlob.js';
import IDocument from '../nodes/document/IDocument.js';
import IRequestInit from './types/IRequestInit.js';
import { URL } from 'url';
import DOMException from '../exception/DOMException';
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum';
import IRequestInfo from './types/IRequestInfo';
import IRequest from './types/IRequest';
import Headers from './Headers';
import FetchBodyUtility from './utilities/FetchBodyUtility';
import AbortSignal from './AbortSignal';
import DOMException from '../exception/DOMException.js';
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum.js';
import IRequestInfo from './types/IRequestInfo.js';
import IRequest from './types/IRequest.js';
import Headers from './Headers.js';
import FetchBodyUtility from './utilities/FetchBodyUtility.js';
import AbortSignal from './AbortSignal.js';
import Stream from 'stream';
import Blob from '../file/Blob';
import Blob from '../file/Blob.js';
import { TextDecoder } from 'util';
import FetchRequestValidationUtility from './utilities/FetchRequestValidationUtility';
import IRequestReferrerPolicy from './types/IRequestReferrerPolicy';
import IRequestRedirect from './types/IRequestRedirect';
import FetchRequestReferrerUtility from './utilities/FetchRequestReferrerUtility';
import FetchRequestHeaderUtility from './utilities/FetchRequestHeaderUtility';
import IRequestCredentials from './types/IRequestCredentials';
import FormData from '../form-data/FormData';
import MultipartFormDataParser from './multipart/MultipartFormDataParser';
import FetchRequestValidationUtility from './utilities/FetchRequestValidationUtility.js';
import IRequestReferrerPolicy from './types/IRequestReferrerPolicy.js';
import IRequestRedirect from './types/IRequestRedirect.js';
import FetchRequestReferrerUtility from './utilities/FetchRequestReferrerUtility.js';
import FetchRequestHeaderUtility from './utilities/FetchRequestHeaderUtility.js';
import IRequestCredentials from './types/IRequestCredentials.js';
import FormData from '../form-data/FormData.js';
import MultipartFormDataParser from './multipart/MultipartFormDataParser.js';

/**
* Fetch request.
4 changes: 2 additions & 2 deletions packages/happy-dom/src/fetch/ResourceFetch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import DOMException from '../exception/DOMException';
import IDocument from '../nodes/document/IDocument';
import DOMException from '../exception/DOMException.js';
import IDocument from '../nodes/document/IDocument.js';
import { URL } from 'url';

/**
26 changes: 13 additions & 13 deletions packages/happy-dom/src/fetch/Response.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import IResponse from './types/IResponse';
import IBlob from '../file/IBlob';
import IDocument from '../nodes/document/IDocument';
import IResponseInit from './types/IResponseInit';
import IResponseBody from './types/IResponseBody';
import Headers from './Headers';
import IHeaders from './types/IHeaders';
import IResponse from './types/IResponse.js';
import IBlob from '../file/IBlob.js';
import IDocument from '../nodes/document/IDocument.js';
import IResponseInit from './types/IResponseInit.js';
import IResponseBody from './types/IResponseBody.js';
import Headers from './Headers.js';
import IHeaders from './types/IHeaders.js';
import { URL, URLSearchParams } from 'url';
import Blob from '../file/Blob';
import Blob from '../file/Blob.js';
import Stream from 'stream';
import FormData from '../form-data/FormData';
import FetchBodyUtility from './utilities/FetchBodyUtility';
import DOMException from '../exception/DOMException';
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum';
import FormData from '../form-data/FormData.js';
import FetchBodyUtility from './utilities/FetchBodyUtility.js';
import DOMException from '../exception/DOMException.js';
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum.js';
import { TextDecoder } from 'util';
import MultipartFormDataParser from './multipart/MultipartFormDataParser';
import MultipartFormDataParser from './multipart/MultipartFormDataParser.js';

const REDIRECT_STATUS_CODES = [301, 302, 303, 307, 308];

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import FormData from '../../form-data/FormData';
import FormData from '../../form-data/FormData.js';
import Stream from 'stream';
import MultipartReader from './MultipartReader';
import DOMException from '../../exception/DOMException';
import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum';
import MultipartReader from './MultipartReader.js';
import DOMException from '../../exception/DOMException.js';
import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum.js';

/**
* Multipart form data factory.
8 changes: 4 additions & 4 deletions packages/happy-dom/src/fetch/multipart/MultipartReader.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DOMException from '../../exception/DOMException';
import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum';
import File from '../../file/File';
import FormData from '../../form-data/FormData';
import DOMException from '../../exception/DOMException.js';
import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum.js';
import File from '../../file/File.js';
import FormData from '../../form-data/FormData.js';

enum MultiparParserStateEnum {
boundary = 0,
2 changes: 1 addition & 1 deletion packages/happy-dom/src/fetch/types/IHeadersInit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IHeaders from './IHeaders';
import IHeaders from './IHeaders.js';

type IHeadersInit = string[][] | { [key: string]: string } | IHeaders;

14 changes: 7 additions & 7 deletions packages/happy-dom/src/fetch/types/IRequest.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import IHeaders from './IHeaders';
import IBlob from '../../file/IBlob';
import AbortSignal from '../AbortSignal';
import IHeaders from './IHeaders.js';
import IBlob from '../../file/IBlob.js';
import AbortSignal from '../AbortSignal.js';
import Stream from 'stream';
import IRequestReferrerPolicy from './IRequestReferrerPolicy';
import IRequestRedirect from './IRequestRedirect';
import IRequestCredentials from './IRequestCredentials';
import FormData from '../../form-data/FormData';
import IRequestReferrerPolicy from './IRequestReferrerPolicy.js';
import IRequestRedirect from './IRequestRedirect.js';
import IRequestCredentials from './IRequestCredentials.js';
import FormData from '../../form-data/FormData.js';

/**
* Fetch request.
4 changes: 2 additions & 2 deletions packages/happy-dom/src/fetch/types/IRequestBody.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { URLSearchParams } from 'url';
import FormData from '../../form-data/FormData';
import Blob from '../../file/Blob';
import FormData from '../../form-data/FormData.js';
import Blob from '../../file/Blob.js';

type IRequestBody =
| ArrayBuffer
2 changes: 1 addition & 1 deletion packages/happy-dom/src/fetch/types/IRequestInfo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { URL } from 'url';
import IRequest from './IRequest';
import IRequest from './IRequest.js';

type IRequestInfo = IRequest | string | URL;

12 changes: 6 additions & 6 deletions packages/happy-dom/src/fetch/types/IRequestInit.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import IHeadersInit from './IHeadersInit';
import AbortSignal from '../AbortSignal';
import IHeadersInit from './IHeadersInit.js';
import AbortSignal from '../AbortSignal.js';
import { URL } from 'url';
import IRequestReferrerPolicy from './IRequestReferrerPolicy';
import IRequestRedirect from './IRequestRedirect';
import IRequestBody from './IRequestBody';
import IRequestCredentials from './IRequestCredentials';
import IRequestReferrerPolicy from './IRequestReferrerPolicy.js';
import IRequestRedirect from './IRequestRedirect.js';
import IRequestBody from './IRequestBody.js';
import IRequestCredentials from './IRequestCredentials.js';

/**
* Fetch request init.
4 changes: 2 additions & 2 deletions packages/happy-dom/src/fetch/types/IResponse.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import IHeaders from './IHeaders';
import IBlob from 'src/file/IBlob';
import IHeaders from './IHeaders.js';
import IBlob from '../../file/IBlob.js';
import Stream from 'stream';

/**
4 changes: 2 additions & 2 deletions packages/happy-dom/src/fetch/types/IResponseBody.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { URLSearchParams } from 'url';
import FormData from '../../form-data/FormData';
import Blob from '../../file/Blob';
import FormData from '../../form-data/FormData.js';
import Blob from '../../file/Blob.js';

type IResponseBody =
| ArrayBuffer
2 changes: 1 addition & 1 deletion packages/happy-dom/src/fetch/types/IResponseInit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IHeadersInit from './IHeadersInit';
import IHeadersInit from './IHeadersInit.js';

/**
* Response init.
16 changes: 8 additions & 8 deletions packages/happy-dom/src/fetch/utilities/FetchBodyUtility.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import MultipartFormDataParser from '../multipart/MultipartFormDataParser';
import MultipartFormDataParser from '../multipart/MultipartFormDataParser.js';
import Stream from 'stream';
import { URLSearchParams } from 'url';
import FormData from '../../form-data/FormData';
import Blob from '../../file/Blob';
import DOMException from '../../exception/DOMException';
import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum';
import IRequestBody from '../types/IRequestBody';
import IResponseBody from '../types/IResponseBody';
import Request from '../Request';
import FormData from '../../form-data/FormData.js';
import Blob from '../../file/Blob.js';
import DOMException from '../../exception/DOMException.js';
import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum.js';
import IRequestBody from '../types/IRequestBody.js';
import IResponseBody from '../types/IResponseBody.js';
import Request from '../Request.js';

/**
* Fetch body utility.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Headers from '../Headers';
import IHeaders from '../types/IHeaders';
import Headers from '../Headers.js';
import IHeaders from '../types/IHeaders.js';

const FORBIDDEN_HEADER_NAMES = [
'accept-charset',
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { URL } from 'url';
import IRequest from '../types/IRequest';
import IDocument from '../../nodes/document/IDocument';
import IRequest from '../types/IRequest.js';
import IDocument from '../../nodes/document/IDocument.js';
import { isIP } from 'net';
import Headers from '../Headers';
import IRequestReferrerPolicy from '../types/IRequestReferrerPolicy';
import Headers from '../Headers.js';
import IRequestReferrerPolicy from '../types/IRequestReferrerPolicy.js';

const REQUEST_REFERRER_UNSUPPORTED_PROTOCOL_REGEXP = /^(about|blob|data):$/;
const REFERRER_POLICIES: IRequestReferrerPolicy[] = [
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import DOMException from '../../exception/DOMException';
import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum';
import IRequestReferrerPolicy from '../types/IRequestReferrerPolicy';
import IRequestRedirect from '../types/IRequestRedirect';
import DOMException from '../../exception/DOMException.js';
import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum.js';
import IRequestReferrerPolicy from '../types/IRequestReferrerPolicy.js';
import IRequestRedirect from '../types/IRequestRedirect.js';
import { URL } from 'url';
import IRequest from '../types/IRequest';
import IRequest from '../types/IRequest.js';

const VALID_REFERRER_POLICIES = [
'',
2 changes: 1 addition & 1 deletion packages/happy-dom/src/file/Blob.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IBlob from './IBlob';
import IBlob from './IBlob.js';

/**
* Reference:
2 changes: 1 addition & 1 deletion packages/happy-dom/src/file/File.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Blob from './Blob';
import Blob from './Blob.js';

/**
* Reference:
18 changes: 9 additions & 9 deletions packages/happy-dom/src/file/FileReader.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import WhatwgMIMEType from 'whatwg-mimetype';
import WhatwgEncoding from 'whatwg-encoding';
import IDocument from '../nodes/document/IDocument';
import ProgressEvent from '../event/events/ProgressEvent';
import DOMException from '../exception/DOMException';
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum';
import Blob from './Blob';
import FileReaderReadyStateEnum from './FileReaderReadyStateEnum';
import FileReaderFormatEnum from './FileReaderFormatEnum';
import EventTarget from '../event/EventTarget';
import FileReaderEventTypeEnum from './FileReaderEventTypeEnum';
import IDocument from '../nodes/document/IDocument.js';
import ProgressEvent from '../event/events/ProgressEvent.js';
import DOMException from '../exception/DOMException.js';
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum.js';
import Blob from './Blob.js';
import FileReaderReadyStateEnum from './FileReaderReadyStateEnum.js';
import FileReaderFormatEnum from './FileReaderFormatEnum.js';
import EventTarget from '../event/EventTarget.js';
import FileReaderEventTypeEnum from './FileReaderEventTypeEnum.js';

/**
* Reference:
12 changes: 6 additions & 6 deletions packages/happy-dom/src/form-data/FormData.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Blob from '../file/Blob';
import File from '../file/File';
import IHTMLInputElement from '../nodes/html-input-element/IHTMLInputElement';
import IHTMLFormElement from '../nodes/html-form-element/IHTMLFormElement';
import HTMLFormControlsCollection from '../nodes/html-form-element/HTMLFormControlsCollection';
import RadioNodeList from '../nodes/html-form-element/RadioNodeList';
import Blob from '../file/Blob.js';
import File from '../file/File.js';
import IHTMLInputElement from '../nodes/html-input-element/IHTMLInputElement.js';
import IHTMLFormElement from '../nodes/html-form-element/IHTMLFormElement.js';
import HTMLFormControlsCollection from '../nodes/html-form-element/HTMLFormControlsCollection.js';
import RadioNodeList from '../nodes/html-form-element/RadioNodeList.js';

type FormDataEntry = {
name: string;
2 changes: 1 addition & 1 deletion packages/happy-dom/src/history/History.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import HistoryScrollRestorationEnum from './HistoryScrollRestorationEnum';
import HistoryScrollRestorationEnum from './HistoryScrollRestorationEnum.js';

/**
* History API.
290 changes: 145 additions & 145 deletions packages/happy-dom/src/index.ts

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/happy-dom/src/location/Location.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { URL } from 'url';
import DOMException from '../exception/DOMException';
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum';
import DOMException from '../exception/DOMException.js';
import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum.js';

/**
*
10 changes: 5 additions & 5 deletions packages/happy-dom/src/match-media/MediaQueryItem.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import CSSMeasurementConverter from '../css/declaration/measurement-converter/CSSMeasurementConverter';
import IWindow from '../window/IWindow';
import IMediaQueryRange from './IMediaQueryRange';
import IMediaQueryRule from './IMediaQueryRule';
import MediaQueryTypeEnum from './MediaQueryTypeEnum';
import CSSMeasurementConverter from '../css/declaration/measurement-converter/CSSMeasurementConverter.js';
import IWindow from '../window/IWindow.js';
import IMediaQueryRange from './IMediaQueryRange.js';
import IMediaQueryRule from './IMediaQueryRule.js';
import MediaQueryTypeEnum from './MediaQueryTypeEnum.js';

/**
* Media query this.
14 changes: 7 additions & 7 deletions packages/happy-dom/src/match-media/MediaQueryList.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import EventTarget from '../event/EventTarget';
import Event from '../event/Event';
import IWindow from '../window/IWindow';
import IEventListener from '../event/IEventListener';
import MediaQueryListEvent from '../event/events/MediaQueryListEvent';
import IMediaQueryItem from './MediaQueryItem';
import MediaQueryParser from './MediaQueryParser';
import EventTarget from '../event/EventTarget.js';
import Event from '../event/Event.js';
import IWindow from '../window/IWindow.js';
import IEventListener from '../event/IEventListener.js';
import MediaQueryListEvent from '../event/events/MediaQueryListEvent.js';
import IMediaQueryItem from './MediaQueryItem.js';
import MediaQueryParser from './MediaQueryParser.js';

/**
* Media Query List.
6 changes: 3 additions & 3 deletions packages/happy-dom/src/match-media/MediaQueryParser.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import MediaQueryItem from './MediaQueryItem';
import MediaQueryTypeEnum from './MediaQueryTypeEnum';
import IWindow from '../window/IWindow';
import MediaQueryItem from './MediaQueryItem.js';
import MediaQueryTypeEnum from './MediaQueryTypeEnum.js';
import IWindow from '../window/IWindow.js';

/**
* Media query RegExp.
4 changes: 2 additions & 2 deletions packages/happy-dom/src/mutation-observer/MutationListener.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import IMutationObserverInit from './IMutationObserverInit';
import MutationRecord from './MutationRecord';
import IMutationObserverInit from './IMutationObserverInit.js';
import MutationRecord from './MutationRecord.js';

/**
* MutationObserverListener is a model for what to listen for on a Node.
12 changes: 6 additions & 6 deletions packages/happy-dom/src/mutation-observer/MutationObserver.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import DOMException from '../exception/DOMException';
import INode from '../nodes/node/INode';
import Node from '../nodes/node/Node';
import IMutationObserverInit from './IMutationObserverInit';
import MutationObserverListener from './MutationListener';
import MutationRecord from './MutationRecord';
import DOMException from '../exception/DOMException.js';
import INode from '../nodes/node/INode.js';
import Node from '../nodes/node/Node.js';
import IMutationObserverInit from './IMutationObserverInit.js';
import MutationObserverListener from './MutationListener.js';
import MutationRecord from './MutationRecord.js';

/**
* The MutationObserver interface provides the ability to watch for changes being made to the DOM tree.
2 changes: 1 addition & 1 deletion packages/happy-dom/src/mutation-observer/MutationRecord.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import INode from '../nodes/node/INode';
import INode from '../nodes/node/INode.js';

/**
* MutationRecord is a model for a mutation.
2 changes: 1 addition & 1 deletion packages/happy-dom/src/named-node-map/INamedNodeMap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IAttr from '../nodes/attr/IAttr';
import IAttr from '../nodes/attr/IAttr.js';

/**
* NamedNodeMap.
6 changes: 3 additions & 3 deletions packages/happy-dom/src/named-node-map/NamedNodeMap.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type Element from '../nodes/element/Element';
import IAttr from '../nodes/attr/IAttr';
import INamedNodeMap from './INamedNodeMap';
import type Element from '../nodes/element/Element.js';
import IAttr from '../nodes/attr/IAttr.js';
import INamedNodeMap from './INamedNodeMap.js';

/**
* NamedNodeMap.
2 changes: 1 addition & 1 deletion packages/happy-dom/src/navigator/MimeType.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Plugin from './Plugin';
import Plugin from './Plugin.js';

/**
* MimeType.
2 changes: 1 addition & 1 deletion packages/happy-dom/src/navigator/MimeTypeArray.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MimeType from './MimeType';
import MimeType from './MimeType.js';

/**
* MimeTypeArray.
4 changes: 2 additions & 2 deletions packages/happy-dom/src/navigator/Navigator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import MimeTypeArray from './MimeTypeArray';
import PluginArray from './PluginArray';
import MimeTypeArray from './MimeTypeArray.js';
import PluginArray from './PluginArray.js';

/**
* Browser Navigator API.
2 changes: 1 addition & 1 deletion packages/happy-dom/src/navigator/Plugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MimeType from './MimeType';
import MimeType from './MimeType.js';

/**
* Plugin.
2 changes: 1 addition & 1 deletion packages/happy-dom/src/navigator/PluginArray.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Plugin from './Plugin';
import Plugin from './Plugin.js';

/**
* PluginArray.
6 changes: 3 additions & 3 deletions packages/happy-dom/src/nodes/attr/Attr.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import IElement from '../element/IElement';
import Node from '../node/Node';
import IAttr from './IAttr';
import IElement from '../element/IElement.js';
import Node from '../node/Node.js';
import IAttr from './IAttr.js';

/**
* Attribute node interface.
4 changes: 2 additions & 2 deletions packages/happy-dom/src/nodes/attr/IAttr.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import IElement from '../element/IElement';
import INode from './../node/INode';
import IElement from '../element/IElement.js';
import INode from './../node/INode.js';

/**
* Attr.
16 changes: 8 additions & 8 deletions packages/happy-dom/src/nodes/character-data/CharacterData.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Node from '../node/Node';
import CharacterDataUtility from './CharacterDataUtility';
import ICharacterData from './ICharacterData';
import IElement from '../element/IElement';
import NonDocumentChildNodeUtility from '../child-node/NonDocumentChildNodeUtility';
import ChildNodeUtility from '../child-node/ChildNodeUtility';
import MutationRecord from '../../mutation-observer/MutationRecord';
import MutationTypeEnum from '../../mutation-observer/MutationTypeEnum';
import Node from '../node/Node.js';
import CharacterDataUtility from './CharacterDataUtility.js';
import ICharacterData from './ICharacterData.js';
import IElement from '../element/IElement.js';
import NonDocumentChildNodeUtility from '../child-node/NonDocumentChildNodeUtility.js';
import ChildNodeUtility from '../child-node/ChildNodeUtility.js';
import MutationRecord from '../../mutation-observer/MutationRecord.js';
import MutationTypeEnum from '../../mutation-observer/MutationTypeEnum.js';

/**
* Character data base class.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ICharacterData from './ICharacterData';
import ICharacterData from './ICharacterData.js';

/**
* Child node utility.
6 changes: 3 additions & 3 deletions packages/happy-dom/src/nodes/character-data/ICharacterData.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import INode from '../node/INode';
import IChildNode from '../child-node/IChildNode';
import INonDocumentTypeChildNode from '../child-node/INonDocumentTypeChildNode';
import INode from '../node/INode.js';
import IChildNode from '../child-node/IChildNode.js';
import INonDocumentTypeChildNode from '../child-node/INonDocumentTypeChildNode.js';

export default interface ICharacterData extends INode, IChildNode, INonDocumentTypeChildNode {
data: string;
12 changes: 6 additions & 6 deletions packages/happy-dom/src/nodes/child-node/ChildNodeUtility.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import DOMException from '../../exception/DOMException';
import XMLParser from '../../xml-parser/XMLParser';
import Document from '../document/Document';
import INode from '../node/INode';
import IParentNode from '../parent-node/IParentNode';
import IChildNode from './IChildNode';
import DOMException from '../../exception/DOMException.js';
import XMLParser from '../../xml-parser/XMLParser.js';
import Document from '../document/Document.js';
import INode from '../node/INode.js';
import IParentNode from '../parent-node/IParentNode.js';
import IChildNode from './IChildNode.js';

/**
* Child node utility.
2 changes: 1 addition & 1 deletion packages/happy-dom/src/nodes/child-node/IChildNode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import INode from '../node/INode';
import INode from '../node/INode.js';

export default interface IChildNode extends INode {
/**
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import IElement from '../element/IElement';
import INode from '../node/INode';
import IElement from '../element/IElement.js';
import INode from '../node/INode.js';

export default interface INonDocumentTypeChildNode extends INode {
readonly previousElementSibling: IElement;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Element from '../element/Element';
import IElement from '../element/IElement';
import INonDocumentTypeChildNode from './INonDocumentTypeChildNode';
import Element from '../element/Element.js';
import IElement from '../element/IElement.js';
import INonDocumentTypeChildNode from './INonDocumentTypeChildNode.js';

/**
* Non Document Child node utility.
6 changes: 3 additions & 3 deletions packages/happy-dom/src/nodes/comment/Comment.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Node from '../node/Node';
import CharacterData from '../character-data/CharacterData';
import IComment from './IComment';
import Node from '../node/Node.js';
import CharacterData from '../character-data/CharacterData.js';
import IComment from './IComment.js';

/**
* Comment node.
2 changes: 1 addition & 1 deletion packages/happy-dom/src/nodes/comment/IComment.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ICharacterData from '../character-data/ICharacterData';
import ICharacterData from '../character-data/ICharacterData.js';

export default interface IComment extends ICharacterData {
/**
20 changes: 10 additions & 10 deletions packages/happy-dom/src/nodes/document-fragment/DocumentFragment.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Node from '../node/Node';
import IElement from '../element/IElement';
import QuerySelector from '../../query-selector/QuerySelector';
import ParentNodeUtility from '../parent-node/ParentNodeUtility';
import IDocumentFragment from './IDocumentFragment';
import INode from '../node/INode';
import IHTMLCollection from '../element/IHTMLCollection';
import ElementUtility from '../element/ElementUtility';
import HTMLCollection from '../element/HTMLCollection';
import INodeList from '../node/INodeList';
import Node from '../node/Node.js';
import IElement from '../element/IElement.js';
import QuerySelector from '../../query-selector/QuerySelector.js';
import ParentNodeUtility from '../parent-node/ParentNodeUtility.js';
import IDocumentFragment from './IDocumentFragment.js';
import INode from '../node/INode.js';
import IHTMLCollection from '../element/IHTMLCollection.js';
import ElementUtility from '../element/ElementUtility.js';
import HTMLCollection from '../element/HTMLCollection.js';
import INodeList from '../node/INodeList.js';

/**
* DocumentFragment.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import IElement from '../element/IElement';
import INode from '../node/INode';
import INodeList from '../node/INodeList';
import IElement from '../element/IElement.js';
import INode from '../node/INode.js';
import INodeList from '../node/INodeList.js';

export default interface IDocumentFragment extends INode {
readonly childElementCount: number;
2 changes: 1 addition & 1 deletion packages/happy-dom/src/nodes/document-type/DocumentType.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Node from '../node/Node';
import Node from '../node/Node.js';

/**
* DocumentType.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import INode from '../node/INode';
import INode from '../node/INode.js';

/**
* DocumentType.
100 changes: 50 additions & 50 deletions packages/happy-dom/src/nodes/document/Document.ts
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
import Element from '../element/Element';
import HTMLUnknownElement from '../html-unknown-element/HTMLUnknownElement';
import Text from '../text/Text';
import Comment from '../comment/Comment';
import IWindow from '../../window/IWindow';
import Node from '../node/Node';
import NodeIterator from '../../tree-walker/NodeIterator';
import TreeWalker from '../../tree-walker/TreeWalker';
import DocumentFragment from '../document-fragment/DocumentFragment';
import XMLParser from '../../xml-parser/XMLParser';
import Event from '../../event/Event';
import DOMImplementation from '../../dom-implementation/DOMImplementation';
import ElementTag from '../../config/ElementTag';
import INodeFilter from '../../tree-walker/INodeFilter';
import Attr from '../attr/Attr';
import NamespaceURI from '../../config/NamespaceURI';
import DocumentType from '../document-type/DocumentType';
import ParentNodeUtility from '../parent-node/ParentNodeUtility';
import QuerySelector from '../../query-selector/QuerySelector';
import IDocument from './IDocument';
import CSSStyleSheet from '../../css/CSSStyleSheet';
import DOMException from '../../exception/DOMException';
import CookieJar from '../../cookie/CookieJar';
import IElement from '../element/IElement';
import IHTMLScriptElement from '../html-script-element/IHTMLScriptElement';
import IHTMLElement from '../html-element/IHTMLElement';
import IDocumentType from '../document-type/IDocumentType';
import INode from '../node/INode';
import IComment from '../comment/IComment';
import IText from '../text/IText';
import IDocumentFragment from '../document-fragment/IDocumentFragment';
import INodeList from '../node/INodeList';
import NodeList from '../node/NodeList';
import IHTMLCollection from '../element/IHTMLCollection';
import IHTMLLinkElement from '../html-link-element/IHTMLLinkElement';
import IHTMLStyleElement from '../html-style-element/IHTMLStyleElement';
import DocumentReadyStateEnum from './DocumentReadyStateEnum';
import DocumentReadyStateManager from './DocumentReadyStateManager';
import Location from '../../location/Location';
import Selection from '../../selection/Selection';
import IShadowRoot from '../shadow-root/IShadowRoot';
import Range from '../../range/Range';
import IHTMLBaseElement from '../html-base-element/IHTMLBaseElement';
import IAttr from '../attr/IAttr';
import IProcessingInstruction from '../processing-instruction/IProcessingInstruction';
import ProcessingInstruction from '../processing-instruction/ProcessingInstruction';
import ElementUtility from '../element/ElementUtility';
import HTMLCollection from '../element/HTMLCollection';
import VisibilityStateEnum from './VisibilityStateEnum';
import NodeTypeEnum from '../node/NodeTypeEnum';
import Element from '../element/Element.js';
import HTMLUnknownElement from '../html-unknown-element/HTMLUnknownElement.js';
import Text from '../text/Text.js';
import Comment from '../comment/Comment.js';
import IWindow from '../../window/IWindow.js';
import Node from '../node/Node.js';
import NodeIterator from '../../tree-walker/NodeIterator.js';
import TreeWalker from '../../tree-walker/TreeWalker.js';
import DocumentFragment from '../document-fragment/DocumentFragment.js';
import XMLParser from '../../xml-parser/XMLParser.js';
import Event from '../../event/Event.js';
import DOMImplementation from '../../dom-implementation/DOMImplementation.js';
import ElementTag from '../../config/ElementTag.js';
import INodeFilter from '../../tree-walker/INodeFilter.js';
import Attr from '../attr/Attr.js';
import NamespaceURI from '../../config/NamespaceURI.js';
import DocumentType from '../document-type/DocumentType.js';
import ParentNodeUtility from '../parent-node/ParentNodeUtility.js';
import QuerySelector from '../../query-selector/QuerySelector.js';
import IDocument from './IDocument.js';
import CSSStyleSheet from '../../css/CSSStyleSheet.js';
import DOMException from '../../exception/DOMException.js';
import CookieJar from '../../cookie/CookieJar.js';
import IElement from '../element/IElement.js';
import IHTMLScriptElement from '../html-script-element/IHTMLScriptElement.js';
import IHTMLElement from '../html-element/IHTMLElement.js';
import IDocumentType from '../document-type/IDocumentType.js';
import INode from '../node/INode.js';
import IComment from '../comment/IComment.js';
import IText from '../text/IText.js';
import IDocumentFragment from '../document-fragment/IDocumentFragment.js';
import INodeList from '../node/INodeList.js';
import NodeList from '../node/NodeList.js';
import IHTMLCollection from '../element/IHTMLCollection.js';
import IHTMLLinkElement from '../html-link-element/IHTMLLinkElement.js';
import IHTMLStyleElement from '../html-style-element/IHTMLStyleElement.js';
import DocumentReadyStateEnum from './DocumentReadyStateEnum.js';
import DocumentReadyStateManager from './DocumentReadyStateManager.js';
import Location from '../../location/Location.js';
import Selection from '../../selection/Selection.js';
import IShadowRoot from '../shadow-root/IShadowRoot.js';
import Range from '../../range/Range.js';
import IHTMLBaseElement from '../html-base-element/IHTMLBaseElement.js';
import IAttr from '../attr/IAttr.js';
import IProcessingInstruction from '../processing-instruction/IProcessingInstruction.js';
import ProcessingInstruction from '../processing-instruction/ProcessingInstruction.js';
import ElementUtility from '../element/ElementUtility.js';
import HTMLCollection from '../element/HTMLCollection.js';
import VisibilityStateEnum from './VisibilityStateEnum.js';
import NodeTypeEnum from '../node/NodeTypeEnum.js';

const PROCESSING_INSTRUCTION_TARGET_REGEXP = /^[a-z][a-z0-9-]+$/;

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IWindow from '../../window/IWindow';
import IWindow from '../../window/IWindow.js';

/**
* Document ready state manager.
52 changes: 26 additions & 26 deletions packages/happy-dom/src/nodes/document/IDocument.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import IElement from '../element/IElement';
import IHTMLElement from '../html-element/IHTMLElement';
import IWindow from '../../window/IWindow';
import NodeIterator from '../../tree-walker/NodeIterator';
import TreeWalker from '../../tree-walker/TreeWalker';
import Event from '../../event/Event';
import DOMImplementation from '../../dom-implementation/DOMImplementation';
import INodeFilter from '../../tree-walker/INodeFilter';
import IAttr from '../attr/IAttr';
import IDocumentType from '../document-type/IDocumentType';
import IParentNode from '../parent-node/IParentNode';
import INode from '../node/INode';
import ICharacterData from '../character-data/ICharacterData';
import IDocumentFragment from '../document-fragment/IDocumentFragment';
import Selection from '../../selection/Selection';
import IHTMLCollection from '../element/IHTMLCollection';
import IHTMLScriptElement from '../html-script-element/IHTMLScriptElement';
import CSSStyleSheet from '../../css/CSSStyleSheet';
import Location from '../../location/Location';
import DocumentReadyStateEnum from './DocumentReadyStateEnum';
import INodeList from '../node/INodeList';
import Range from '../../range/Range';
import IProcessingInstruction from '../processing-instruction/IProcessingInstruction';
import VisibilityStateEnum from './VisibilityStateEnum';
import IElement from '../element/IElement.js';
import IHTMLElement from '../html-element/IHTMLElement.js';
import IWindow from '../../window/IWindow.js';
import NodeIterator from '../../tree-walker/NodeIterator.js';
import TreeWalker from '../../tree-walker/TreeWalker.js';
import Event from '../../event/Event.js';
import DOMImplementation from '../../dom-implementation/DOMImplementation.js';
import INodeFilter from '../../tree-walker/INodeFilter.js';
import IAttr from '../attr/IAttr.js';
import IDocumentType from '../document-type/IDocumentType.js';
import IParentNode from '../parent-node/IParentNode.js';
import INode from '../node/INode.js';
import ICharacterData from '../character-data/ICharacterData.js';
import IDocumentFragment from '../document-fragment/IDocumentFragment.js';
import Selection from '../../selection/Selection.js';
import IHTMLCollection from '../element/IHTMLCollection.js';
import IHTMLScriptElement from '../html-script-element/IHTMLScriptElement.js';
import CSSStyleSheet from '../../css/CSSStyleSheet.js';
import Location from '../../location/Location.js';
import DocumentReadyStateEnum from './DocumentReadyStateEnum.js';
import INodeList from '../node/INodeList.js';
import Range from '../../range/Range.js';
import IProcessingInstruction from '../processing-instruction/IProcessingInstruction.js';
import VisibilityStateEnum from './VisibilityStateEnum.js';

/**
* Document.
@@ -227,7 +227,7 @@ export default interface IDocument extends IParentNode {
* @param [whatToShow] What to show.
* @param [filter] Filter.
*/
createNodeIterator(root: INode, whatToShow: number, filter: INodeFilter): NodeIterator;
createNodeIterator(root: INode, whatToShow?: number, filter?: INodeFilter): NodeIterator;

/**
* Creates a Tree Walker.
@@ -236,7 +236,7 @@ export default interface IDocument extends IParentNode {
* @param [whatToShow] What to show.
* @param [filter] Filter.
*/
createTreeWalker(root: INode, whatToShow: number, filter: INodeFilter): TreeWalker;
createTreeWalker(root: INode, whatToShow?: number, filter?: INodeFilter): TreeWalker;

/**
* Creates an event.
4 changes: 2 additions & 2 deletions packages/happy-dom/src/nodes/element/DOMRectListFactory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import DOMRect from './DOMRect';
import IDOMRectList from './IDOMRectList';
import DOMRect from './DOMRect.js';
import IDOMRectList from './IDOMRectList.js';

/**
* DOM rect list factory.
2 changes: 1 addition & 1 deletion packages/happy-dom/src/nodes/element/Dataset.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Element from '../element/Element';
import Element from '../element/Element.js';

/**
* Storage type for a dataset proxy.
76 changes: 38 additions & 38 deletions packages/happy-dom/src/nodes/element/Element.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
import Node from '../node/Node';
import ShadowRoot from '../shadow-root/ShadowRoot';
import Attr from '../attr/Attr';
import NamedNodeMap from '../../named-node-map/NamedNodeMap';
import DOMRect from './DOMRect';
import DOMTokenList from '../../dom-token-list/DOMTokenList';
import IDOMTokenList from '../../dom-token-list/IDOMTokenList';
import QuerySelector from '../../query-selector/QuerySelector';
import MutationRecord from '../../mutation-observer/MutationRecord';
import MutationTypeEnum from '../../mutation-observer/MutationTypeEnum';
import NamespaceURI from '../../config/NamespaceURI';
import XMLParser from '../../xml-parser/XMLParser';
import XMLSerializer from '../../xml-serializer/XMLSerializer';
import ChildNodeUtility from '../child-node/ChildNodeUtility';
import ParentNodeUtility from '../parent-node/ParentNodeUtility';
import NonDocumentChildNodeUtility from '../child-node/NonDocumentChildNodeUtility';
import IElement from './IElement';
import DOMException from '../../exception/DOMException';
import IShadowRoot from '../shadow-root/IShadowRoot';
import INode from '../node/INode';
import IDocument from '../document/IDocument';
import IHTMLCollection from './IHTMLCollection';
import INodeList from '../node/INodeList';
import { TInsertAdjacentPositions } from './IElement';
import IText from '../text/IText';
import IDOMRectList from './IDOMRectList';
import DOMRectListFactory from './DOMRectListFactory';
import IAttr from '../attr/IAttr';
import INamedNodeMap from '../../named-node-map/INamedNodeMap';
import Event from '../../event/Event';
import ElementUtility from './ElementUtility';
import HTMLCollection from './HTMLCollection';
import EventPhaseEnum from '../../event/EventPhaseEnum';
import CSSStyleDeclaration from '../../css/declaration/CSSStyleDeclaration';
import Node from '../node/Node.js';
import ShadowRoot from '../shadow-root/ShadowRoot.js';
import Attr from '../attr/Attr.js';
import NamedNodeMap from '../../named-node-map/NamedNodeMap.js';
import DOMRect from './DOMRect.js';
import DOMTokenList from '../../dom-token-list/DOMTokenList.js';
import IDOMTokenList from '../../dom-token-list/IDOMTokenList.js';
import QuerySelector from '../../query-selector/QuerySelector.js';
import MutationRecord from '../../mutation-observer/MutationRecord.js';
import MutationTypeEnum from '../../mutation-observer/MutationTypeEnum.js';
import NamespaceURI from '../../config/NamespaceURI.js';
import XMLParser from '../../xml-parser/XMLParser.js';
import XMLSerializer from '../../xml-serializer/XMLSerializer.js';
import ChildNodeUtility from '../child-node/ChildNodeUtility.js';
import ParentNodeUtility from '../parent-node/ParentNodeUtility.js';
import NonDocumentChildNodeUtility from '../child-node/NonDocumentChildNodeUtility.js';
import IElement from './IElement.js';
import DOMException from '../../exception/DOMException.js';
import IShadowRoot from '../shadow-root/IShadowRoot.js';
import INode from '../node/INode.js';
import IDocument from '../document/IDocument.js';
import IHTMLCollection from './IHTMLCollection.js';
import INodeList from '../node/INodeList.js';
import { TInsertAdjacentPositions } from './IElement.js';
import IText from '../text/IText.js';
import IDOMRectList from './IDOMRectList.js';
import DOMRectListFactory from './DOMRectListFactory.js';
import IAttr from '../attr/IAttr.js';
import INamedNodeMap from '../../named-node-map/INamedNodeMap.js';
import Event from '../../event/Event.js';
import ElementUtility from './ElementUtility.js';
import HTMLCollection from './HTMLCollection.js';
import EventPhaseEnum from '../../event/EventPhaseEnum.js';
import CSSStyleDeclaration from '../../css/declaration/CSSStyleDeclaration.js';

/**
* Element.
@@ -609,7 +609,7 @@ export default class Element extends Node implements IElement {
* @param namespace Namespace URI.
* @param localName Local name.
*/
public getAttributeNS(namespace: string, localName: string): string {
public getAttributeNS(namespace: string | null, localName: string): string {
const attribute = this.getAttributeNodeNS(namespace, localName);
if (attribute) {
return attribute.value;
@@ -634,7 +634,7 @@ export default class Element extends Node implements IElement {
* @param localName Local name.
* @returns True if attribute exists, false otherwise.
*/
public hasAttributeNS(namespace: string, localName: string): boolean {
public hasAttributeNS(namespace: string | null, localName: string): boolean {
for (const name of Object.keys(this._attributes)) {
const attribute = this._attributes[name];
if (attribute.namespaceURI === namespace && attribute.localName === localName) {
@@ -671,7 +671,7 @@ export default class Element extends Node implements IElement {
* @param namespace Namespace URI.
* @param localName Local name.
*/
public removeAttributeNS(namespace: string, localName: string): void {
public removeAttributeNS(namespace: string | null, localName: string): void {
for (const name of Object.keys(this._attributes)) {
const attribute = this._attributes[name];
if (attribute.namespaceURI === namespace && attribute.localName === localName) {
@@ -914,7 +914,7 @@ export default class Element extends Node implements IElement {
* @param name Name.
* @returns Replaced attribute.
*/
public getAttributeNodeNS(namespace: string, name: string): IAttr {
public getAttributeNodeNS(namespace: string | null, name: string): IAttr {
const attributeName = this._getAttributeName(name);
if (
this._attributes[attributeName] &&
22 changes: 11 additions & 11 deletions packages/happy-dom/src/nodes/element/ElementUtility.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import NodeTypeEnum from '../node/NodeTypeEnum';
import IElement from './IElement';
import INode from '../node/INode';
import HTMLCollection from './HTMLCollection';
import IDocument from '../document/IDocument';
import IDocumentFragment from '../document-fragment/IDocumentFragment';
import IHTMLElement from '../html-element/IHTMLElement';
import Element from './Element';
import NodeUtility from '../node/NodeUtility';
import DOMException from '../../exception/DOMException';
import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum';
import NodeTypeEnum from '../node/NodeTypeEnum.js';
import IElement from './IElement.js';
import INode from '../node/INode.js';
import HTMLCollection from './HTMLCollection.js';
import IDocument from '../document/IDocument.js';
import IDocumentFragment from '../document-fragment/IDocumentFragment.js';
import IHTMLElement from '../html-element/IHTMLElement.js';
import Element from './Element.js';
import NodeUtility from '../node/NodeUtility.js';
import DOMException from '../../exception/DOMException.js';
import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum.js';

const NAMED_ITEM_ATTRIBUTES = ['id', 'name'];

2 changes: 1 addition & 1 deletion packages/happy-dom/src/nodes/element/HTMLCollection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IHTMLCollection from './IHTMLCollection';
import IHTMLCollection from './IHTMLCollection.js';

/**
* HTML collection.
32 changes: 16 additions & 16 deletions packages/happy-dom/src/nodes/element/IElement.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import IShadowRoot from '../shadow-root/IShadowRoot';
import IAttr from '../attr/IAttr';
import INamedNodeMap from '../../named-node-map/INamedNodeMap';
import DOMRect from './DOMRect';
import IDOMTokenList from '../../dom-token-list/IDOMTokenList';
import INode from './../node/INode';
import IChildNode from '../child-node/IChildNode';
import IParentNode from '../parent-node/IParentNode';
import INonDocumentTypeChildNode from '../child-node/INonDocumentTypeChildNode';
import IDOMRectList from './IDOMRectList';
import Event from '../../event/Event';
import IShadowRoot from '../shadow-root/IShadowRoot.js';
import IAttr from '../attr/IAttr.js';
import INamedNodeMap from '../../named-node-map/INamedNodeMap.js';
import DOMRect from './DOMRect.js';
import IDOMTokenList from '../../dom-token-list/IDOMTokenList.js';
import INode from './../node/INode.js';
import IChildNode from '../child-node/IChildNode.js';
import IParentNode from '../parent-node/IParentNode.js';
import INonDocumentTypeChildNode from '../child-node/INonDocumentTypeChildNode.js';
import IDOMRectList from './IDOMRectList.js';
import Event from '../../event/Event.js';

export type TInsertAdjacentPositions = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend';

@@ -106,7 +106,7 @@ export default interface IElement extends IChildNode, INonDocumentTypeChildNode,
* @param name Name.
* @param value Value.
*/
setAttributeNS(namespaceURI: string, name: string, value: string): void;
setAttributeNS(namespaceURI: string | null, name: string, value: string): void;

/**
* Returns attribute names.
@@ -128,7 +128,7 @@ export default interface IElement extends IChildNode, INonDocumentTypeChildNode,
* @param namespace Namespace URI.
* @param localName Local name.
*/
getAttributeNS(namespace: string, localName: string): string;
getAttributeNS(namespace: string | null, localName: string): string;

/**
* Returns a boolean value indicating whether the specified element has the attribute or not.
@@ -145,7 +145,7 @@ export default interface IElement extends IChildNode, INonDocumentTypeChildNode,
* @param localName Local name.
* @returns True if attribute exists, false otherwise.
*/
hasAttributeNS(namespace: string, localName: string): boolean;
hasAttributeNS(namespace: string | null, localName: string): boolean;

/**
* Returns "true" if the element has attributes.
@@ -167,7 +167,7 @@ export default interface IElement extends IChildNode, INonDocumentTypeChildNode,
* @param namespace Namespace URI.
* @param localName Local name.
*/
removeAttributeNS(namespace: string, localName: string): void;
removeAttributeNS(namespace: string | null, localName: string): void;

/**
* Toggle an attribute.
@@ -263,7 +263,7 @@ export default interface IElement extends IChildNode, INonDocumentTypeChildNode,
* @param nodeName Node name.
* @returns Replaced attribute.
*/
getAttributeNodeNS(namespace: string, nodeName: string): IAttr;
getAttributeNodeNS(namespace: string | null, nodeName: string): IAttr;

/**
* Removes an Attr node.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import HTMLElement from '../html-element/HTMLElement';
import DOMTokenList from '../../dom-token-list/DOMTokenList';
import IDOMTokenList from '../../dom-token-list/IDOMTokenList';
import IHTMLAnchorElement from './IHTMLAnchorElement';
import HTMLElement from '../html-element/HTMLElement.js';
import DOMTokenList from '../../dom-token-list/DOMTokenList.js';
import IDOMTokenList from '../../dom-token-list/IDOMTokenList.js';
import IHTMLAnchorElement from './IHTMLAnchorElement.js';
import { URL } from 'url';
import IAttr from '../attr/IAttr';
import HTMLAnchorElementUtility from './HTMLAnchorElementUtility';
import IAttr from '../attr/IAttr.js';
import HTMLAnchorElementUtility from './HTMLAnchorElementUtility.js';

/**
* HTML Anchor Element.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IDocument from '../document/IDocument';
import IDocument from '../document/IDocument.js';
import { URL } from 'url';

/**
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import IDOMTokenList from '../../dom-token-list/IDOMTokenList';
import IHTMLElement from '../html-element/IHTMLElement';
import IHTMLHyperlinkElementUtils from './IHTMLHyperlinkElementUtils';
import IDOMTokenList from '../../dom-token-list/IDOMTokenList.js';
import IHTMLElement from '../html-element/IHTMLElement.js';
import IHTMLHyperlinkElementUtils from './IHTMLHyperlinkElementUtils.js';

/**
* HTML Anchor Element.
2 changes: 1 addition & 1 deletion packages/happy-dom/src/nodes/html-audio-element/Audio.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import HTMLAudioElement from './HTMLAudioElement';
import HTMLAudioElement from './HTMLAudioElement.js';

/**
* Image as constructor.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import HTMLMediaElement from '../html-media-element/HTMLMediaElement';
import IHTMLAudioElement from './IHTMLAudioElement';
import HTMLMediaElement from '../html-media-element/HTMLMediaElement.js';
import IHTMLAudioElement from './IHTMLAudioElement.js';

/**
* HTML Audio Element.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IHTMLMediaElement from '../html-media-element/IHTMLMediaElement';
import IHTMLMediaElement from '../html-media-element/IHTMLMediaElement.js';

/**
* HTML Audio Element.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import HTMLElement from '../html-element/HTMLElement';
import IHTMLBaseElement from './IHTMLBaseElement';
import HTMLElement from '../html-element/HTMLElement.js';
import IHTMLBaseElement from './IHTMLBaseElement.js';

/**
* HTML Base Element.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IHTMLElement from '../html-element/IHTMLElement';
import IHTMLElement from '../html-element/IHTMLElement.js';

/**
* HTML Base Element.
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import Event from '../../event/Event';
import EventPhaseEnum from '../../event/EventPhaseEnum';
import ValidityState from '../../validity-state/ValidityState';
import IAttr from '../attr/IAttr';
import IDocument from '../document/IDocument';
import HTMLElement from '../html-element/HTMLElement';
import HTMLFormElement from '../html-form-element/HTMLFormElement';
import IHTMLFormElement from '../html-form-element/IHTMLFormElement';
import IHTMLLabelElement from '../html-label-element/IHTMLLabelElement';
import INode from '../node/INode';
import INodeList from '../node/INodeList';
import NodeList from '../node/NodeList';
import IShadowRoot from '../shadow-root/IShadowRoot';
import IHTMLButtonElement from './IHTMLButtonElement';
import Event from '../../event/Event.js';
import EventPhaseEnum from '../../event/EventPhaseEnum.js';
import ValidityState from '../../validity-state/ValidityState.js';
import IAttr from '../attr/IAttr.js';
import IDocument from '../document/IDocument.js';
import HTMLElement from '../html-element/HTMLElement.js';
import HTMLFormElement from '../html-form-element/HTMLFormElement.js';
import IHTMLFormElement from '../html-form-element/IHTMLFormElement.js';
import IHTMLLabelElement from '../html-label-element/IHTMLLabelElement.js';
import INode from '../node/INode.js';
import INodeList from '../node/INodeList.js';
import NodeList from '../node/NodeList.js';
import IShadowRoot from '../shadow-root/IShadowRoot.js';
import IHTMLButtonElement from './IHTMLButtonElement.js';

const BUTTON_TYPES = ['submit', 'reset', 'button', 'menu'];

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import ValidityState from '../../validity-state/ValidityState';
import IHTMLElement from '../html-element/IHTMLElement';
import IHTMLFormElement from '../html-form-element/IHTMLFormElement';
import IHTMLLabelElement from '../html-label-element/IHTMLLabelElement';
import INodeList from '../node/INodeList';
import ValidityState from '../../validity-state/ValidityState.js';
import IHTMLElement from '../html-element/IHTMLElement.js';
import IHTMLFormElement from '../html-form-element/IHTMLFormElement.js';
import IHTMLLabelElement from '../html-label-element/IHTMLLabelElement.js';
import INodeList from '../node/INodeList.js';

/**
* HTML Button Element.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Event from '../../event/Event';
import HTMLElement from '../html-element/HTMLElement';
import IHTMLDialogElement from './IHTMLDialogElement';
import Event from '../../event/Event.js';
import HTMLElement from '../html-element/HTMLElement.js';
import IHTMLDialogElement from './IHTMLDialogElement.js';

/**
* HTML Dialog Element.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Event from '../../event/Event';
import IHTMLElement from '../html-element/IHTMLElement';
import Event from '../../event/Event.js';
import IHTMLElement from '../html-element/IHTMLElement.js';

/**
* HTML Dialog Element.
2 changes: 1 addition & 1 deletion packages/happy-dom/src/nodes/html-document/HTMLDocument.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Document from '../document/Document';
import Document from '../document/Document.js';

/**
* Document.
Loading