pseudo-dom 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +971 -3
- package/browser/pseudo-dom.js +1141 -470
- package/browser/pseudo-dom.min.js +1 -1
- package/dist/classes/PseudoHTMLDocument.d.ts +41 -41
- package/dist/classes/PseudoHTMLDocument.js +74 -74
- package/dist/factories/createDataset.d.ts +10 -0
- package/dist/factories/createDataset.js +78 -0
- package/dist/factories/createDataset.min.js +1 -0
- package/dist/factories/createStyleDeclaration.d.ts +30 -0
- package/dist/factories/createStyleDeclaration.js +64 -0
- package/dist/factories/createStyleDeclaration.min.js +1 -0
- package/dist/functions/getElementById.d.ts +13 -13
- package/dist/functions/getElementById.js +33 -33
- package/dist/interfaces/PseudoCSSStyleDeclaration.d.ts +14 -0
- package/dist/interfaces/PseudoCSSStyleDeclaration.js +5 -0
- package/dist/interfaces/PseudoCSSStyleDeclaration.min.js +1 -0
- package/dist/interfaces/PseudoDocument.d.ts +35 -35
- package/dist/interfaces/PseudoDocumentFragment.d.ts +10 -10
- package/dist/interfaces/PseudoElement.d.ts +765 -702
- package/dist/interfaces/PseudoHTMLElement.d.ts +12 -1
- package/dist/interfaces/PseudoShadowRoot.d.ts +12 -3
- package/dist/services/CSSStyleDeclarationService.d.ts +73 -0
- package/dist/services/CSSStyleDeclarationService.js +156 -0
- package/dist/services/CSSStyleDeclarationService.min.js +1 -0
- package/dist/services/DocumentFragmentService.d.ts +21 -21
- package/dist/services/DocumentFragmentService.js +42 -42
- package/dist/services/DocumentService.d.ts +46 -46
- package/dist/services/DocumentService.js +95 -95
- package/dist/services/ElementService.d.ts +361 -191
- package/dist/services/ElementService.js +717 -426
- package/dist/services/ElementService.min.js +1 -1
- package/dist/services/HTMLElementService.d.ts +31 -1
- package/dist/services/HTMLElementService.js +43 -4
- package/dist/services/HTMLElementService.min.js +1 -1
- package/dist/services/NodeService.d.ts +305 -297
- package/dist/services/NodeService.js +732 -721
- package/dist/services/NodeService.min.js +1 -1
- package/dist/services/ShadowRootService.d.ts +16 -4
- package/dist/services/ShadowRootService.js +24 -9
- package/dist/services/ShadowRootService.min.js +1 -1
- package/package.json +1 -1
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
4
|
-
return mod && mod.__esModule
|
|
5
|
-
? mod
|
|
6
|
-
: {
|
|
7
|
-
default: mod
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
Object.defineProperty(exports, '__esModule', {
|
|
11
|
-
value: true
|
|
12
|
-
})
|
|
13
|
-
exports.DocumentService = void 0
|
|
14
|
-
const NodeService_1 = require('./NodeService')
|
|
15
|
-
const HTMLElementService_1 = require('./HTMLElementService')
|
|
16
|
-
const DocumentFragmentService_1 = require('./DocumentFragmentService')
|
|
17
|
-
const getElementById_1 = __importDefault(require('../functions/getElementById'))
|
|
18
|
-
/**
|
|
19
|
-
* Simulate the behaviour of the Document Class when there is no DOM available.
|
|
20
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
21
|
-
* @class
|
|
22
|
-
* @augments NodeService
|
|
23
|
-
*/
|
|
24
|
-
class DocumentService extends NodeService_1.NodeService {
|
|
25
|
-
get nodeName () {
|
|
26
|
-
return '#document'
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
get nodeType () {
|
|
30
|
-
return NodeService_1.NodeService.DOCUMENT_NODE
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// A document has no text of its own, and setting it does nothing
|
|
34
|
-
get textContent () {
|
|
35
|
-
return null
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
set textContent (text) {}
|
|
39
|
-
/**
|
|
40
|
-
* The first element, in tree order, whose id matches the given value, or null when there is none.
|
|
41
|
-
* @param {string} id
|
|
42
|
-
* @returns {PseudoElement|null}
|
|
43
|
-
*/
|
|
44
|
-
getElementById (id) {
|
|
45
|
-
return (0, getElementById_1.default)(this, id)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Make an element of the given type which belongs to this document but is not added anywhere until it is appended.
|
|
50
|
-
* @param {string} [tagName='div'] The type of element to create
|
|
51
|
-
* @returns {PseudoElement}
|
|
52
|
-
*/
|
|
53
|
-
createElement (tagName = 'div') {
|
|
54
|
-
// Like the DOM, the new element is not added anywhere: it has no parent until it is appended
|
|
55
|
-
const element = new HTMLElementService_1.HTMLElementService({
|
|
56
|
-
tagName
|
|
57
|
-
})
|
|
58
|
-
element.ownerDocumentStore = this
|
|
59
|
-
return element
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Make a text node which belongs to this document.
|
|
64
|
-
* @param {string} [data=''] The text
|
|
65
|
-
* @returns {TextService}
|
|
66
|
-
*/
|
|
67
|
-
createTextNode (data = '') {
|
|
68
|
-
const text = new NodeService_1.TextService(data)
|
|
69
|
-
text.ownerDocumentStore = this
|
|
70
|
-
return text
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Make a comment which belongs to this document.
|
|
75
|
-
* @param {string} [data=''] The comment
|
|
76
|
-
* @returns {CommentService}
|
|
77
|
-
*/
|
|
78
|
-
createComment (data = '') {
|
|
79
|
-
const comment = new NodeService_1.CommentService(data)
|
|
80
|
-
comment.ownerDocumentStore = this
|
|
81
|
-
return comment
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Make an empty document fragment which belongs to this document, a container for nodes which can be built up and
|
|
86
|
-
* then inserted in one go.
|
|
87
|
-
* @returns {DocumentFragmentService}
|
|
88
|
-
*/
|
|
89
|
-
createDocumentFragment () {
|
|
90
|
-
const fragment = new DocumentFragmentService_1.DocumentFragmentService()
|
|
91
|
-
fragment.ownerDocumentStore = this
|
|
92
|
-
return fragment
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
exports.DocumentService = DocumentService
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
4
|
+
return mod && mod.__esModule
|
|
5
|
+
? mod
|
|
6
|
+
: {
|
|
7
|
+
default: mod
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(exports, '__esModule', {
|
|
11
|
+
value: true
|
|
12
|
+
})
|
|
13
|
+
exports.DocumentService = void 0
|
|
14
|
+
const NodeService_1 = require('./NodeService')
|
|
15
|
+
const HTMLElementService_1 = require('./HTMLElementService')
|
|
16
|
+
const DocumentFragmentService_1 = require('./DocumentFragmentService')
|
|
17
|
+
const getElementById_1 = __importDefault(require('../functions/getElementById'))
|
|
18
|
+
/**
|
|
19
|
+
* Simulate the behaviour of the Document Class when there is no DOM available.
|
|
20
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
21
|
+
* @class
|
|
22
|
+
* @augments NodeService
|
|
23
|
+
*/
|
|
24
|
+
class DocumentService extends NodeService_1.NodeService {
|
|
25
|
+
get nodeName () {
|
|
26
|
+
return '#document'
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
get nodeType () {
|
|
30
|
+
return NodeService_1.NodeService.DOCUMENT_NODE
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// A document has no text of its own, and setting it does nothing
|
|
34
|
+
get textContent () {
|
|
35
|
+
return null
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
set textContent (text) {}
|
|
39
|
+
/**
|
|
40
|
+
* The first element, in tree order, whose id matches the given value, or null when there is none.
|
|
41
|
+
* @param {string} id
|
|
42
|
+
* @returns {PseudoElement|null}
|
|
43
|
+
*/
|
|
44
|
+
getElementById (id) {
|
|
45
|
+
return (0, getElementById_1.default)(this, id)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Make an element of the given type which belongs to this document but is not added anywhere until it is appended.
|
|
50
|
+
* @param {string} [tagName='div'] The type of element to create
|
|
51
|
+
* @returns {PseudoElement}
|
|
52
|
+
*/
|
|
53
|
+
createElement (tagName = 'div') {
|
|
54
|
+
// Like the DOM, the new element is not added anywhere: it has no parent until it is appended
|
|
55
|
+
const element = new HTMLElementService_1.HTMLElementService({
|
|
56
|
+
tagName
|
|
57
|
+
})
|
|
58
|
+
element.ownerDocumentStore = this
|
|
59
|
+
return element
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Make a text node which belongs to this document.
|
|
64
|
+
* @param {string} [data=''] The text
|
|
65
|
+
* @returns {TextService}
|
|
66
|
+
*/
|
|
67
|
+
createTextNode (data = '') {
|
|
68
|
+
const text = new NodeService_1.TextService(data)
|
|
69
|
+
text.ownerDocumentStore = this
|
|
70
|
+
return text
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Make a comment which belongs to this document.
|
|
75
|
+
* @param {string} [data=''] The comment
|
|
76
|
+
* @returns {CommentService}
|
|
77
|
+
*/
|
|
78
|
+
createComment (data = '') {
|
|
79
|
+
const comment = new NodeService_1.CommentService(data)
|
|
80
|
+
comment.ownerDocumentStore = this
|
|
81
|
+
return comment
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Make an empty document fragment which belongs to this document, a container for nodes which can be built up and
|
|
86
|
+
* then inserted in one go.
|
|
87
|
+
* @returns {DocumentFragmentService}
|
|
88
|
+
*/
|
|
89
|
+
createDocumentFragment () {
|
|
90
|
+
const fragment = new DocumentFragmentService_1.DocumentFragmentService()
|
|
91
|
+
fragment.ownerDocumentStore = this
|
|
92
|
+
return fragment
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.DocumentService = DocumentService
|