Bug 130161 - Web Inspector: Classname stuff in WebInspector.displayNameForNode should join DOMTokenList classList instead of using string parsing and concatenation
Summary: Web Inspector: Classname stuff in WebInspector.displayNameForNode should join...
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-12 15:38 PDT by James Craig
Modified: 2014-03-13 09:25 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James Craig 2014-03-12 15:38:40 PDT
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;
            }
        }
    }
Comment 1 Timothy Hatcher 2014-03-12 17:11:28 PDT
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.
Comment 2 James Craig 2014-03-13 09:25:50 PDT
Gotcha. Makes sense.