clarity-visualize 0.8.59 → 0.8.60-beta
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.
|
@@ -153,7 +153,7 @@ function reset$8() {
|
|
|
153
153
|
function get$1(input, type) {
|
|
154
154
|
var a = input.attributes;
|
|
155
155
|
var prefix = input.prefix ? input.prefix[type] : null;
|
|
156
|
-
var suffix = type === 0 /* Selector.Alpha */ ? "
|
|
156
|
+
var suffix = type === 0 /* Selector.Alpha */ ? "~" /* Constant.Tilde */ + (input.position - 1) : ":nth-of-type(" + input.position + ")";
|
|
157
157
|
switch (input.tag) {
|
|
158
158
|
case "STYLE":
|
|
159
159
|
case "TITLE":
|
|
@@ -168,39 +168,39 @@ function get$1(input, type) {
|
|
|
168
168
|
if (prefix === null) {
|
|
169
169
|
return "" /* Constant.Empty */;
|
|
170
170
|
}
|
|
171
|
-
prefix =
|
|
171
|
+
prefix = prefix + ">" /* Constant.Separator */;
|
|
172
172
|
input.tag = input.tag.indexOf("svg:" /* Constant.SvgPrefix */) === 0 ? input.tag.substr("svg:" /* Constant.SvgPrefix */.length) : input.tag;
|
|
173
|
-
var selector =
|
|
173
|
+
var selector = prefix + input.tag + suffix;
|
|
174
174
|
var id = "id" /* Constant.Id */ in a && a["id" /* Constant.Id */].length > 0 ? a["id" /* Constant.Id */] : null;
|
|
175
175
|
var classes = input.tag !== "BODY" /* Constant.BodyTag */ && "class" /* Constant.Class */ in a && a["class" /* Constant.Class */].length > 0 ? a["class" /* Constant.Class */].trim().split(/\s+/).filter(function (c) { return filter(c); }).join("." /* Constant.Period */) : null;
|
|
176
176
|
if (classes && classes.length > 0) {
|
|
177
177
|
if (type === 0 /* Selector.Alpha */) {
|
|
178
178
|
// In Alpha mode, update selector to use class names, with relative positioning within the parent id container.
|
|
179
179
|
// If the node has valid class name(s) then drop relative positioning within the parent path to keep things simple.
|
|
180
|
-
var key =
|
|
180
|
+
var key = getDomPath(prefix) + input.tag + "." /* Constant.Dot */ + classes;
|
|
181
181
|
if (!(key in selectorMap)) {
|
|
182
182
|
selectorMap[key] = [];
|
|
183
183
|
}
|
|
184
|
-
if (selectorMap[key].
|
|
184
|
+
if (!selectorMap[key].includes(input.id)) {
|
|
185
185
|
selectorMap[key].push(input.id);
|
|
186
186
|
}
|
|
187
|
-
selector =
|
|
187
|
+
selector = key + "~" /* Constant.Tilde */ + selectorMap[key].indexOf(input.id);
|
|
188
188
|
}
|
|
189
189
|
else {
|
|
190
190
|
// In Beta mode, we continue to look at query selectors in context of the full page
|
|
191
|
-
selector =
|
|
191
|
+
selector = prefix + input.tag + "." + classes + suffix;
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
// Update selector to use "id" field when available. There are two exceptions:
|
|
195
195
|
// (1) if "id" appears to be an auto generated string token, e.g. guid or a random id containing digits
|
|
196
196
|
// (2) if "id" appears inside a shadow DOM, in which case we continue to prefix up to shadow DOM to prevent conflicts
|
|
197
|
-
selector = id && filter(id) ?
|
|
197
|
+
selector = id && filter(id) ? getDomPrefix(prefix) + "#" /* Constant.Hash */ + id : selector;
|
|
198
198
|
return selector;
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
function getDomPrefix(prefix) {
|
|
202
202
|
var shadowDomStart = prefix.lastIndexOf("*S" /* Constant.ShadowDomTag */);
|
|
203
|
-
var iframeDomStart = prefix.lastIndexOf("
|
|
203
|
+
var iframeDomStart = prefix.lastIndexOf("iframe:" /* Constant.IFramePrefix */ + "HTML" /* Constant.HTML */);
|
|
204
204
|
var domStart = Math.max(shadowDomStart, iframeDomStart);
|
|
205
205
|
if (domStart < 0) {
|
|
206
206
|
return "" /* Constant.Empty */;
|
|
@@ -221,7 +221,7 @@ function filter(value) {
|
|
|
221
221
|
if (!value) {
|
|
222
222
|
return false;
|
|
223
223
|
} // Do not process empty strings
|
|
224
|
-
if (excludeClassNames.some(function (x) { return value.toLowerCase().
|
|
224
|
+
if (excludeClassNames.some(function (x) { return value.toLowerCase().includes(x); })) {
|
|
225
225
|
return false;
|
|
226
226
|
}
|
|
227
227
|
for (var i = 0; i < value.length; i++) {
|