Skip to content

Commit 239d4f0

Browse files
rahatarmanahmeddylhunn
authored andcommitted
refactor(core): Cleanup dead jsnamespace code (#55795)
Support for the jsnamespace attribute was removed in #55619. PR Close #55795
1 parent a78144a commit 239d4f0

4 files changed

Lines changed: 4 additions & 67 deletions

File tree

packages/core/primitives/event-dispatch/src/attribute.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,12 @@
1414
* an optional DOM event name and a jsaction name. If the optional
1515
* DOM event name is omitted, 'click' is assumed. The jsaction names
1616
* are dot separated pairs of a namespace and a simple jsaction
17-
* name. If the namespace is absent, it is taken from the closest
18-
* ancestor element with a jsnamespace attribute, if there is
19-
* any. If there is no ancestor with a jsnamespace attribute, the
20-
* simple name is assumed to be the jsaction name.
17+
* name.
2118
*
22-
* Used by EventContract.
19+
* See grammar in README.md for expected syntax in the attribute value.
2320
*/
2421
export const JSACTION = 'jsaction';
2522

26-
/**
27-
* The jsnamespace attribute provides the namespace part of the
28-
* jaction names occurring in the jsaction attribute where it's
29-
* missing.
30-
*
31-
* Used by EventContract.
32-
*/
33-
export const JSNAMESPACE = 'jsnamespace';
34-
3523
/**
3624
* The oi attribute is a log impression tag for impression logging
3725
* and action tracking. For an element that carries a jsaction
@@ -74,4 +62,4 @@ export const JSINSTANCE = 'jsinstance';
7462
*/
7563
export const JSTRACK = 'jstrack';
7664

77-
export const Attribute = {JSACTION, JSNAMESPACE, OI, VED, VET, JSINSTANCE, JSTRACK};
65+
export const Attribute = {JSACTION, OI, VED, VET, JSINSTANCE, JSTRACK};

packages/core/primitives/event-dispatch/src/cache.ts

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {JSACTION, JSNAMESPACE} from './property';
9+
import {JSACTION} from './property';
1010

1111
/**
1212
* Map from jsaction annotation to a parsed map from event name to action name.
@@ -66,39 +66,3 @@ export function clear(element: Element) {
6666
delete element[JSACTION];
6767
}
6868
}
69-
70-
/**
71-
* Reads the cached jsaction namespace from the given DOM
72-
* Element. Undefined means there is no cached value; null is a cached
73-
* jsnamespace attribute that's absent.
74-
*
75-
* @param element .
76-
* @return .
77-
*/
78-
export function getNamespace(element: Element): string | null | undefined {
79-
// @ts-ignore
80-
return element[JSNAMESPACE];
81-
}
82-
83-
/**
84-
* Writes the cached jsaction namespace to the given DOM Element. Null
85-
* represents a jsnamespace attribute that's absent.
86-
*
87-
* @param element .
88-
* @param jsnamespace .
89-
*/
90-
export function setNamespace(element: Element, jsnamespace: string | null) {
91-
// @ts-ignore
92-
element[JSNAMESPACE] = jsnamespace;
93-
}
94-
95-
/**
96-
* Clears the cached jsaction namespace from the given DOM Element.
97-
*
98-
* @param element .
99-
*/
100-
export function clearNamespace(element: Element) {
101-
if (JSNAMESPACE in element) {
102-
delete element[JSNAMESPACE];
103-
}
104-
}

packages/core/primitives/event-dispatch/src/property.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@
1616
*/
1717
export const JSACTION = '__jsaction';
1818

19-
/**
20-
* The parsed value of the jsnamespace attribute is stored in this
21-
* property on the DOM node.
22-
*/
23-
export const JSNAMESPACE = '__jsnamespace';
24-
2519
/** The value of the oi attribute as a property, for faster access. */
2620
export const OI = '__oi';
2721

@@ -36,15 +30,13 @@ export const OWNER = '__owner';
3630
/** All properties that are used by jsaction. */
3731
export const Property = {
3832
JSACTION,
39-
JSNAMESPACE,
4033
OI,
4134
OWNER,
4235
};
4336

4437
declare global {
4538
interface Node {
4639
[JSACTION]?: string;
47-
[JSNAMESPACE]?: string;
4840
[OI]?: string;
4941
[OWNER]?: ParentNode;
5042
}

packages/core/primitives/event-dispatch/test/eventcontract_test.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,6 @@ const domContent = `
180180
</div>
181181
</div>
182182
183-
<div id="jsnamespace-container">
184-
<div id="jsnamespace-namespace-element" jsnamespace="namespace">
185-
<div id="jsnamespace-action-element" jsaction="handleClick">
186-
<div id="jsnamespace-target-element"></div>
187-
</div>
188-
</div>
189-
</div>
190183
<div id="focus-container">
191184
<div id="focus-action-element" jsaction="focus:handleFocus">
192185
<button id="focus-target-element">Focus Button</button>

0 commit comments

Comments
 (0)