Skip to content

Commit 750785f

Browse files
committed
initial commit
0 parents  commit 750785f

29 files changed

+4476
-0
lines changed

.eslintrc.json

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/recommended"
9+
],
10+
"parser": "@typescript-eslint/parser",
11+
"parserOptions": {
12+
"ecmaVersion": 2020,
13+
"sourceType": "module"
14+
},
15+
"plugins": [
16+
"@typescript-eslint"
17+
],
18+
"rules": {
19+
"indent": [
20+
"error",
21+
4
22+
],
23+
"linebreak-style": [
24+
"error",
25+
"unix"
26+
],
27+
"quotes": [
28+
"error",
29+
"double"
30+
],
31+
"semi": [
32+
"error",
33+
"always"
34+
]
35+
},
36+
"ecmaFeatures": {
37+
"arrowFunctions": true,
38+
"blockBindings": true,
39+
"forOf": true,
40+
"modules": true
41+
},
42+
"ignorePatterns": [
43+
"/node_modules",
44+
"*.js"
45+
]
46+
}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+

.vscode/extensions.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint"
4+
]
5+
}

.vscode/launch.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "pwa-node",
9+
"request": "launch",
10+
"name": "Run tests",
11+
"skipFiles": [
12+
"<node_internals>/**"
13+
],
14+
"program": "${workspaceFolder}\\test.js",
15+
"outFiles": [
16+
"${workspaceFolder}/*.js"
17+
]
18+
}
19+
]
20+
}

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"typescript.tsdk": "node_modules\\typescript\\lib"
3+
}

README.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# fallback-dom
2+
3+
A lightweight standalone partial DOM implementation written in TypeScript. This could be useful for tests and other scenarios where a DOM is required but not available per default.
4+
5+
This package has three module files available for use:
6+
- `fallback-dom` (has a dependency on `query-selector`.)
7+
- `query-selector`
8+
- `xml-serializer`
9+
10+
This repo contains pre-built JS files to be able to be used as a git dependency without extra build steps. The only real source files are the ones matching `./*.ts`.
11+
12+
## Module: fallback-dom
13+
14+
Main module that exposes the partial DOM implementation.
15+
16+
Imports:
17+
```js
18+
import { querySel } from "./query-selector.js";
19+
```
20+
21+
Base classes (should never be extended or initialized):
22+
```js
23+
export { CDATASection, Comment, DocumentType, Element, Node, ProcessingInstruction, Text };
24+
```
25+
26+
Functions:
27+
```js
28+
export { createDocument, createDocumentType, createHTMLDocument };
29+
```
30+
31+
32+
## Module: query-selector
33+
34+
Helper module that applies a subset of CSS selectors to find matching elements.
35+
36+
Functions:
37+
```js
38+
export { querySel };
39+
```
40+
41+
42+
## Module: xml-serializer
43+
44+
Extension module that can be used to serialize the DOM to a string.
45+
46+
Functions:
47+
```js
48+
export { serializeToString };
49+
```

fallback-dom.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)