@ihk-gfi/lux-components-update 11.13.0 → 13.0.1
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 +2 -4
- package/package.json +14 -17
- package/src/add-lux-components/files/app/app.component.html +1 -1
- package/src/add-lux-components/files/app/app.component.ts +4 -1
- package/src/add-lux-components/files/locale/messages.en.xlf +489 -235
- package/src/add-lux-components/files/locale/messages.xlf +451 -218
- package/src/add-lux-components/files/scripts/.browserslistrc +10 -7
- package/src/add-lux-components/files/src/index.html +31 -0
- package/src/add-lux-components/index.js +151 -78
- package/src/add-lux-components/index.js.map +1 -1
- package/src/add-lux-components/index.ts +141 -66
- package/src/add-lux-components/index_spec.js +4 -4
- package/src/add-lux-components/index_spec.js.map +1 -1
- package/src/add-lux-components/index_spec.ts +1 -1
- package/src/add-lux-components/schema.json +1 -1
- package/src/collection.json +8 -88
- package/src/update-dependencies/index.d.ts +1 -1
- package/src/update-dependencies/index.js +82 -65
- package/src/update-dependencies/index.js.map +1 -1
- package/src/update-dependencies/index.ts +112 -95
- package/src/update-dependencies/schema.json +1 -1
- package/src/update-en-messages/index.d.ts +2 -0
- package/src/update-en-messages/index.js +75 -0
- package/src/update-en-messages/index.js.map +1 -0
- package/src/update-en-messages/index.ts +78 -0
- package/src/{update110100 → update-en-messages}/schema.json +3 -3
- package/src/updates/update130000/files/root/.browserslistrc +20 -0
- package/src/updates/update130000/index.d.ts +27 -0
- package/src/updates/update130000/index.js +296 -0
- package/src/updates/update130000/index.js.map +1 -0
- package/src/updates/update130000/index.ts +346 -0
- package/src/{migrate-to-eslint → updates/update130000}/index_spec.d.ts +0 -0
- package/src/updates/update130000/index_spec.js +574 -0
- package/src/updates/update130000/index_spec.js.map +1 -0
- package/src/updates/update130000/index_spec.ts +665 -0
- package/src/{update → updates/update130000}/schema.json +1 -1
- package/src/utility/dependencies.js +16 -14
- package/src/utility/dependencies.js.map +1 -1
- package/src/utility/dependencies.ts +6 -4
- package/src/utility/files.d.ts +5 -1
- package/src/utility/files.js +27 -16
- package/src/utility/files.js.map +1 -1
- package/src/utility/files.ts +16 -3
- package/src/utility/html.js +88 -25
- package/src/utility/html.js.map +1 -1
- package/src/utility/html.ts +105 -29
- package/src/{migrate-to-webcomponent/index_spec.d.ts → utility/html_spec.d.ts} +0 -0
- package/src/utility/html_spec.js +560 -0
- package/src/utility/html_spec.js.map +1 -0
- package/src/utility/html_spec.ts +575 -0
- package/src/utility/json.d.ts +46 -1
- package/src/utility/json.js +174 -4
- package/src/utility/json.js.map +1 -1
- package/src/utility/json.ts +198 -3
- package/src/{update/index_spec.d.ts → utility/json_spec.d.ts} +0 -0
- package/src/utility/json_spec.js +326 -0
- package/src/utility/json_spec.js.map +1 -0
- package/src/utility/json_spec.ts +376 -0
- package/src/utility/typescript.js +16 -16
- package/src/utility/typescript.js.map +1 -1
- package/src/utility/typescript_spec.js +36 -36
- package/src/utility/typescript_spec.js.map +1 -1
- package/src/utility/util.d.ts +2 -2
- package/src/utility/util.js +16 -14
- package/src/utility/util.js.map +1 -1
- package/src/utility/util.ts +7 -5
- package/src/utility/validation.js +11 -11
- package/src/utility/validation.js.map +1 -1
- package/src/migrate-to-eslint/files/.eslintrc.json +0 -68
- package/src/migrate-to-eslint/files/.prettierrc +0 -25
- package/src/migrate-to-eslint/index.d.ts +0 -6
- package/src/migrate-to-eslint/index.js +0 -149
- package/src/migrate-to-eslint/index.js.map +0 -1
- package/src/migrate-to-eslint/index.ts +0 -181
- package/src/migrate-to-eslint/index_spec.js +0 -129
- package/src/migrate-to-eslint/index_spec.js.map +0 -1
- package/src/migrate-to-eslint/index_spec.ts +0 -152
- package/src/migrate-to-eslint/schema.json +0 -23
- package/src/migrate-to-webcomponent/index.d.ts +0 -10
- package/src/migrate-to-webcomponent/index.js +0 -278
- package/src/migrate-to-webcomponent/index.js.map +0 -1
- package/src/migrate-to-webcomponent/index.ts +0 -331
- package/src/migrate-to-webcomponent/index_spec.js +0 -580
- package/src/migrate-to-webcomponent/index_spec.js.map +0 -1
- package/src/migrate-to-webcomponent/index_spec.ts +0 -703
- package/src/migrate-to-webcomponent/schema.json +0 -23
- package/src/update/files/locale/messages.en.xlf +0 -940
- package/src/update/files/locale/messages.xlf +0 -815
- package/src/update/files/scripts/move-de-files.js +0 -15
- package/src/update/index.d.ts +0 -23
- package/src/update/index.js +0 -635
- package/src/update/index.js.map +0 -1
- package/src/update/index.ts +0 -712
- package/src/update/index_spec.js +0 -984
- package/src/update/index_spec.js.map +0 -1
- package/src/update/index_spec.ts +0 -1139
- package/src/update110001/index.d.ts +0 -2
- package/src/update110001/index.js +0 -42
- package/src/update110001/index.js.map +0 -1
- package/src/update110001/index.ts +0 -40
- package/src/update110001/index_spec.d.ts +0 -1
- package/src/update110001/index_spec.js +0 -67
- package/src/update110001/index_spec.js.map +0 -1
- package/src/update110001/index_spec.ts +0 -72
- package/src/update110001/schema.json +0 -23
- package/src/update110100/index.d.ts +0 -2
- package/src/update110100/index.js +0 -27
- package/src/update110100/index.js.map +0 -1
- package/src/update110100/index.ts +0 -24
- package/src/update110100/index_spec.d.ts +0 -1
- package/src/update110100/index_spec.js +0 -69
- package/src/update110100/index_spec.js.map +0 -1
- package/src/update110100/index_spec.ts +0 -73
- package/src/update110101/index.d.ts +0 -2
- package/src/update110101/index.js +0 -24
- package/src/update110101/index.js.map +0 -1
- package/src/update110101/index.ts +0 -21
- package/src/update110101/index_spec.d.ts +0 -1
- package/src/update110101/index_spec.js +0 -65
- package/src/update110101/index_spec.js.map +0 -1
- package/src/update110101/index_spec.ts +0 -69
- package/src/update110101/schema.json +0 -23
- package/src/update110200/index.d.ts +0 -2
- package/src/update110200/index.js +0 -24
- package/src/update110200/index.js.map +0 -1
- package/src/update110200/index.ts +0 -21
- package/src/update110200/index_spec.d.ts +0 -1
- package/src/update110200/index_spec.js +0 -65
- package/src/update110200/index_spec.js.map +0 -1
- package/src/update110200/index_spec.ts +0 -69
- package/src/update110200/schema.json +0 -23
- package/src/update110300/index.d.ts +0 -2
- package/src/update110300/index.js +0 -133
- package/src/update110300/index.js.map +0 -1
- package/src/update110300/index.ts +0 -148
- package/src/update110300/index_spec.d.ts +0 -1
- package/src/update110300/index_spec.js +0 -121
- package/src/update110300/index_spec.js.map +0 -1
- package/src/update110300/index_spec.ts +0 -139
- package/src/update110300/schema.json +0 -23
- package/src/update110400/index.d.ts +0 -2
- package/src/update110400/index.js +0 -28
- package/src/update110400/index.js.map +0 -1
- package/src/update110400/index.ts +0 -28
- package/src/update110400/index_spec.d.ts +0 -1
- package/src/update110400/index_spec.js +0 -66
- package/src/update110400/index_spec.js.map +0 -1
- package/src/update110400/index_spec.ts +0 -70
- package/src/update110400/schema.json +0 -23
- package/src/update110500/index.d.ts +0 -2
- package/src/update110500/index.js +0 -28
- package/src/update110500/index.js.map +0 -1
- package/src/update110500/index.ts +0 -28
- package/src/update110500/index_spec.d.ts +0 -1
- package/src/update110500/index_spec.js +0 -66
- package/src/update110500/index_spec.js.map +0 -1
- package/src/update110500/index_spec.ts +0 -70
- package/src/update110500/schema.json +0 -23
- package/src/update110600/index.d.ts +0 -2
- package/src/update110600/index.js +0 -28
- package/src/update110600/index.js.map +0 -1
- package/src/update110600/index.ts +0 -28
- package/src/update110600/index_spec.d.ts +0 -1
- package/src/update110600/index_spec.js +0 -66
- package/src/update110600/index_spec.js.map +0 -1
- package/src/update110600/index_spec.ts +0 -70
- package/src/update110600/schema.json +0 -23
- package/src/update110700/index.d.ts +0 -2
- package/src/update110700/index.js +0 -45
- package/src/update110700/index.js.map +0 -1
- package/src/update110700/index.ts +0 -47
- package/src/update110700/index_spec.d.ts +0 -1
- package/src/update110700/index_spec.js +0 -108
- package/src/update110700/index_spec.js.map +0 -1
- package/src/update110700/index_spec.ts +0 -122
- package/src/update110700/schema.json +0 -23
- package/src/update110800/index.d.ts +0 -2
- package/src/update110800/index.js +0 -32
- package/src/update110800/index.js.map +0 -1
- package/src/update110800/index.ts +0 -33
- package/src/update110800/index_spec.d.ts +0 -1
- package/src/update110800/index_spec.js +0 -70
- package/src/update110800/index_spec.js.map +0 -1
- package/src/update110800/index_spec.ts +0 -75
- package/src/update110800/schema.json +0 -23
- package/src/update110900/index.d.ts +0 -4
- package/src/update110900/index.js +0 -111
- package/src/update110900/index.js.map +0 -1
- package/src/update110900/index.ts +0 -123
- package/src/update110900/index_spec.d.ts +0 -1
- package/src/update110900/index_spec.js +0 -311
- package/src/update110900/index_spec.js.map +0 -1
- package/src/update110900/index_spec.ts +0 -341
- package/src/update110900/schema.json +0 -23
- package/src/update111000/index.d.ts +0 -2
- package/src/update111000/index.js +0 -27
- package/src/update111000/index.js.map +0 -1
- package/src/update111000/index.ts +0 -27
- package/src/update111000/index_spec.d.ts +0 -1
- package/src/update111000/index_spec.js +0 -65
- package/src/update111000/index_spec.js.map +0 -1
- package/src/update111000/index_spec.ts +0 -70
- package/src/update111000/schema.json +0 -23
- package/src/update111100/index.d.ts +0 -2
- package/src/update111100/index.js +0 -389
- package/src/update111100/index.js.map +0 -1
- package/src/update111100/index.ts +0 -405
- package/src/update111100/index_spec.d.ts +0 -1
- package/src/update111100/index_spec.js +0 -66
- package/src/update111100/index_spec.js.map +0 -1
- package/src/update111100/index_spec.ts +0 -70
- package/src/update111100/schema.json +0 -23
- package/src/update111200/index.d.ts +0 -2
- package/src/update111200/index.js +0 -59
- package/src/update111200/index.js.map +0 -1
- package/src/update111200/index.ts +0 -75
- package/src/update111200/index_spec.d.ts +0 -1
- package/src/update111200/index_spec.js +0 -67
- package/src/update111200/index_spec.js.map +0 -1
- package/src/update111200/index_spec.ts +0 -71
- package/src/update111200/schema.json +0 -23
- package/src/update111300/index.d.ts +0 -2
- package/src/update111300/index.js +0 -27
- package/src/update111300/index.js.map +0 -1
- package/src/update111300/index.ts +0 -27
- package/src/update111300/index_spec.d.ts +0 -1
- package/src/update111300/index_spec.js +0 -65
- package/src/update111300/index_spec.js.map +0 -1
- package/src/update111300/index_spec.ts +0 -69
- package/src/update111300/schema.json +0 -23
package/src/utility/html.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { replaceAll } from './util';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const cheerio = require('cheerio');
|
|
4
|
+
const luxCheerioParserOptions = { xmlMode: true, decodeEntities: false, selfClosingTags: false };
|
|
5
|
+
const emptyPlaceholderToken = '@20c44b9d-45e1-447a-a141-1de0695c9c35@';
|
|
4
6
|
|
|
5
7
|
export class CheerioInfo {
|
|
6
8
|
content: string;
|
|
@@ -21,17 +23,18 @@ export class CheerioInfo {
|
|
|
21
23
|
* @param attrValue
|
|
22
24
|
*/
|
|
23
25
|
export function addAttribute(content: string, selector: string, attrName: string, attrValue: string): CheerioInfo {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const result = new CheerioInfo(
|
|
26
|
+
let newContent = preProcessing(content);
|
|
27
|
+
const $ = cheerio.load(newContent, luxCheerioParserOptions);
|
|
28
|
+
const result = new CheerioInfo(newContent);
|
|
27
29
|
|
|
28
30
|
$(selector).each(function (i, elem) {
|
|
29
|
-
$(elem).attr(attrName, attrValue);
|
|
31
|
+
$(elem).attr(attrName, attrValue ? attrValue : emptyPlaceholderToken);
|
|
30
32
|
result.updated = true;
|
|
31
33
|
});
|
|
32
34
|
|
|
33
35
|
if (result.updated) {
|
|
34
36
|
result.content = $.xml();
|
|
37
|
+
result.content = postProcessing(result.content);
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
return result;
|
|
@@ -46,17 +49,39 @@ export function addAttribute(content: string, selector: string, attrName: string
|
|
|
46
49
|
* @param attrValue
|
|
47
50
|
*/
|
|
48
51
|
export function appendAttribute(content: string, selector: string, attrName: string, attrValue: string): CheerioInfo {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const result = new CheerioInfo(
|
|
52
|
+
let newContent = preProcessing(content);
|
|
53
|
+
const $ = cheerio.load(newContent, luxCheerioParserOptions);
|
|
54
|
+
const result = new CheerioInfo(newContent);
|
|
52
55
|
|
|
53
56
|
$(selector).each(function (i, elem) {
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
const attrNameNoBinding = attrName;
|
|
58
|
+
if ($(elem).attr(attrNameNoBinding)) {
|
|
59
|
+
$(elem).attr(attrNameNoBinding, $(elem).attr(attrNameNoBinding) + attrValue);
|
|
60
|
+
result.updated = true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const attrNameDataBinding = '[' + attrName + ']';
|
|
64
|
+
if ($(elem).attr(attrNameDataBinding)) {
|
|
65
|
+
$(elem).attr(attrNameDataBinding, $(elem).attr(attrNameDataBinding) + attrValue);
|
|
66
|
+
result.updated = true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const attrNameTwoWayBinding = '[(' + attrName + ')]';
|
|
70
|
+
if ($(elem).attr(attrNameTwoWayBinding)) {
|
|
71
|
+
$(elem).attr(attrNameTwoWayBinding, $(elem).attr(attrNameTwoWayBinding) + attrValue);
|
|
72
|
+
result.updated = true;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const attrNameEventBinding = '(' + attrName + ')';
|
|
76
|
+
if ($(elem).attr(attrNameEventBinding)) {
|
|
77
|
+
$(elem).attr(attrNameEventBinding, $(elem).attr(attrNameEventBinding) + attrValue);
|
|
78
|
+
result.updated = true;
|
|
79
|
+
}
|
|
56
80
|
});
|
|
57
81
|
|
|
58
82
|
if (result.updated) {
|
|
59
83
|
result.content = $.xml();
|
|
84
|
+
result.content = postProcessing(result.content);
|
|
60
85
|
}
|
|
61
86
|
|
|
62
87
|
return result;
|
|
@@ -70,10 +95,16 @@ export function appendAttribute(content: string, selector: string, attrName: str
|
|
|
70
95
|
* @param attrNameOld Ein beliebiger Attributname (z.B. luxItem).
|
|
71
96
|
* @param attrNameNew Ein beliebiger neuer Attributname.
|
|
72
97
|
*/
|
|
73
|
-
export function renameAttribute(
|
|
74
|
-
|
|
98
|
+
export function renameAttribute(
|
|
99
|
+
content: string,
|
|
100
|
+
selector: string,
|
|
101
|
+
attrNameOld: string,
|
|
102
|
+
attrNameNew: string
|
|
103
|
+
): CheerioInfo {
|
|
104
|
+
let newContent = preProcessing(content);
|
|
105
|
+
const $ = cheerio.load(newContent, luxCheerioParserOptions);
|
|
75
106
|
|
|
76
|
-
const result = new CheerioInfo(
|
|
107
|
+
const result = new CheerioInfo(newContent);
|
|
77
108
|
|
|
78
109
|
$(selector).each(function (i, elem) {
|
|
79
110
|
const attrNameNoBindingOld = attrNameOld;
|
|
@@ -81,7 +112,7 @@ export function renameAttribute( content: string, selector: string, attrNameO
|
|
|
81
112
|
const attrValueNoBinding = $(elem).attr(attrNameNoBindingOld);
|
|
82
113
|
if (attrValueNoBinding) {
|
|
83
114
|
$(elem).removeAttr(attrNameNoBindingOld);
|
|
84
|
-
$(elem).attr(attrNameNoBindingNew, attrValueNoBinding);
|
|
115
|
+
$(elem).attr(attrNameNoBindingNew, attrValueNoBinding ? attrValueNoBinding : emptyPlaceholderToken);
|
|
85
116
|
result.updated = true;
|
|
86
117
|
}
|
|
87
118
|
|
|
@@ -90,7 +121,7 @@ export function renameAttribute( content: string, selector: string, attrNameO
|
|
|
90
121
|
const attrNameDataBindingValue = $(elem).attr(attrNameDataBindingOld);
|
|
91
122
|
if (attrNameDataBindingValue) {
|
|
92
123
|
$(elem).removeAttr(attrNameDataBindingOld);
|
|
93
|
-
$(elem).attr(attrNameDataBindingNew, attrNameDataBindingValue);
|
|
124
|
+
$(elem).attr(attrNameDataBindingNew, attrNameDataBindingValue ? attrNameDataBindingValue : emptyPlaceholderToken);
|
|
94
125
|
result.updated = true;
|
|
95
126
|
}
|
|
96
127
|
|
|
@@ -99,7 +130,7 @@ export function renameAttribute( content: string, selector: string, attrNameO
|
|
|
99
130
|
const attrValueTwoWayBinding = $(elem).attr(attrNameTwoWayBindingOld);
|
|
100
131
|
if (attrValueTwoWayBinding) {
|
|
101
132
|
$(elem).removeAttr(attrNameTwoWayBindingOld);
|
|
102
|
-
$(elem).attr(attrNameTwoWayBindingNew, attrValueTwoWayBinding);
|
|
133
|
+
$(elem).attr(attrNameTwoWayBindingNew, attrValueTwoWayBinding ? attrValueTwoWayBinding : emptyPlaceholderToken);
|
|
103
134
|
result.updated = true;
|
|
104
135
|
}
|
|
105
136
|
|
|
@@ -108,13 +139,14 @@ export function renameAttribute( content: string, selector: string, attrNameO
|
|
|
108
139
|
const attrValueEventBinding = $(elem).attr(attrNameEventBindingOld);
|
|
109
140
|
if (attrValueEventBinding) {
|
|
110
141
|
$(elem).removeAttr(attrNameEventBindingOld);
|
|
111
|
-
$(elem).attr(attrNameEventBindingNew, attrValueEventBinding);
|
|
142
|
+
$(elem).attr(attrNameEventBindingNew, attrValueEventBinding ? attrValueEventBinding : emptyPlaceholderToken);
|
|
112
143
|
result.updated = true;
|
|
113
144
|
}
|
|
114
145
|
});
|
|
115
146
|
|
|
116
147
|
if (result.updated) {
|
|
117
148
|
result.content = $.xml();
|
|
149
|
+
result.content = postProcessing(result.content);
|
|
118
150
|
}
|
|
119
151
|
|
|
120
152
|
return result;
|
|
@@ -129,38 +161,40 @@ export function renameAttribute( content: string, selector: string, attrNameO
|
|
|
129
161
|
* @param attrValue Ein beliebiger Wert.
|
|
130
162
|
*/
|
|
131
163
|
export function updateAttribute(content: string, selector: string, attrName: string, attrValue: string): CheerioInfo {
|
|
132
|
-
|
|
164
|
+
let newContent = preProcessing(content);
|
|
165
|
+
const $ = cheerio.load(newContent, luxCheerioParserOptions);
|
|
133
166
|
|
|
134
|
-
const result = new CheerioInfo(
|
|
167
|
+
const result = new CheerioInfo(newContent);
|
|
135
168
|
|
|
136
169
|
$(selector).each(function (i, elem) {
|
|
137
170
|
const attrNameNoBinding = attrName;
|
|
138
171
|
if ($(elem).attr(attrNameNoBinding)) {
|
|
139
|
-
$(elem).attr(attrNameNoBinding, attrValue);
|
|
172
|
+
$(elem).attr(attrNameNoBinding, attrValue ? attrValue : emptyPlaceholderToken);
|
|
140
173
|
result.updated = true;
|
|
141
174
|
}
|
|
142
175
|
|
|
143
176
|
const attrNameDataBinding = '[' + attrName + ']';
|
|
144
177
|
if ($(elem).attr(attrNameDataBinding)) {
|
|
145
|
-
$(elem).attr(attrNameDataBinding, attrValue);
|
|
178
|
+
$(elem).attr(attrNameDataBinding, attrValue ? attrValue : emptyPlaceholderToken);
|
|
146
179
|
result.updated = true;
|
|
147
180
|
}
|
|
148
181
|
|
|
149
182
|
const attrNameTwoWayBinding = '[(' + attrName + ')]';
|
|
150
183
|
if ($(elem).attr(attrNameTwoWayBinding)) {
|
|
151
|
-
$(elem).attr(attrNameTwoWayBinding, attrValue);
|
|
184
|
+
$(elem).attr(attrNameTwoWayBinding, attrValue ? attrValue : emptyPlaceholderToken);
|
|
152
185
|
result.updated = true;
|
|
153
186
|
}
|
|
154
187
|
|
|
155
188
|
const attrNameEventBinding = '(' + attrName + ')';
|
|
156
189
|
if ($(elem).attr(attrNameEventBinding)) {
|
|
157
|
-
$(elem).attr(attrNameEventBinding, attrValue);
|
|
190
|
+
$(elem).attr(attrNameEventBinding, attrValue ? attrValue : emptyPlaceholderToken);
|
|
158
191
|
result.updated = true;
|
|
159
192
|
}
|
|
160
193
|
});
|
|
161
194
|
|
|
162
195
|
if (result.updated) {
|
|
163
196
|
result.content = $.xml();
|
|
197
|
+
result.content = postProcessing(result.content);
|
|
164
198
|
}
|
|
165
199
|
|
|
166
200
|
return result;
|
|
@@ -174,39 +208,81 @@ export function updateAttribute(content: string, selector: string, attrName: str
|
|
|
174
208
|
* @param attrName Ein beliebiger Attributname (z.B. luxListItem).
|
|
175
209
|
*/
|
|
176
210
|
export function removeAttribute(content: string, selector: string, attrName: string): CheerioInfo {
|
|
177
|
-
|
|
211
|
+
let newContent = preProcessing(content);
|
|
212
|
+
const $ = cheerio.load(newContent, luxCheerioParserOptions);
|
|
178
213
|
|
|
179
|
-
const result = new CheerioInfo(
|
|
214
|
+
const result = new CheerioInfo(newContent);
|
|
180
215
|
|
|
181
216
|
$(selector).each(function (i, elem) {
|
|
182
217
|
const attrNameNoBinding = attrName;
|
|
218
|
+
let updated = false;
|
|
219
|
+
|
|
183
220
|
if ($(elem).attr(attrNameNoBinding)) {
|
|
184
221
|
$(elem).removeAttr(attrNameNoBinding);
|
|
185
|
-
|
|
222
|
+
updated = true;
|
|
186
223
|
}
|
|
187
224
|
|
|
188
225
|
const attrNameDataBinding = '[' + attrName + ']';
|
|
189
226
|
if ($(elem).attr(attrNameDataBinding)) {
|
|
190
227
|
$(elem).removeAttr(attrNameDataBinding);
|
|
191
|
-
|
|
228
|
+
updated = true;
|
|
192
229
|
}
|
|
193
230
|
|
|
194
231
|
const attrNameTwoWayBinding = '[(' + attrName + ')]';
|
|
195
232
|
if ($(elem).attr(attrNameTwoWayBinding)) {
|
|
196
233
|
$(elem).removeAttr(attrNameTwoWayBinding);
|
|
197
|
-
|
|
234
|
+
updated = true;
|
|
198
235
|
}
|
|
199
236
|
|
|
200
237
|
const attrNameEventBinding = '(' + attrName + ')';
|
|
201
238
|
if ($(elem).attr(attrNameEventBinding)) {
|
|
202
239
|
$(elem).removeAttr(attrNameEventBinding);
|
|
240
|
+
updated = true;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (updated) {
|
|
203
244
|
result.updated = true;
|
|
204
245
|
}
|
|
205
246
|
});
|
|
206
247
|
|
|
207
248
|
if (result.updated) {
|
|
208
249
|
result.content = $.xml();
|
|
250
|
+
result.content = postProcessing(result.content);
|
|
209
251
|
}
|
|
210
252
|
|
|
211
253
|
return result;
|
|
212
254
|
}
|
|
255
|
+
|
|
256
|
+
function preProcessing(content: string) {
|
|
257
|
+
return replaceAll(content, '=""', `="${emptyPlaceholderToken}"`);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function postProcessing(content: string) {
|
|
261
|
+
let resultContent = content;
|
|
262
|
+
|
|
263
|
+
// Entferne alle leeren Werte die von Cheerio hinzugefügt wurden.
|
|
264
|
+
resultContent = replaceAll(resultContent, `=""`, '');
|
|
265
|
+
// Setze alle Attribute wieder auf leer (="") die initial bereits leer waren oder gezielt auf leer gesetzt wurden.
|
|
266
|
+
resultContent = replaceAll(resultContent, `${emptyPlaceholderToken}`, '');
|
|
267
|
+
// Entferne alle Closing-Tags von den Void-Tags.
|
|
268
|
+
resultContent = replaceAll(resultContent, '</input>', '');
|
|
269
|
+
resultContent = replaceAll(resultContent, '</area>', '');
|
|
270
|
+
resultContent = replaceAll(resultContent, '</br>', '');
|
|
271
|
+
resultContent = replaceAll(resultContent, '</base>', '');
|
|
272
|
+
resultContent = replaceAll(resultContent, '</col>', '');
|
|
273
|
+
resultContent = replaceAll(resultContent, '</embed>', '');
|
|
274
|
+
resultContent = replaceAll(resultContent, '</hr>', '');
|
|
275
|
+
resultContent = replaceAll(resultContent, '</img>', '');
|
|
276
|
+
resultContent = replaceAll(resultContent, '</link>', '');
|
|
277
|
+
resultContent = replaceAll(resultContent, '</meta>', '');
|
|
278
|
+
resultContent = replaceAll(resultContent, '</param>', '');
|
|
279
|
+
resultContent = replaceAll(resultContent, '</source>', '');
|
|
280
|
+
resultContent = replaceAll(resultContent, '</track>', '');
|
|
281
|
+
resultContent = replaceAll(resultContent, '</wbr>', '');
|
|
282
|
+
|
|
283
|
+
return resultContent;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
const getAllAttributes = function (node) {
|
|
287
|
+
return node.attributes || Object.keys(node.attribs).map((name) => ({ name, value: node.attribs[name] }));
|
|
288
|
+
};
|
|
File without changes
|