Skip to content

Commit 8ed780c

Browse files
committed
Rename & deprecate placeholder exports
1 parent cb604b1 commit 8ed780c

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
## 22.2
44
+ Add optionally visible comments in `rvx/dom`.
5-
+ Rename `NoopComment` to `Comment`.
6-
+ **Deprecated:** `NoopComment` export will be removed in the next major version.
5+
+ Rename & **deprecate** old exports:
6+
+ `NoopComment => Comment`.
7+
+ `NoopEvent => Event`.
8+
+ `NoopEventTarget => EventTarget`.
79

810
## 22.1
911
+ Add `separated` conversion utility.

src/dom/model.ts

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,14 @@ export class NodeList {
5454
}
5555
}
5656

57-
export class NoopEvent {}
57+
export class Event {}
5858

59-
export class NoopEventTarget {
59+
/**
60+
* @deprecated Use {@link Event} instead.
61+
*/
62+
export const NoopEvent = Event;
63+
64+
export class EventTarget {
6065
addEventListener(): void {
6166
// noop
6267
}
@@ -70,7 +75,12 @@ export class NoopEventTarget {
7075
}
7176
}
7277

73-
export class Document extends NoopEventTarget {
78+
/**
79+
* @deprecated Use {@link EventTarget} instead.
80+
*/
81+
export const NoopEventTarget = EventTarget;
82+
83+
export class Document extends EventTarget {
7484
get body(): Element | null {
7585
// noop
7686
return null;
@@ -102,7 +112,7 @@ export class Document extends NoopEventTarget {
102112
}
103113
}
104114

105-
export class Node extends NoopEventTarget {
115+
export class Node extends EventTarget {
106116
#parent: Node | null = null;
107117
#first: Node | null = null;
108118
#last: Node | null = null;
@@ -948,15 +958,15 @@ export class RawHTML extends Node {
948958
}
949959
}
950960

951-
export class Window extends NoopEventTarget {
961+
export class Window extends EventTarget {
952962
static {
953963
this.prototype[WINDOW_MARKER] = true;
954964
this.prototype.Comment = Comment;
955-
this.prototype.CustomEvent = NoopEvent;
965+
this.prototype.CustomEvent = Event;
956966
this.prototype.Document = Document;
957967
this.prototype.DocumentFragment = DocumentFragment;
958968
this.prototype.Element = Element;
959-
this.prototype.Event = NoopEvent;
969+
this.prototype.Event = Event;
960970
this.prototype.Node = Node;
961971
this.prototype.Text = Text;
962972
}
@@ -968,11 +978,11 @@ export class Window extends NoopEventTarget {
968978
export interface Window {
969979
[WINDOW_MARKER]: boolean;
970980
Comment: typeof Comment;
971-
CustomEvent: typeof NoopEvent;
981+
CustomEvent: typeof Event;
972982
Document: typeof Document;
973983
DocumentFragment: typeof DocumentFragment;
974984
Element: typeof Element;
975-
Event: typeof NoopEvent;
985+
Event: typeof Event;
976986
Node: typeof Node;
977987
Text: typeof Text;
978988
}

0 commit comments

Comments
 (0)