jj 2.6.0 → 2.8.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 +0 -1
- package/SKILL.md +2 -6
- package/lib/bundle.cjs +24 -17
- package/lib/bundle.cjs.map +1 -1
- package/lib/bundle.d.cts +19 -18
- package/lib/bundle.d.ts +19 -18
- package/lib/bundle.global.js +24 -17
- package/lib/bundle.global.js.map +1 -1
- package/lib/bundle.js +24 -17
- package/lib/bundle.js.map +1 -1
- package/lib/bundle.min.cjs +1 -1
- package/lib/bundle.min.cjs.map +1 -1
- package/lib/bundle.min.d.cts +19 -18
- package/lib/bundle.min.d.ts +19 -18
- package/lib/bundle.min.global.js +1 -1
- package/lib/bundle.min.global.js.map +1 -1
- package/lib/bundle.min.js +1 -1
- package/lib/bundle.min.js.map +1 -1
- package/package.json +15 -18
package/lib/bundle.d.cts
CHANGED
|
@@ -217,7 +217,7 @@ declare class JJET<T extends EventTarget = EventTarget> {
|
|
|
217
217
|
* @param args - Arguments to pass to the function.
|
|
218
218
|
* @returns The return value of the function.
|
|
219
219
|
*/
|
|
220
|
-
run<R, Args extends
|
|
220
|
+
run<R, Args extends unknown[]>(fn: (this: this, ...args: Args) => R, ...args: Args): R;
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
/**
|
|
@@ -249,15 +249,16 @@ declare class JJN<T extends Node = Node> extends JJET<T> {
|
|
|
249
249
|
* This is useful for filtering the array that is passed to `append()`, `prepend()` or `setChildren()`
|
|
250
250
|
*
|
|
251
251
|
* @param x an unknown value
|
|
252
|
-
* @returns true if `x` is a string, Node (or its
|
|
252
|
+
* @returns true if `x` is a string, Node (or its descendent), JJN (or its descendent)
|
|
253
253
|
*/
|
|
254
|
-
static
|
|
254
|
+
static isWrappable(x: unknown): x is Wrappable;
|
|
255
255
|
/**
|
|
256
256
|
* Wraps a native DOM node or string into the most specific JJ wrapper available.
|
|
257
257
|
*
|
|
258
258
|
* @remarks
|
|
259
259
|
* This function acts as a factory, inspecting the input type and returning the appropriate
|
|
260
260
|
* subclass of `JJN` (e.g., `JJHE` for `HTMLElement`, `JJT` for `Text`).
|
|
261
|
+
* JJN.ts overrides this method to a richer version that handles all subclasses of JJN.
|
|
261
262
|
*
|
|
262
263
|
* @example
|
|
263
264
|
* ```ts
|
|
@@ -342,7 +343,7 @@ declare class JJN<T extends Node = Node> extends JJET<T> {
|
|
|
342
343
|
* @returns This instance for chaining.
|
|
343
344
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/createTextNode | document.createTextNode}
|
|
344
345
|
*/
|
|
345
|
-
addText(
|
|
346
|
+
addText(...textArr: unknown[]): this;
|
|
346
347
|
}
|
|
347
348
|
|
|
348
349
|
declare abstract class JJNx<T extends Element | Document | DocumentFragment> extends JJN<T> {
|
|
@@ -658,8 +659,8 @@ declare class JJE<T extends Element = Element> extends JJNx<T> {
|
|
|
658
659
|
* @throws {TypeError} If arguments are invalid types.
|
|
659
660
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute | Element.setAttribute}
|
|
660
661
|
*/
|
|
661
|
-
setAttr(name: string, value:
|
|
662
|
-
setAttr(obj: Record<string,
|
|
662
|
+
setAttr(name: string, value: unknown): this;
|
|
663
|
+
setAttr(obj: Record<string, unknown>): this;
|
|
663
664
|
/**
|
|
664
665
|
* Removes one or more attributes from the Element.
|
|
665
666
|
*
|
|
@@ -712,8 +713,8 @@ declare class JJE<T extends Element = Element> extends JJNx<T> {
|
|
|
712
713
|
*
|
|
713
714
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes | ARIA Attributes}
|
|
714
715
|
*/
|
|
715
|
-
setAria(name: string, value:
|
|
716
|
-
setAria(obj: Record<string,
|
|
716
|
+
setAria(name: string, value: unknown): this;
|
|
717
|
+
setAria(obj: Record<string, unknown>): this;
|
|
717
718
|
/**
|
|
718
719
|
* Removes one or more ARIA attributes from the Element.
|
|
719
720
|
*
|
|
@@ -955,14 +956,14 @@ declare abstract class JJEx<T extends HTMLElement | SVGElement> extends JJE<T> {
|
|
|
955
956
|
* ```ts
|
|
956
957
|
* el.setData('myKey', 'myValue') // Single
|
|
957
958
|
* el.setData({ myKey: 'myValue', otherKey: 'otherValue' }) // Multiple
|
|
958
|
-
* el.setData('count', 42) // Numbers are automatically converted
|
|
959
|
+
* el.setData('count', 42) // Numbers are automatically converted to strings
|
|
959
960
|
* ```
|
|
960
961
|
*
|
|
961
962
|
* @throws {TypeError} If arguments are invalid types.
|
|
962
963
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset | HTMLElement.dataset}
|
|
963
964
|
*/
|
|
964
|
-
setData(name: string, value
|
|
965
|
-
setData(obj: Record<string,
|
|
965
|
+
setData(name: string, value?: string): this;
|
|
966
|
+
setData(obj: Record<string, string | undefined>): this;
|
|
966
967
|
/**
|
|
967
968
|
* Removes one or more data attributes from the HTMLElement.
|
|
968
969
|
*
|
|
@@ -1049,7 +1050,7 @@ declare class JJHE<T extends HTMLElement = HTMLElement> extends JJEx<T> {
|
|
|
1049
1050
|
* @throws {Error} If the HTMLElement does not have a value property.
|
|
1050
1051
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/value | HTMLInputElement.value}
|
|
1051
1052
|
*/
|
|
1052
|
-
setValue(value:
|
|
1053
|
+
setValue(value: unknown): this;
|
|
1053
1054
|
/**
|
|
1054
1055
|
* Focuses the HTMLElement.
|
|
1055
1056
|
*
|
|
@@ -1086,7 +1087,7 @@ declare class JJHE<T extends HTMLElement = HTMLElement> extends JJEx<T> {
|
|
|
1086
1087
|
* @returns This instance for chaining.
|
|
1087
1088
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText | HTMLElement.innerText}
|
|
1088
1089
|
*/
|
|
1089
|
-
setText(text?:
|
|
1090
|
+
setText(text?: unknown): this;
|
|
1090
1091
|
}
|
|
1091
1092
|
|
|
1092
1093
|
/**
|
|
@@ -1229,7 +1230,7 @@ declare class JJSE<T extends SVGElement = SVGElement> extends JJEx<T> {
|
|
|
1229
1230
|
* @returns This instance for chaining.
|
|
1230
1231
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}
|
|
1231
1232
|
*/
|
|
1232
|
-
setText(text?:
|
|
1233
|
+
setText(text?: unknown): this;
|
|
1233
1234
|
/**
|
|
1234
1235
|
* Sets the fill attribute.
|
|
1235
1236
|
*
|
|
@@ -1367,7 +1368,7 @@ declare class JJT<T extends Text = Text> extends JJN<Text> {
|
|
|
1367
1368
|
* @returns This instance for chaining.
|
|
1368
1369
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}
|
|
1369
1370
|
*/
|
|
1370
|
-
setText(text?:
|
|
1371
|
+
setText(text?: unknown): this;
|
|
1371
1372
|
/**
|
|
1372
1373
|
* Appends text to the existing content.
|
|
1373
1374
|
*
|
|
@@ -1378,11 +1379,11 @@ declare class JJT<T extends Text = Text> extends JJN<Text> {
|
|
|
1378
1379
|
* console.log(text.getText()) // 'hello world'
|
|
1379
1380
|
* ```
|
|
1380
1381
|
*
|
|
1381
|
-
* @param
|
|
1382
|
+
* @param textArr - The string to add to the existing contents. If null or undefined, nothing is added.
|
|
1382
1383
|
* @returns This instance for chaining.
|
|
1383
1384
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}
|
|
1384
1385
|
*/
|
|
1385
|
-
addText(
|
|
1386
|
+
addText(...textArr: unknown[]): this;
|
|
1386
1387
|
/**
|
|
1387
1388
|
* Clears the text content of the Text node.
|
|
1388
1389
|
*
|
|
@@ -1659,7 +1660,7 @@ declare function fetchStyle(url: URL | string): Promise<CSSStyleSheet>;
|
|
|
1659
1660
|
* @returns `true` if it tried to set the attribute; otherwise `false`.
|
|
1660
1661
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#responding_to_attribute_changes | Responding to attribute changes}
|
|
1661
1662
|
*/
|
|
1662
|
-
declare function attr2prop(instance: HTMLElement, name: string, oldValue:
|
|
1663
|
+
declare function attr2prop(instance: HTMLElement, name: string, oldValue: unknown, newValue: unknown): boolean;
|
|
1663
1664
|
/**
|
|
1664
1665
|
* Registers the custom element with the browser and waits till it is defined.
|
|
1665
1666
|
*
|
package/lib/bundle.d.ts
CHANGED
|
@@ -217,7 +217,7 @@ declare class JJET<T extends EventTarget = EventTarget> {
|
|
|
217
217
|
* @param args - Arguments to pass to the function.
|
|
218
218
|
* @returns The return value of the function.
|
|
219
219
|
*/
|
|
220
|
-
run<R, Args extends
|
|
220
|
+
run<R, Args extends unknown[]>(fn: (this: this, ...args: Args) => R, ...args: Args): R;
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
/**
|
|
@@ -249,15 +249,16 @@ declare class JJN<T extends Node = Node> extends JJET<T> {
|
|
|
249
249
|
* This is useful for filtering the array that is passed to `append()`, `prepend()` or `setChildren()`
|
|
250
250
|
*
|
|
251
251
|
* @param x an unknown value
|
|
252
|
-
* @returns true if `x` is a string, Node (or its
|
|
252
|
+
* @returns true if `x` is a string, Node (or its descendent), JJN (or its descendent)
|
|
253
253
|
*/
|
|
254
|
-
static
|
|
254
|
+
static isWrappable(x: unknown): x is Wrappable;
|
|
255
255
|
/**
|
|
256
256
|
* Wraps a native DOM node or string into the most specific JJ wrapper available.
|
|
257
257
|
*
|
|
258
258
|
* @remarks
|
|
259
259
|
* This function acts as a factory, inspecting the input type and returning the appropriate
|
|
260
260
|
* subclass of `JJN` (e.g., `JJHE` for `HTMLElement`, `JJT` for `Text`).
|
|
261
|
+
* JJN.ts overrides this method to a richer version that handles all subclasses of JJN.
|
|
261
262
|
*
|
|
262
263
|
* @example
|
|
263
264
|
* ```ts
|
|
@@ -342,7 +343,7 @@ declare class JJN<T extends Node = Node> extends JJET<T> {
|
|
|
342
343
|
* @returns This instance for chaining.
|
|
343
344
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/createTextNode | document.createTextNode}
|
|
344
345
|
*/
|
|
345
|
-
addText(
|
|
346
|
+
addText(...textArr: unknown[]): this;
|
|
346
347
|
}
|
|
347
348
|
|
|
348
349
|
declare abstract class JJNx<T extends Element | Document | DocumentFragment> extends JJN<T> {
|
|
@@ -658,8 +659,8 @@ declare class JJE<T extends Element = Element> extends JJNx<T> {
|
|
|
658
659
|
* @throws {TypeError} If arguments are invalid types.
|
|
659
660
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute | Element.setAttribute}
|
|
660
661
|
*/
|
|
661
|
-
setAttr(name: string, value:
|
|
662
|
-
setAttr(obj: Record<string,
|
|
662
|
+
setAttr(name: string, value: unknown): this;
|
|
663
|
+
setAttr(obj: Record<string, unknown>): this;
|
|
663
664
|
/**
|
|
664
665
|
* Removes one or more attributes from the Element.
|
|
665
666
|
*
|
|
@@ -712,8 +713,8 @@ declare class JJE<T extends Element = Element> extends JJNx<T> {
|
|
|
712
713
|
*
|
|
713
714
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes | ARIA Attributes}
|
|
714
715
|
*/
|
|
715
|
-
setAria(name: string, value:
|
|
716
|
-
setAria(obj: Record<string,
|
|
716
|
+
setAria(name: string, value: unknown): this;
|
|
717
|
+
setAria(obj: Record<string, unknown>): this;
|
|
717
718
|
/**
|
|
718
719
|
* Removes one or more ARIA attributes from the Element.
|
|
719
720
|
*
|
|
@@ -955,14 +956,14 @@ declare abstract class JJEx<T extends HTMLElement | SVGElement> extends JJE<T> {
|
|
|
955
956
|
* ```ts
|
|
956
957
|
* el.setData('myKey', 'myValue') // Single
|
|
957
958
|
* el.setData({ myKey: 'myValue', otherKey: 'otherValue' }) // Multiple
|
|
958
|
-
* el.setData('count', 42) // Numbers are automatically converted
|
|
959
|
+
* el.setData('count', 42) // Numbers are automatically converted to strings
|
|
959
960
|
* ```
|
|
960
961
|
*
|
|
961
962
|
* @throws {TypeError} If arguments are invalid types.
|
|
962
963
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset | HTMLElement.dataset}
|
|
963
964
|
*/
|
|
964
|
-
setData(name: string, value
|
|
965
|
-
setData(obj: Record<string,
|
|
965
|
+
setData(name: string, value?: string): this;
|
|
966
|
+
setData(obj: Record<string, string | undefined>): this;
|
|
966
967
|
/**
|
|
967
968
|
* Removes one or more data attributes from the HTMLElement.
|
|
968
969
|
*
|
|
@@ -1049,7 +1050,7 @@ declare class JJHE<T extends HTMLElement = HTMLElement> extends JJEx<T> {
|
|
|
1049
1050
|
* @throws {Error} If the HTMLElement does not have a value property.
|
|
1050
1051
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/value | HTMLInputElement.value}
|
|
1051
1052
|
*/
|
|
1052
|
-
setValue(value:
|
|
1053
|
+
setValue(value: unknown): this;
|
|
1053
1054
|
/**
|
|
1054
1055
|
* Focuses the HTMLElement.
|
|
1055
1056
|
*
|
|
@@ -1086,7 +1087,7 @@ declare class JJHE<T extends HTMLElement = HTMLElement> extends JJEx<T> {
|
|
|
1086
1087
|
* @returns This instance for chaining.
|
|
1087
1088
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText | HTMLElement.innerText}
|
|
1088
1089
|
*/
|
|
1089
|
-
setText(text?:
|
|
1090
|
+
setText(text?: unknown): this;
|
|
1090
1091
|
}
|
|
1091
1092
|
|
|
1092
1093
|
/**
|
|
@@ -1229,7 +1230,7 @@ declare class JJSE<T extends SVGElement = SVGElement> extends JJEx<T> {
|
|
|
1229
1230
|
* @returns This instance for chaining.
|
|
1230
1231
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}
|
|
1231
1232
|
*/
|
|
1232
|
-
setText(text?:
|
|
1233
|
+
setText(text?: unknown): this;
|
|
1233
1234
|
/**
|
|
1234
1235
|
* Sets the fill attribute.
|
|
1235
1236
|
*
|
|
@@ -1367,7 +1368,7 @@ declare class JJT<T extends Text = Text> extends JJN<Text> {
|
|
|
1367
1368
|
* @returns This instance for chaining.
|
|
1368
1369
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}
|
|
1369
1370
|
*/
|
|
1370
|
-
setText(text?:
|
|
1371
|
+
setText(text?: unknown): this;
|
|
1371
1372
|
/**
|
|
1372
1373
|
* Appends text to the existing content.
|
|
1373
1374
|
*
|
|
@@ -1378,11 +1379,11 @@ declare class JJT<T extends Text = Text> extends JJN<Text> {
|
|
|
1378
1379
|
* console.log(text.getText()) // 'hello world'
|
|
1379
1380
|
* ```
|
|
1380
1381
|
*
|
|
1381
|
-
* @param
|
|
1382
|
+
* @param textArr - The string to add to the existing contents. If null or undefined, nothing is added.
|
|
1382
1383
|
* @returns This instance for chaining.
|
|
1383
1384
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}
|
|
1384
1385
|
*/
|
|
1385
|
-
addText(
|
|
1386
|
+
addText(...textArr: unknown[]): this;
|
|
1386
1387
|
/**
|
|
1387
1388
|
* Clears the text content of the Text node.
|
|
1388
1389
|
*
|
|
@@ -1659,7 +1660,7 @@ declare function fetchStyle(url: URL | string): Promise<CSSStyleSheet>;
|
|
|
1659
1660
|
* @returns `true` if it tried to set the attribute; otherwise `false`.
|
|
1660
1661
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#responding_to_attribute_changes | Responding to attribute changes}
|
|
1661
1662
|
*/
|
|
1662
|
-
declare function attr2prop(instance: HTMLElement, name: string, oldValue:
|
|
1663
|
+
declare function attr2prop(instance: HTMLElement, name: string, oldValue: unknown, newValue: unknown): boolean;
|
|
1663
1664
|
/**
|
|
1664
1665
|
* Registers the custom element with the browser and waits till it is defined.
|
|
1665
1666
|
*
|
package/lib/bundle.global.js
CHANGED
|
@@ -305,9 +305,9 @@
|
|
|
305
305
|
* This is useful for filtering the array that is passed to `append()`, `prepend()` or `setChildren()`
|
|
306
306
|
*
|
|
307
307
|
* @param x an unknown value
|
|
308
|
-
* @returns true if `x` is a string, Node (or its
|
|
308
|
+
* @returns true if `x` is a string, Node (or its descendent), JJN (or its descendent)
|
|
309
309
|
*/
|
|
310
|
-
static
|
|
310
|
+
static isWrappable(x) {
|
|
311
311
|
return isStr(x) || isA(x, Node) || isA(x, _JJN);
|
|
312
312
|
}
|
|
313
313
|
/**
|
|
@@ -316,6 +316,7 @@
|
|
|
316
316
|
* @remarks
|
|
317
317
|
* This function acts as a factory, inspecting the input type and returning the appropriate
|
|
318
318
|
* subclass of `JJN` (e.g., `JJHE` for `HTMLElement`, `JJT` for `Text`).
|
|
319
|
+
* JJN.ts overrides this method to a richer version that handles all subclasses of JJN.
|
|
319
320
|
*
|
|
320
321
|
* @example
|
|
321
322
|
* ```ts
|
|
@@ -328,7 +329,15 @@
|
|
|
328
329
|
* @throws {TypeError} If the input is not a Node, string, or JJ wrapper.
|
|
329
330
|
*/
|
|
330
331
|
static wrap(raw) {
|
|
331
|
-
|
|
332
|
+
if (isObj(raw)) {
|
|
333
|
+
if (isA(raw, _JJN)) {
|
|
334
|
+
return raw;
|
|
335
|
+
}
|
|
336
|
+
if (isA(raw, Node)) {
|
|
337
|
+
return new _JJN(raw);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
throw typeErr("raw", "a Node", raw);
|
|
332
341
|
}
|
|
333
342
|
/**
|
|
334
343
|
* Extracts the underlying native DOM node from a wrapper.
|
|
@@ -431,9 +440,9 @@
|
|
|
431
440
|
* @returns This instance for chaining.
|
|
432
441
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/createTextNode | document.createTextNode}
|
|
433
442
|
*/
|
|
434
|
-
addText(
|
|
435
|
-
if (
|
|
436
|
-
this.ref.appendChild(document.createTextNode(
|
|
443
|
+
addText(...textArr) {
|
|
444
|
+
if (textArr) {
|
|
445
|
+
this.ref.appendChild(document.createTextNode(textArr.join("")));
|
|
437
446
|
}
|
|
438
447
|
return this;
|
|
439
448
|
}
|
|
@@ -498,7 +507,7 @@
|
|
|
498
507
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/append | Element.append}
|
|
499
508
|
*/
|
|
500
509
|
addChild(...children) {
|
|
501
|
-
const nodes = JJN.unwrapAll(children.filter(JJN.
|
|
510
|
+
const nodes = JJN.unwrapAll(children.filter(JJN.isWrappable));
|
|
502
511
|
this.ref.append(...nodes);
|
|
503
512
|
return this;
|
|
504
513
|
}
|
|
@@ -518,7 +527,7 @@
|
|
|
518
527
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/prepend | Element.prepend}
|
|
519
528
|
*/
|
|
520
529
|
preChild(...children) {
|
|
521
|
-
const nodes = JJN.unwrapAll(children.filter(JJN.
|
|
530
|
+
const nodes = JJN.unwrapAll(children.filter(JJN.isWrappable));
|
|
522
531
|
this.ref.prepend(...nodes);
|
|
523
532
|
return this;
|
|
524
533
|
}
|
|
@@ -574,7 +583,7 @@
|
|
|
574
583
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren | Element.replaceChildren}
|
|
575
584
|
*/
|
|
576
585
|
setChildren(...children) {
|
|
577
|
-
const nodes = JJN.unwrapAll(children.filter(JJN.
|
|
586
|
+
const nodes = JJN.unwrapAll(children.filter(JJN.isWrappable));
|
|
578
587
|
this.ref.replaceChildren(...nodes);
|
|
579
588
|
return this;
|
|
580
589
|
}
|
|
@@ -1336,7 +1345,7 @@
|
|
|
1336
1345
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText | HTMLElement.innerText}
|
|
1337
1346
|
*/
|
|
1338
1347
|
setText(text) {
|
|
1339
|
-
this.ref.innerText = text
|
|
1348
|
+
this.ref.innerText = text;
|
|
1340
1349
|
return this;
|
|
1341
1350
|
}
|
|
1342
1351
|
};
|
|
@@ -1408,7 +1417,7 @@
|
|
|
1408
1417
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}
|
|
1409
1418
|
*/
|
|
1410
1419
|
setText(text) {
|
|
1411
|
-
this.ref.textContent = text
|
|
1420
|
+
this.ref.textContent = text;
|
|
1412
1421
|
return this;
|
|
1413
1422
|
}
|
|
1414
1423
|
/**
|
|
@@ -1421,14 +1430,12 @@
|
|
|
1421
1430
|
* console.log(text.getText()) // 'hello world'
|
|
1422
1431
|
* ```
|
|
1423
1432
|
*
|
|
1424
|
-
* @param
|
|
1433
|
+
* @param textArr - The string to add to the existing contents. If null or undefined, nothing is added.
|
|
1425
1434
|
* @returns This instance for chaining.
|
|
1426
1435
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}
|
|
1427
1436
|
*/
|
|
1428
|
-
addText(
|
|
1429
|
-
|
|
1430
|
-
this.ref.textContent += text;
|
|
1431
|
-
}
|
|
1437
|
+
addText(...textArr) {
|
|
1438
|
+
this.setText(this.getText() + textArr.join(""));
|
|
1432
1439
|
return this;
|
|
1433
1440
|
}
|
|
1434
1441
|
/**
|
|
@@ -1587,7 +1594,7 @@
|
|
|
1587
1594
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}
|
|
1588
1595
|
*/
|
|
1589
1596
|
setText(text) {
|
|
1590
|
-
this.ref.textContent = text
|
|
1597
|
+
this.ref.textContent = text;
|
|
1591
1598
|
return this;
|
|
1592
1599
|
}
|
|
1593
1600
|
/**
|