简体   繁体   English

为什么Inspector开发人员工具无法反映所有代码?

[英]Why does Inspector developer tool not reflect all code?

Following this tutorial , I am trying to include cytoscape.js into a super basic web page. 在学习完本教程之后 ,我试图将cytoscape.js包含到一个超级基本的网页中。 I downloaded cytoscape via npm install cytoscape , and copied cytoscape/dist/cytoscape.js into my project directory. 我通过npm install cytoscape下载了cytoscape,并将cytoscape/dist/cytoscape.js复制到了我的项目目录中。 The directory looks like: 目录如下:

Kyles-MBP:Desktop kyleweise$ tree testing-cytoscape/
testing-cytoscape/
├── cytoscape.js
└── index.html

I have basically copied what appears in the tutorial, and index.html looks like: 我基本上已经复制了教程中显示的内容,并且index.html看起来像:

<!doctype html>

<html>

<head>
  <meta charset="UTF-8"/>
  <title>Tutorial 1: Getting Started</title>
  <script src="cytoscape.js"></script>
</head>

<style>
    #cy {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0px;
        left: 0px;
    }
</style>

<body>
    <div id="cy"></div>
    <script>
      var cy = cytoscape({
        container: document.getElementById('cy'),
        elements: [
          { data: { id: 'a' } },
          { data: { id: 'b' } },
          {
            data: {
              id: 'ab',
              source: 'a',
              target: 'b'
            }
          }]
      });
    </script>
</body>
</html>

However, when I try to view the file via a web browser (I've tried Chrome, Safari, and Firefox), I see nothing. 但是,当我尝试通过Web浏览器(尝试过Chrome,Safari和Firefox)查看文件时,什么也看不到。 When I view the developer tools in whichever browser, the HTML does not match that of my index.html file. 当我在任何浏览器中查看开发人员工具时,HTML与我的index.html文件都不匹配。 Specifically, the <meta charset = "UTF-8"> does not show up, and the <body> tag is empty. 具体来说, <meta charset = "UTF-8">不出现,并且<body>标记为空。 I am very new to web development and JavaScript, so I am not sure what I am doing wrong here. 我是Web开发和JavaScript的新手,所以不确定在这里做错了什么。 Why doesn't the index.html, when viewed in the browser, match what I have written in my text editor and how can I get this to display the graph? 为什么在浏览器中查看index.html,时,它与我在文本编辑器中编写的内容不匹配,并且如何获取它以显示图形?

Your code seems to be correct. 您的代码似乎是正确的。

Anyway I suggest to use the citoscape cdn: 无论如何,我建议使用citoscape CDN:

https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.2.14/cytoscape.js https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.2.14/cytoscape.js

or 要么

https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.2.14/cytoscape.min.js for the minified version. https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.2.14/cytoscape.min.js为缩小版。

and it works 它有效

 var cy = cytoscape({ container: document.getElementById('cy'), elements: [ { data: { id: 'a' } }, { data: { id: 'b' } }, { data: { id: 'ab', source: 'a', target: 'b' } }] }); 
  #cy { width: 100%; height: 100%; position: absolute; top: 0px; left: 0px; } 
 <script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.2.14/cytoscape.min.js"></script> <div id="cy"></div> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么在 class“实例”object 中通过引用存储元素的更改不会立即反映在(Firefox)代码检查器中? - Why changes to element stored by reference in a class "instance" object do not immediately reflect in (Firefox) code inspector? Microsoft Edge 开发人员工具是否允许集成外部程序/代码 - Does Microsoft Edge Developer tool allow for integration of external programs/code Chrome 开发人员工具没有捕获在网络选项卡中提交的表单,为什么? - Chrome developer tool does Not capture a form submit in network tab, Why? 为什么 chrome 开发者工具不显示 WhatsApp 网络应用程序请求? - Why chrome developer tool does not show WhatsApp web app requests? 为什么我的js代码没有反映正确的运行时值? - why does'nt my js code reflect the right runtime value? chrome开发人员工具源代码 - chrome developer tool source code 为什么chrome开发者工具中的缓存存储在离线模式下变空了 - Why does the cache storage in chrome developer tool becomes empty in offline mode Firefox文档检查器,Firebug和Webkit开发人员工具(Chrome / Safari)无法更新HTML以反映通过AJAX加载的复选框的选中状态 - Firefox Document Inspector, Firebug & Webkit Developer Tools (Chrome/Safari) not updating HTML to reflect checked status of checkboxes loaded via AJAX 为什么变量 with.substring() 不反映 css 样式? - Why does a variable with .substring() not reflect css styling? 如何配置chrome developer工具不调试所有扩展脚本 - how to configure chrome developer tool not to debug all extension scripts
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM