Demo/bin/Debug/front_end/network/XMLView.js

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
 * @constructor
 * @extends {WebInspector.Widget}
 * @param {!Document} parsedXML
 */
WebInspector.XMLView = function(parsedXML)
{
    WebInspector.Widget.call(this, true);
    this.registerRequiredCSS("network/xmlView.css");
    this.contentElement.classList.add("shadow-xml-view", "source-code");
    var treeOutline = new TreeOutline();
    this.contentElement.appendChild(treeOutline.element);
    WebInspector.XMLView.Node.populate(treeOutline, parsedXML);
}

/**
 * @param {string} text
 * @param {string} mimeType
 * @return {?Document}
 */
WebInspector.XMLView.parseXML = function(text, mimeType)
{
    var parsedXML;
    try {
        parsedXML = (new DOMParser()).parseFromString(text, mimeType);
    } catch (e) {
        return null;
    }
    if (parsedXML.body)
        return null;
    return parsedXML;
}

WebInspector.XMLView.prototype = {
    __proto__: WebInspector.Widget.prototype
}

/**
 * @constructor
 * @extends {TreeElement}
 * @param {!Node} node
 * @param {boolean} closeTag
 */
WebInspector.XMLView.Node = function(node, closeTag)
{
    TreeElement.call(this, "", !closeTag && !!node.childElementCount);
    this._node = node;
    this._closeTag = closeTag;
    this.selectable = false;
    this._updateTitle();
}

/**
 * @param {!TreeOutline|!TreeElement} root
 * @param {!Node} xmlNode
 */
后面还有 109 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。