Bug 130161
| Summary: | Web Inspector: Classname stuff in WebInspector.displayNameForNode should join DOMTokenList classList instead of using string parsing and concatenation | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | James Craig <jcraig> |
| Component: | Web Inspector | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED WONTFIX | ||
| Severity: | Normal | CC: | graouts, joepeck, timothy, webkit-bug-importer |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | All | ||
| OS: | All | ||
James Craig
Web Inspector: Classname stuff in WebInspector.displayNameForNode should join DOMTokenList classList instead of using string parsing and concatenation. Unless I'm missing something, I expect this was just written before DOMTokenList classList was available.
var classAttribute = node.getAttribute("class");
if (classAttribute) {
var classes = classAttribute.trim().split(/\s+/);
var foundClasses = {};
for (var i = 0; i < classes.length; ++i) {
var className = classes[i];
if (className && !(className in foundClasses)) {
title += "." + className;
foundClasses[className] = true;
}
}
}
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Timothy Hatcher
node is not a real DOMNode, it is our DOMNode proxy. So we don't have access to classList unless we go to the injected script for it. That is why we do what we do here.
James Craig
Gotcha. Makes sense.