pseudo-dom 0.17.0 → 1.0.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 +63 -5869
- package/browser/pseudo-dom.js +14889 -15288
- package/dist/classes/PseudoEventListener.d.ts +11 -37
- package/dist/classes/PseudoEventListener.js +11 -37
- package/dist/classes/PseudoHTMLDocument.d.ts +4 -12
- package/dist/classes/PseudoHTMLDocument.js +1 -11
- package/dist/classes/PseudoNodeList.d.ts +1 -9
- package/dist/classes/PseudoNodeList.js +1 -9
- package/dist/factories/createDataset.d.ts +1 -3
- package/dist/factories/createDataset.js +3 -8
- package/dist/factories/createEvent.d.ts +5 -9
- package/dist/factories/createEvent.js +3 -5
- package/dist/factories/createStyleDeclaration.d.ts +4 -10
- package/dist/factories/createStyleDeclaration.js +4 -10
- package/dist/factories/cssSelectAdapter.d.ts +0 -2
- package/dist/factories/cssSelectAdapter.js +3 -8
- package/dist/factories/eventDefaults.d.ts +5 -9
- package/dist/factories/eventDefaults.js +1 -4
- package/dist/factories/generateDocument.d.ts +2 -4
- package/dist/factories/generateDocument.js +2 -13
- package/dist/factories/generateNodeList.d.ts +1 -2
- package/dist/factories/generateNodeList.js +1 -2
- package/dist/factories/installGlobal.d.ts +2 -3
- package/dist/factories/installGlobal.js +3 -6
- package/dist/factories/logElement.d.ts +2 -4
- package/dist/factories/logElement.js +3 -7
- package/dist/factories/parseHTML.d.ts +3 -5
- package/dist/factories/parseHTML.js +4 -8
- package/dist/factories/query.d.ts +8 -16
- package/dist/factories/query.js +9 -19
- package/dist/factories/serializeHTML.d.ts +4 -10
- package/dist/factories/serializeHTML.js +12 -25
- package/dist/functions/activeElement.d.ts +3 -6
- package/dist/functions/activeElement.js +3 -6
- package/dist/functions/getElementById.d.ts +2 -4
- package/dist/functions/getElementById.js +2 -4
- package/dist/functions/getParentNodes.d.ts +1 -3
- package/dist/functions/getParentNodes.js +1 -3
- package/dist/functions/getParentNodesFromAttribute.d.ts +3 -5
- package/dist/functions/getParentNodesFromAttribute.js +3 -5
- package/dist/functions/modifierState.d.ts +3 -12
- package/dist/functions/modifierState.js +3 -7
- package/dist/interfaces/PseudoCSSStyleDeclaration.d.ts +1 -1
- package/dist/interfaces/PseudoDocument.d.ts +4 -9
- package/dist/interfaces/PseudoDocumentFragment.d.ts +1 -2
- package/dist/interfaces/PseudoElement.d.ts +39 -78
- package/dist/interfaces/PseudoEvent.d.ts +11 -43
- package/dist/interfaces/PseudoEvent.js +1 -3
- package/dist/interfaces/PseudoEventTarget.d.ts +7 -16
- package/dist/interfaces/PseudoHTMLCollection.d.ts +2 -4
- package/dist/interfaces/PseudoHTMLElement.d.ts +8 -13
- package/dist/interfaces/PseudoNode.d.ts +3 -13
- package/dist/main.d.ts +1 -6
- package/dist/main.js +1 -6
- package/dist/services/AttrService.d.ts +5 -9
- package/dist/services/AttrService.js +5 -9
- package/dist/services/CSSStyleDeclarationService.d.ts +10 -23
- package/dist/services/CSSStyleDeclarationService.js +10 -23
- package/dist/services/CustomEventService.d.ts +4 -15
- package/dist/services/CustomEventService.js +3 -10
- package/dist/services/DOMTokenListService.d.ts +2 -5
- package/dist/services/DOMTokenListService.js +2 -5
- package/dist/services/DocumentFragmentService.d.ts +1 -5
- package/dist/services/DocumentFragmentService.js +1 -5
- package/dist/services/DocumentService.d.ts +4 -12
- package/dist/services/DocumentService.js +4 -12
- package/dist/services/ElementService.d.ts +62 -120
- package/dist/services/ElementService.js +61 -117
- package/dist/services/EventService.d.ts +6 -44
- package/dist/services/EventService.js +18 -44
- package/dist/services/EventTargetService.d.ts +16 -28
- package/dist/services/EventTargetService.js +16 -28
- package/dist/services/FocusEventService.d.ts +4 -12
- package/dist/services/FocusEventService.js +3 -10
- package/dist/services/HTMLCollectionService.d.ts +6 -16
- package/dist/services/HTMLCollectionService.js +6 -16
- package/dist/services/HTMLElementService.d.ts +132 -154
- package/dist/services/HTMLElementService.js +333 -353
- package/dist/services/InputEventService.d.ts +5 -16
- package/dist/services/InputEventService.js +3 -12
- package/dist/services/KeyboardEventService.d.ts +8 -26
- package/dist/services/KeyboardEventService.js +4 -16
- package/dist/services/MouseEventService.d.ts +7 -30
- package/dist/services/MouseEventService.js +4 -18
- package/dist/services/NamedNodeMapService.d.ts +1 -4
- package/dist/services/NamedNodeMapService.js +1 -4
- package/dist/services/NodeService.d.ts +38 -69
- package/dist/services/NodeService.js +39 -72
- package/dist/services/PointerEventService.d.ts +4 -22
- package/dist/services/PointerEventService.js +3 -15
- package/dist/services/ShadowRootService.d.ts +0 -3
- package/dist/services/ShadowRootService.js +0 -3
- package/dist/services/UIEventService.d.ts +5 -17
- package/dist/services/UIEventService.js +3 -11
- package/dist/simulate.d.ts +7 -9
- package/dist/simulate.js +9 -15
- package/package.json +8 -7
|
@@ -3,9 +3,6 @@ import { PseudoElement } from '../interfaces/PseudoElement';
|
|
|
3
3
|
import { NodeService } from './NodeService';
|
|
4
4
|
/**
|
|
5
5
|
* Simulate the behaviour of the Attr Class when there is no DOM available.
|
|
6
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
7
|
-
* @class
|
|
8
|
-
* @augments NodeService
|
|
9
6
|
*/
|
|
10
7
|
export declare class AttrService extends NodeService implements PseudoAttr {
|
|
11
8
|
value: string;
|
|
@@ -14,12 +11,11 @@ export declare class AttrService extends NodeService implements PseudoAttr {
|
|
|
14
11
|
private readonly namespace;
|
|
15
12
|
private readonly namespacePrefix;
|
|
16
13
|
/**
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @constructor
|
|
14
|
+
* @param name The name of the attribute
|
|
15
|
+
* @param value The value of the attribute
|
|
16
|
+
* @param ownerElement The element which has this attribute
|
|
17
|
+
* @param namespaceURI The namespace of the attribute
|
|
18
|
+
* @param prefix The namespace prefix of the attribute
|
|
23
19
|
*/
|
|
24
20
|
constructor(name?: string, value?: string, ownerElement?: PseudoElement | null, namespaceURI?: string, prefix?: string | null);
|
|
25
21
|
protected get acceptsChildren(): boolean;
|
|
@@ -7,18 +7,14 @@ exports.AttrService = void 0
|
|
|
7
7
|
const NodeService_1 = require('./NodeService')
|
|
8
8
|
/**
|
|
9
9
|
* Simulate the behaviour of the Attr Class when there is no DOM available.
|
|
10
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
11
|
-
* @class
|
|
12
|
-
* @augments NodeService
|
|
13
10
|
*/
|
|
14
11
|
class AttrService extends NodeService_1.NodeService {
|
|
15
12
|
/**
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @constructor
|
|
13
|
+
* @param name The name of the attribute
|
|
14
|
+
* @param value The value of the attribute
|
|
15
|
+
* @param ownerElement The element which has this attribute
|
|
16
|
+
* @param namespaceURI The namespace of the attribute
|
|
17
|
+
* @param prefix The namespace prefix of the attribute
|
|
22
18
|
*/
|
|
23
19
|
constructor (name = '', value = '', ownerElement = null, namespaceURI = '', prefix = null) {
|
|
24
20
|
super()
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
4
|
-
* @version 1.0.0
|
|
2
|
+
* Substitute for the DOM CSSStyleDeclaration Class (the object behind Element.style).
|
|
5
3
|
*/
|
|
6
4
|
/**
|
|
7
5
|
* Simulate the behaviour of the CSSStyleDeclaration Class when there is no DOM available: an ordered map of CSS
|
|
@@ -9,64 +7,53 @@
|
|
|
9
7
|
* given, with no unit conversion, shorthand expansion or validation - this is a data structure, not a real CSS
|
|
10
8
|
* engine. Named property access (declaration.backgroundColor, camelCase) is added on top of this by
|
|
11
9
|
* createStyleDeclaration, which wraps an instance of this class in a Proxy.
|
|
12
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
13
|
-
* @class
|
|
14
10
|
*/
|
|
15
11
|
export declare class CSSStyleDeclarationService {
|
|
16
12
|
private readonly properties;
|
|
17
13
|
/**
|
|
18
|
-
* @param
|
|
19
|
-
* @constructor
|
|
14
|
+
* @param cssText Initial declarations, as CSS text ("color: red; font-size: 12px;")
|
|
20
15
|
*/
|
|
21
16
|
constructor(cssText?: string);
|
|
22
17
|
/**
|
|
23
18
|
* How many properties are currently set.
|
|
24
|
-
* @returns {number}
|
|
25
19
|
*/
|
|
26
20
|
get length(): number;
|
|
27
21
|
/**
|
|
28
22
|
* The name of the property at the given index, in the order it was set, or '' when there is none (matches the
|
|
29
23
|
* DOM's CSSStyleDeclaration, which is array-like).
|
|
30
|
-
* @param
|
|
31
|
-
* @returns {string}
|
|
24
|
+
* @param index
|
|
32
25
|
*/
|
|
33
26
|
item(index: number): string;
|
|
34
27
|
/**
|
|
35
28
|
* The value of the given property, or '' when it is not set.
|
|
36
|
-
* @param
|
|
37
|
-
* @returns {string}
|
|
29
|
+
* @param property A CSS property name (kebab-case, e.g. "background-color")
|
|
38
30
|
*/
|
|
39
31
|
getPropertyValue(property: string): string;
|
|
40
32
|
/**
|
|
41
33
|
* "important" when the property was set with !important, otherwise ''.
|
|
42
|
-
* @param
|
|
43
|
-
* @returns {string}
|
|
34
|
+
* @param property A CSS property name (kebab-case)
|
|
44
35
|
*/
|
|
45
36
|
getPropertyPriority(property: string): string;
|
|
46
37
|
/**
|
|
47
38
|
* Set a property's value (and optionally its priority). An empty, null or undefined value removes the property
|
|
48
39
|
* instead, like the DOM.
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
51
|
-
* @param
|
|
52
|
-
* @returns {undefined}
|
|
40
|
+
* @param property A CSS property name (kebab-case)
|
|
41
|
+
* @param value The value, or '' to remove the property
|
|
42
|
+
* @param priority "important" to mark it !important
|
|
53
43
|
*/
|
|
54
44
|
setProperty(property: string, value: string, priority?: string): void;
|
|
55
45
|
/**
|
|
56
46
|
* Remove a property, returning the value it had (or '' when it was not set).
|
|
57
|
-
* @param
|
|
58
|
-
* @returns {string}
|
|
47
|
+
* @param property A CSS property name (kebab-case)
|
|
59
48
|
*/
|
|
60
49
|
removeProperty(property: string): string;
|
|
61
50
|
/**
|
|
62
51
|
* All the declarations as one CSS text string.
|
|
63
|
-
* @returns {string}
|
|
64
52
|
*/
|
|
65
53
|
get cssText(): string;
|
|
66
54
|
/**
|
|
67
55
|
* Replace every declaration by parsing a CSS text string ("color: red; font-size: 12px !important;").
|
|
68
|
-
* @param
|
|
69
|
-
* @returns {undefined}
|
|
56
|
+
* @param cssText
|
|
70
57
|
*/
|
|
71
58
|
set cssText(cssText: string);
|
|
72
59
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
6
|
-
* @version 1.0.0
|
|
4
|
+
* Substitute for the DOM CSSStyleDeclaration Class (the object behind Element.style).
|
|
7
5
|
*/
|
|
8
6
|
require('core-js/modules/esnext.iterator.constructor.js')
|
|
9
7
|
require('core-js/modules/esnext.iterator.for-each.js')
|
|
@@ -31,13 +29,10 @@ exports.CSSStyleDeclarationService = void 0
|
|
|
31
29
|
* given, with no unit conversion, shorthand expansion or validation - this is a data structure, not a real CSS
|
|
32
30
|
* engine. Named property access (declaration.backgroundColor, camelCase) is added on top of this by
|
|
33
31
|
* createStyleDeclaration, which wraps an instance of this class in a Proxy.
|
|
34
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
35
|
-
* @class
|
|
36
32
|
*/
|
|
37
33
|
class CSSStyleDeclarationService {
|
|
38
34
|
/**
|
|
39
|
-
* @param
|
|
40
|
-
* @constructor
|
|
35
|
+
* @param cssText Initial declarations, as CSS text ("color: red; font-size: 12px;")
|
|
41
36
|
*/
|
|
42
37
|
constructor (cssText = '') {
|
|
43
38
|
this.properties = new Map()
|
|
@@ -46,7 +41,6 @@ class CSSStyleDeclarationService {
|
|
|
46
41
|
|
|
47
42
|
/**
|
|
48
43
|
* How many properties are currently set.
|
|
49
|
-
* @returns {number}
|
|
50
44
|
*/
|
|
51
45
|
get length () {
|
|
52
46
|
return this.properties.size
|
|
@@ -55,8 +49,7 @@ class CSSStyleDeclarationService {
|
|
|
55
49
|
/**
|
|
56
50
|
* The name of the property at the given index, in the order it was set, or '' when there is none (matches the
|
|
57
51
|
* DOM's CSSStyleDeclaration, which is array-like).
|
|
58
|
-
* @param
|
|
59
|
-
* @returns {string}
|
|
52
|
+
* @param index
|
|
60
53
|
*/
|
|
61
54
|
item (index) {
|
|
62
55
|
return Array.from(this.properties.keys())[index] || ''
|
|
@@ -64,8 +57,7 @@ class CSSStyleDeclarationService {
|
|
|
64
57
|
|
|
65
58
|
/**
|
|
66
59
|
* The value of the given property, or '' when it is not set.
|
|
67
|
-
* @param
|
|
68
|
-
* @returns {string}
|
|
60
|
+
* @param property A CSS property name (kebab-case, e.g. "background-color")
|
|
69
61
|
*/
|
|
70
62
|
getPropertyValue (property) {
|
|
71
63
|
const entry = this.properties.get(property)
|
|
@@ -74,8 +66,7 @@ class CSSStyleDeclarationService {
|
|
|
74
66
|
|
|
75
67
|
/**
|
|
76
68
|
* "important" when the property was set with !important, otherwise ''.
|
|
77
|
-
* @param
|
|
78
|
-
* @returns {string}
|
|
69
|
+
* @param property A CSS property name (kebab-case)
|
|
79
70
|
*/
|
|
80
71
|
getPropertyPriority (property) {
|
|
81
72
|
const entry = this.properties.get(property)
|
|
@@ -85,10 +76,9 @@ class CSSStyleDeclarationService {
|
|
|
85
76
|
/**
|
|
86
77
|
* Set a property's value (and optionally its priority). An empty, null or undefined value removes the property
|
|
87
78
|
* instead, like the DOM.
|
|
88
|
-
* @param
|
|
89
|
-
* @param
|
|
90
|
-
* @param
|
|
91
|
-
* @returns {undefined}
|
|
79
|
+
* @param property A CSS property name (kebab-case)
|
|
80
|
+
* @param value The value, or '' to remove the property
|
|
81
|
+
* @param priority "important" to mark it !important
|
|
92
82
|
*/
|
|
93
83
|
setProperty (property, value, priority = '') {
|
|
94
84
|
if (value === '' || value === null || typeof value === 'undefined') {
|
|
@@ -103,8 +93,7 @@ class CSSStyleDeclarationService {
|
|
|
103
93
|
|
|
104
94
|
/**
|
|
105
95
|
* Remove a property, returning the value it had (or '' when it was not set).
|
|
106
|
-
* @param
|
|
107
|
-
* @returns {string}
|
|
96
|
+
* @param property A CSS property name (kebab-case)
|
|
108
97
|
*/
|
|
109
98
|
removeProperty (property) {
|
|
110
99
|
const value = this.getPropertyValue(property)
|
|
@@ -114,7 +103,6 @@ class CSSStyleDeclarationService {
|
|
|
114
103
|
|
|
115
104
|
/**
|
|
116
105
|
* All the declarations as one CSS text string.
|
|
117
|
-
* @returns {string}
|
|
118
106
|
*/
|
|
119
107
|
get cssText () {
|
|
120
108
|
return Array.from(this.properties.entries()).map(([property, {
|
|
@@ -125,8 +113,7 @@ class CSSStyleDeclarationService {
|
|
|
125
113
|
|
|
126
114
|
/**
|
|
127
115
|
* Replace every declaration by parsing a CSS text string ("color: red; font-size: 12px !important;").
|
|
128
|
-
* @param
|
|
129
|
-
* @returns {undefined}
|
|
116
|
+
* @param cssText
|
|
130
117
|
*/
|
|
131
118
|
set cssText (cssText) {
|
|
132
119
|
this.properties.clear()
|
|
@@ -1,36 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
4
|
-
* @version 1.0.0
|
|
2
|
+
* Substitute for the DOM CustomEvent Class.
|
|
5
3
|
*/
|
|
6
4
|
import { EventService } from './EventService';
|
|
7
5
|
/**
|
|
8
6
|
* The options for creating a custom event.
|
|
9
|
-
* @typedef {Object} CustomEventInit
|
|
10
|
-
* @property {boolean} [bubbles=false]
|
|
11
|
-
* @property {boolean} [cancelable=false]
|
|
12
|
-
* @property {boolean} [composed=false]
|
|
13
|
-
* @property {*} [detail=null] Whatever data the event should carry
|
|
14
7
|
*/
|
|
15
8
|
export type CustomEventInit = {
|
|
16
9
|
bubbles?: boolean;
|
|
17
10
|
cancelable?: boolean;
|
|
18
11
|
composed?: boolean;
|
|
12
|
+
/** Whatever data the event should carry (default null) */
|
|
19
13
|
detail?: any;
|
|
20
14
|
};
|
|
21
15
|
/**
|
|
22
16
|
* Simulate the behaviour of the CustomEvent Class when there is no DOM available: an event which carries data.
|
|
23
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
24
|
-
* @class
|
|
25
|
-
* @augments EventService
|
|
26
|
-
* @property {*} detail
|
|
27
17
|
*/
|
|
28
18
|
export declare class CustomEventService extends EventService {
|
|
29
19
|
private readonly eventDetail;
|
|
30
20
|
/**
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
33
|
-
* @constructor
|
|
21
|
+
* @param typeArg The type of the event
|
|
22
|
+
* @param init The options for the event
|
|
34
23
|
*/
|
|
35
24
|
constructor(typeArg?: string, init?: CustomEventInit);
|
|
36
25
|
get detail(): any;
|
|
@@ -5,23 +5,16 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
5
5
|
})
|
|
6
6
|
exports.CustomEventService = void 0
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
10
|
-
* @version 1.0.0
|
|
8
|
+
* Substitute for the DOM CustomEvent Class.
|
|
11
9
|
*/
|
|
12
10
|
const EventService_1 = require('./EventService')
|
|
13
11
|
/**
|
|
14
12
|
* Simulate the behaviour of the CustomEvent Class when there is no DOM available: an event which carries data.
|
|
15
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
16
|
-
* @class
|
|
17
|
-
* @augments EventService
|
|
18
|
-
* @property {*} detail
|
|
19
13
|
*/
|
|
20
14
|
class CustomEventService extends EventService_1.EventService {
|
|
21
15
|
/**
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
24
|
-
* @constructor
|
|
16
|
+
* @param typeArg The type of the event
|
|
17
|
+
* @param init The options for the event
|
|
25
18
|
*/
|
|
26
19
|
constructor (typeArg = '', init = {}) {
|
|
27
20
|
super(typeArg, init)
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { PseudoDOMTokenList } from '../interfaces/PseudoDOMTokenList';
|
|
2
2
|
/**
|
|
3
3
|
* Simulate the behaviour of the DOMTokenList Class when there is no DOM available.
|
|
4
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
5
|
-
* @class
|
|
6
4
|
*/
|
|
7
5
|
export declare class DOMTokenListService implements PseudoDOMTokenList {
|
|
8
6
|
private tokens;
|
|
9
7
|
private readonly onChange;
|
|
10
8
|
/**
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
13
|
-
* @constructor
|
|
9
|
+
* @param value The space separated tokens to start with
|
|
10
|
+
* @param onChange Called with the new value whenever the tokens change
|
|
14
11
|
*/
|
|
15
12
|
constructor(value?: string, onChange?: (value: string) => void);
|
|
16
13
|
private static parse;
|
|
@@ -10,14 +10,11 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
10
10
|
exports.DOMTokenListService = void 0
|
|
11
11
|
/**
|
|
12
12
|
* Simulate the behaviour of the DOMTokenList Class when there is no DOM available.
|
|
13
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
14
|
-
* @class
|
|
15
13
|
*/
|
|
16
14
|
class DOMTokenListService {
|
|
17
15
|
/**
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @constructor
|
|
16
|
+
* @param value The space separated tokens to start with
|
|
17
|
+
* @param onChange Called with the new value whenever the tokens change
|
|
21
18
|
*/
|
|
22
19
|
constructor (value = '', onChange = () => undefined) {
|
|
23
20
|
this.tokens = DOMTokenListService.parse(value)
|
|
@@ -4,9 +4,6 @@ import { PseudoElement } from '../interfaces/PseudoElement';
|
|
|
4
4
|
/**
|
|
5
5
|
* Simulate the behaviour of the DocumentFragment Class when there is no DOM available: a container for nodes which is
|
|
6
6
|
* not part of a tree, when it is inserted its children are moved into the tree instead.
|
|
7
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
8
|
-
* @class
|
|
9
|
-
* @augments NodeService
|
|
10
7
|
*/
|
|
11
8
|
export declare class DocumentFragmentService extends NodeService implements PseudoDocumentFragment {
|
|
12
9
|
get nodeName(): string;
|
|
@@ -14,8 +11,7 @@ export declare class DocumentFragmentService extends NodeService implements Pseu
|
|
|
14
11
|
/**
|
|
15
12
|
* The first element, in tree order, whose id matches the given value, or null when there is none (the DOM's
|
|
16
13
|
* NonElementParentNode mixin, which Document and DocumentFragment both implement).
|
|
17
|
-
* @param
|
|
18
|
-
* @returns {PseudoElement|null}
|
|
14
|
+
* @param id
|
|
19
15
|
*/
|
|
20
16
|
getElementById(id: string): PseudoElement | null;
|
|
21
17
|
}
|
|
@@ -16,9 +16,6 @@ const getElementById_1 = __importDefault(require('../functions/getElementById'))
|
|
|
16
16
|
/**
|
|
17
17
|
* Simulate the behaviour of the DocumentFragment Class when there is no DOM available: a container for nodes which is
|
|
18
18
|
* not part of a tree, when it is inserted its children are moved into the tree instead.
|
|
19
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
20
|
-
* @class
|
|
21
|
-
* @augments NodeService
|
|
22
19
|
*/
|
|
23
20
|
class DocumentFragmentService extends NodeService_1.NodeService {
|
|
24
21
|
get nodeName () {
|
|
@@ -32,8 +29,7 @@ class DocumentFragmentService extends NodeService_1.NodeService {
|
|
|
32
29
|
/**
|
|
33
30
|
* The first element, in tree order, whose id matches the given value, or null when there is none (the DOM's
|
|
34
31
|
* NonElementParentNode mixin, which Document and DocumentFragment both implement).
|
|
35
|
-
* @param
|
|
36
|
-
* @returns {PseudoElement|null}
|
|
32
|
+
* @param id
|
|
37
33
|
*/
|
|
38
34
|
getElementById (id) {
|
|
39
35
|
return (0, getElementById_1.default)(this, id)
|
|
@@ -4,9 +4,6 @@ import { PseudoElement } from '../interfaces/PseudoElement';
|
|
|
4
4
|
import { DocumentFragmentService } from './DocumentFragmentService';
|
|
5
5
|
/**
|
|
6
6
|
* Simulate the behaviour of the Document Class when there is no DOM available.
|
|
7
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
8
|
-
* @class
|
|
9
|
-
* @augments NodeService
|
|
10
7
|
*/
|
|
11
8
|
export declare class DocumentService extends NodeService implements PseudoDocument {
|
|
12
9
|
get nodeName(): string;
|
|
@@ -15,32 +12,27 @@ export declare class DocumentService extends NodeService implements PseudoDocume
|
|
|
15
12
|
set textContent(text: string | null);
|
|
16
13
|
/**
|
|
17
14
|
* The first element, in tree order, whose id matches the given value, or null when there is none.
|
|
18
|
-
* @param
|
|
19
|
-
* @returns {PseudoElement|null}
|
|
15
|
+
* @param id
|
|
20
16
|
*/
|
|
21
17
|
getElementById(id: string): PseudoElement | null;
|
|
22
18
|
/**
|
|
23
19
|
* Make an element of the given type which belongs to this document but is not added anywhere until it is appended.
|
|
24
|
-
* @param
|
|
25
|
-
* @returns {PseudoElement}
|
|
20
|
+
* @param tagName The type of element to create
|
|
26
21
|
*/
|
|
27
22
|
createElement(tagName?: string): PseudoElement;
|
|
28
23
|
/**
|
|
29
24
|
* Make a text node which belongs to this document.
|
|
30
|
-
* @param
|
|
31
|
-
* @returns {TextService}
|
|
25
|
+
* @param data The text
|
|
32
26
|
*/
|
|
33
27
|
createTextNode(data?: string): TextService;
|
|
34
28
|
/**
|
|
35
29
|
* Make a comment which belongs to this document.
|
|
36
|
-
* @param
|
|
37
|
-
* @returns {CommentService}
|
|
30
|
+
* @param data The comment
|
|
38
31
|
*/
|
|
39
32
|
createComment(data?: string): CommentService;
|
|
40
33
|
/**
|
|
41
34
|
* Make an empty document fragment which belongs to this document, a container for nodes which can be built up and
|
|
42
35
|
* then inserted in one go.
|
|
43
|
-
* @returns {DocumentFragmentService}
|
|
44
36
|
*/
|
|
45
37
|
createDocumentFragment(): DocumentFragmentService;
|
|
46
38
|
}
|
|
@@ -17,9 +17,6 @@ const DocumentFragmentService_1 = require('./DocumentFragmentService')
|
|
|
17
17
|
const getElementById_1 = __importDefault(require('../functions/getElementById'))
|
|
18
18
|
/**
|
|
19
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
20
|
*/
|
|
24
21
|
class DocumentService extends NodeService_1.NodeService {
|
|
25
22
|
get nodeName () {
|
|
@@ -38,8 +35,7 @@ class DocumentService extends NodeService_1.NodeService {
|
|
|
38
35
|
set textContent (text) {}
|
|
39
36
|
/**
|
|
40
37
|
* The first element, in tree order, whose id matches the given value, or null when there is none.
|
|
41
|
-
* @param
|
|
42
|
-
* @returns {PseudoElement|null}
|
|
38
|
+
* @param id
|
|
43
39
|
*/
|
|
44
40
|
getElementById (id) {
|
|
45
41
|
return (0, getElementById_1.default)(this, id)
|
|
@@ -47,8 +43,7 @@ class DocumentService extends NodeService_1.NodeService {
|
|
|
47
43
|
|
|
48
44
|
/**
|
|
49
45
|
* Make an element of the given type which belongs to this document but is not added anywhere until it is appended.
|
|
50
|
-
* @param
|
|
51
|
-
* @returns {PseudoElement}
|
|
46
|
+
* @param tagName The type of element to create
|
|
52
47
|
*/
|
|
53
48
|
createElement (tagName = 'div') {
|
|
54
49
|
// Like the DOM, the new element is not added anywhere: it has no parent until it is appended
|
|
@@ -61,8 +56,7 @@ class DocumentService extends NodeService_1.NodeService {
|
|
|
61
56
|
|
|
62
57
|
/**
|
|
63
58
|
* Make a text node which belongs to this document.
|
|
64
|
-
* @param
|
|
65
|
-
* @returns {TextService}
|
|
59
|
+
* @param data The text
|
|
66
60
|
*/
|
|
67
61
|
createTextNode (data = '') {
|
|
68
62
|
const text = new NodeService_1.TextService(data)
|
|
@@ -72,8 +66,7 @@ class DocumentService extends NodeService_1.NodeService {
|
|
|
72
66
|
|
|
73
67
|
/**
|
|
74
68
|
* Make a comment which belongs to this document.
|
|
75
|
-
* @param
|
|
76
|
-
* @returns {CommentService}
|
|
69
|
+
* @param data The comment
|
|
77
70
|
*/
|
|
78
71
|
createComment (data = '') {
|
|
79
72
|
const comment = new NodeService_1.CommentService(data)
|
|
@@ -84,7 +77,6 @@ class DocumentService extends NodeService_1.NodeService {
|
|
|
84
77
|
/**
|
|
85
78
|
* Make an empty document fragment which belongs to this document, a container for nodes which can be built up and
|
|
86
79
|
* then inserted in one go.
|
|
87
|
-
* @returns {DocumentFragmentService}
|
|
88
80
|
*/
|
|
89
81
|
createDocumentFragment () {
|
|
90
82
|
const fragment = new DocumentFragmentService_1.DocumentFragmentService()
|