Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.

Commit ccbc9d8

Browse files
authored
Merge pull request #478 from devtools-html/actor-id
Add an actor id data attribute on tree-node
2 parents bede79a + 0e14bf1 commit ccbc9d8

40 files changed

+269
-67
lines changed

packages/devtools-reps/src/reps/attribute.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ function Attribute(props) {
3131
let value = object.preview.value;
3232

3333
return (
34-
safeObjectLink(props, {className: "objectLink-Attr"},
34+
safeObjectLink(props, {
35+
className: "objectLink-Attr",
36+
"data-link-actor-id": object.actor,
37+
},
3538
span({className: "attrTitle"},
3639
getTitle(object)
3740
),

packages/devtools-reps/src/reps/comment-node.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ function CommentNode(props) {
3838
textContent = cropString(textContent, 50);
3939
}
4040

41-
return span({className: "objectBox theme-comment"}, `<!-- ${textContent} -->`);
41+
return span({
42+
className: "objectBox theme-comment",
43+
"data-link-actor-id": object.actor,
44+
}, `<!-- ${textContent} -->`);
4245
}
4346

4447
// Registration

packages/devtools-reps/src/reps/date-time.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ function DateTime(props) {
2727
let grip = props.object;
2828
let date;
2929
try {
30-
date = span({className: "objectBox"},
30+
date = span({
31+
"data-link-actor-id": grip.actor,
32+
className: "objectBox",
33+
},
3134
getTitle(props, grip),
3235
span({className: "Date"},
3336
new Date(grip.preview.timestamp).toISOString()

packages/devtools-reps/src/reps/document.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ function Document(props) {
2828
let grip = props.object;
2929

3030
return (
31-
span({className: "objectBox objectBox-object"},
31+
span({
32+
"data-link-actor-id": grip.actor,
33+
className: "objectBox objectBox-object"
34+
},
3235
getTitle(props, grip),
3336
span({className: "objectPropValue"},
3437
getLocation(grip)

packages/devtools-reps/src/reps/element-node.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ function ElementNode(props) {
4343

4444
let isInTree = object.preview && object.preview.isConnected === true;
4545

46-
let baseConfig = {className: "objectBox objectBox-node"};
46+
let baseConfig = {
47+
"data-link-actor-id": object.actor,
48+
className: "objectBox objectBox-node"
49+
};
4750
let inspectIcon;
4851
if (isInTree) {
4952
if (onDOMNodeMouseOver) {

packages/devtools-reps/src/reps/error.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ function ErrorRep(props) {
4242
content = `${content}\nStack trace:\n${preview.stack}`;
4343
}
4444

45-
return safeObjectLink(props, {className: "objectBox-stackTrace"}, content);
45+
return safeObjectLink(props, {
46+
"data-link-actor-id": object.actor,
47+
className: "objectBox-stackTrace",
48+
}, content);
4649
}
4750

4851
// Registration

packages/devtools-reps/src/reps/function.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ function FunctionRep(props) {
2929
let grip = props.object;
3030

3131
return (
32-
// Set dir="ltr" to prevent function parentheses from
33-
// appearing in the wrong direction
34-
span({dir: "ltr", className: "objectBox objectBox-function"},
32+
span({
33+
"data-link-actor-id": grip.actor,
34+
className: "objectBox objectBox-function",
35+
// Set dir="ltr" to prevent function parentheses from
36+
// appearing in the wrong direction
37+
dir: "ltr",
38+
},
3539
getTitle(props, grip),
3640
summarizeFunction(grip),
3741
"(",

packages/devtools-reps/src/reps/grip-array.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ function GripArray(props) {
4545
if (mode === MODE.TINY) {
4646
let objectLength = getLength(object);
4747
let isEmpty = objectLength === 0;
48-
items = [span({className: "length"}, isEmpty ? "" : objectLength)];
48+
items = [span({
49+
className: "length",
50+
}, isEmpty ? "" : objectLength)];
4951
brackets = needSpace(false);
5052
} else {
5153
let max = maxLengthMap.get(mode);
@@ -57,6 +59,7 @@ function GripArray(props) {
5759

5860
return (
5961
span({
62+
"data-link-actor-id": object.actor,
6063
className: "objectBox objectBox-array"},
6164
title,
6265
safeObjectLink(props, {

packages/devtools-reps/src/reps/grip-map.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,21 @@ function GripMap(props) {
3737
object,
3838
} = props;
3939

40+
const config = {
41+
"data-link-actor-id": object.actor,
42+
className: "objectBox objectBox-object",
43+
};
44+
4045
if (mode === MODE.TINY) {
4146
return (
42-
span({className: "objectBox objectBox-object"},
43-
getTitle(props, object)
44-
)
47+
span(config, getTitle(props, object))
4548
);
4649
}
4750

4851
let propsArray = safeEntriesIterator(props, object, maxLengthMap.get(mode));
4952

5053
return (
51-
span({className: "objectBox objectBox-object"},
54+
span(config,
5255
getTitle(props, object),
5356
safeObjectLink(props, {
5457
className: "objectLeftBrace",

packages/devtools-reps/src/reps/grip.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,21 @@ function GripRep(props) {
4040
object,
4141
} = props;
4242

43+
const config = {
44+
"data-link-actor-id": object.actor,
45+
className: "objectBox objectBox-object"
46+
};
47+
4348
if (mode === MODE.TINY) {
4449
return (
45-
span({className: "objectBox objectBox-object"},
46-
getTitle(props, object)
47-
)
50+
span(config, getTitle(props, object))
4851
);
4952
}
5053

5154
let propsArray = safePropIterator(props, object, maxLengthMap.get(mode));
5255

5356
return (
54-
span({className: "objectBox objectBox-object"},
57+
span(config,
5558
getTitle(props, object),
5659
safeObjectLink(props, {
5760
className: "objectLeftBrace",

0 commit comments

Comments
 (0)