Chromium Code Reviews| Index: Source/devtools/front_end/DOMAgent.js |
| diff --git a/Source/devtools/front_end/DOMAgent.js b/Source/devtools/front_end/DOMAgent.js |
| index b0c400dca0579c816f17ca8a9216138f18c33b47..3f2e5ff5c4414fbd92069a3b1fbc80cea216a1db 100644 |
| --- a/Source/devtools/front_end/DOMAgent.js |
| +++ b/Source/devtools/front_end/DOMAgent.js |
| @@ -272,6 +272,9 @@ WebInspector.DOMNode.prototype = { |
| */ |
| nodeNameInCorrectCase: function() |
| { |
| + var shadowRootType = this.shadowRootType(); |
| + if (shadowRootType) |
| + return "#shadow-root" + (shadowRootType === WebInspector.DOMNode.ShadowRootTypes.UserAgent ? " (user-agent)" : ""); |
| return this.isXMLNode() ? this.nodeName() : this.nodeName().toLowerCase(); |
| }, |
| @@ -466,10 +469,19 @@ WebInspector.DOMNode.prototype = { |
| */ |
| path: function() |
| { |
| + /** |
| + * @param {?WebInspector.DOMNode} node |
| + */ |
| + function canPush(node) |
| + { |
| + return node && ("index" in node || (node.isShadowRoot() && node.parentNode)) && node._nodeName.length; |
| + } |
| + |
| var path = []; |
| var node = this; |
| - while (node && "index" in node && node._nodeName.length) { |
| - path.push([node.index, node._nodeName]); |
| + while (canPush(node)) { |
| + var index = typeof node.index === "number" ? node.index : (node.shadowRootType() === WebInspector.DOMNode.ShadowRootTypes.UserAgent ? "u" : "a"); |
|
pfeldman
2014/03/21 15:02:52
Where is this used though?
apavlov
2014/03/21 15:26:46
This is used in WebInspector.DOMNode.prototype.pat
|
| + path.push([index, node._nodeName]); |
| node = node.parentNode; |
| } |
| path.reverse(); |