OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. |
3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 var node = this; | 453 var node = this; |
454 while (node && "index" in node && node._nodeName.length) { | 454 while (node && "index" in node && node._nodeName.length) { |
455 path.push([node.index, node._nodeName]); | 455 path.push([node.index, node._nodeName]); |
456 node = node.parentNode; | 456 node = node.parentNode; |
457 } | 457 } |
458 path.reverse(); | 458 path.reverse(); |
459 return path.join(","); | 459 return path.join(","); |
460 }, | 460 }, |
461 | 461 |
462 /** | 462 /** |
463 * @param {boolean} justSelector | |
464 * @return {string} | |
465 */ | |
466 appropriateSelectorFor: function(justSelector) | |
467 { | |
468 var lowerCaseName = this.localName() || this.nodeName().toLowerCase(); | |
469 | |
470 var id = this.getAttribute("id"); | |
471 if (id) { | |
472 var selector = "#" + id; | |
473 return (justSelector ? selector : lowerCaseName + selector); | |
474 } | |
475 | |
476 var className = this.getAttribute("class"); | |
477 if (className) { | |
478 var selector = "." + className.trim().replace(/\s+/g, "."); | |
479 return (justSelector ? selector : lowerCaseName + selector); | |
480 } | |
481 | |
482 if (lowerCaseName === "input" && this.getAttribute("type")) | |
483 return lowerCaseName + "[type=\"" + this.getAttribute("type") + "\"]
"; | |
484 | |
485 return lowerCaseName; | |
486 }, | |
487 | |
488 /** | |
489 * @param {WebInspector.DOMNode} node | 463 * @param {WebInspector.DOMNode} node |
490 * @return {boolean} | 464 * @return {boolean} |
491 */ | 465 */ |
492 isAncestor: function(node) | 466 isAncestor: function(node) |
493 { | 467 { |
494 if (!node) | 468 if (!node) |
495 return false; | 469 return false; |
496 | 470 |
497 var currentNode = node.parentNode; | 471 var currentNode = node.parentNode; |
498 while (currentNode) { | 472 while (currentNode) { |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1749 setInspectModeEnabled: function(enabled, inspectShadowDOM, config, callback) | 1723 setInspectModeEnabled: function(enabled, inspectShadowDOM, config, callback) |
1750 { | 1724 { |
1751 DOMAgent.setInspectModeEnabled(enabled, inspectShadowDOM, config, callba
ck); | 1725 DOMAgent.setInspectModeEnabled(enabled, inspectShadowDOM, config, callba
ck); |
1752 } | 1726 } |
1753 } | 1727 } |
1754 | 1728 |
1755 /** | 1729 /** |
1756 * @type {?WebInspector.DOMAgent} | 1730 * @type {?WebInspector.DOMAgent} |
1757 */ | 1731 */ |
1758 WebInspector.domAgent = null; | 1732 WebInspector.domAgent = null; |
OLD | NEW |