Skip to content

Update 1-js/03-code-quality/01-debugging-chrome #539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 3, 2019

Conversation

MartinsYong
Copy link
Member

目标章节:1-js/03-code-quality/01-debugging-chrome

当前上游最新 commit:f073dbd

所做更改如下:

文件名 参考上游 commit 更改(理由)
article.md b7c20c3 更新翻译

@MartinsYong MartinsYong changed the title [WIP]Update 1-js/03-code-quality/01-debugging-chrome Update 1-js/03-code-quality/01-debugging-chrome Nov 27, 2019
@leviding leviding self-requested a review November 29, 2019 01:01
@leviding leviding self-assigned this Nov 29, 2019
Copy link
Collaborator

@lycheeEng lycheeEng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

校对完成

1. **资源区域**列出了 html、javascript、css 和包括图片在内的页面需要的其他文件。Chrome 扩展的资源也会出现在这。
2. **源区域**展示源码。
3. **信息和控制区域**是用来调试的,我们很快就会来探讨它。
1. **资源区域(resources zone)** 列出了 html、javascript、css 和包括图片在内的页面需要的其他文件。Chrome 扩展的资源也会出现在这。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的 html javascript 和 css 是否要大写?


<span class="devtools" style="background-position:-137px -76px"></span> —— 下一步(运行下一个命令),但是**不会进入函数**,快捷键 `key:F10`。
: 如果我们现在点击它,`alert` 会被显示出来。注意这里 `alert` 可以是任何函数,执行器会 “跨过(step over)”,跳过函数的内部。
<span class="devtools" style="background-position:-4px -194px"></span> —— 步入(step into),快捷键 `key:F11`。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

步入(step into) 这里需要一个双引号且 s 大写

Copy link
Member

@leviding leviding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MartinsYong 麻烦看一下

@@ -2,13 +2,13 @@

在编写更复杂的代码前,让我们先来聊聊调试吧。

所有的现代浏览器和大多数其他环境都支持“调试” —— 开发者工具中的一个特殊的 UI,可以让你更容易地发现和修复错误
[调试](https://en.wikipedia.org/wiki/Debugging) 是指在一个脚本中找出并修复错误的过程。所有的现代浏览器和大多数其他环境都支持调试工具 —— 开发者工具中的一个令调试更加容易的特殊用户界面。它也可以让我们一步步地跟踪代码并查看当前实际运行情况
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[调试](https://en.wikipedia.org/wiki/Debugging) 是指在一个脚本中找出并修复错误的过程。所有的现代浏览器和大多数其他环境都支持调试工具 — 开发者工具中的一个令调试更加容易的特殊用户界面。它也可以让我们一步步地跟踪代码并查看当前实际运行情况
[调试](https://en.wikipedia.org/wiki/Debugging) 是指在一个脚本中找出并修复错误的过程。所有的现代浏览器和大多数其他环境都支持调试工具 — 开发者工具中的一个令调试更加容易的特殊用户界面。它也允许我们一步一步地跟踪代码,以查看当前实际运行情况

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里应该是破折号吧?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯嗯,这里是破折号,我个人习惯用半个,这不是个好习惯,可以忽略哈哈


在这里我们将会使用 Chrome(谷歌浏览器),因为在这方面它可能是功能最丰富的
在这里我们将会使用 Chrome(谷歌浏览器),因为它拥有最丰富的功能,而其他大部分浏览器则具有类似的过程
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
在这里我们将会使用 Chrome(谷歌浏览器),因为它拥有最丰富的功能,而其他大部分浏览器则具有类似的过程
在这里我们将会使用 Chrome(谷歌浏览器),因为它拥有足够的功能,其他大多数浏览器的功能也与之类似

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll be using Chrome here, because it has enough features, most other browsers have a similar process`.


你的 Chrome 版本可能看起来有一点不同,但是应该还是很明显就能发现的
你的 Chrome 版本可能看起来有一点不同,但是它应该还是处于很明显的位置

- 在 Chrome 中打开[示例页面](debugging/index.html)。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 在 Chrome 中打开[示例页面](debugging/index.html)
- 在 Chrome 中打开 [示例页面](debugging/index.html)


你的 Chrome 版本可能看起来有一点不同,但是应该还是很明显就能发现的
你的 Chrome 版本可能看起来有一点不同,但是它应该还是处于很明显的位置

- 在 Chrome 中打开[示例页面](debugging/index.html)。
- 使用快捷键 `key:F12` (Mac: `key:Cmd+Opt+I`) 打开开发者工具。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 使用快捷键 `key:F12` (Mac: `key:Cmd+Opt+I`) 打开开发者工具。
- 使用快捷键 `key:F12`Mac`key:Cmd+Opt+I`打开开发者工具。


让我们在预览树中点击和选择 `index.html` 和 `hello.js`。应该会出现这个视图
让我们在预览树中点击和选择 `hello.js`。它应该会出现这个视图
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
让我们在预览树中点击和选择 `hello.js`它应该会出现这个视图
让我们在预览树中点击并选择 `hello.js`这里应该会如下图所示

2. `debugger` 声明
3. 一个错误(如果开发者工具是打开状态并且按钮 <span class="devtools" style="background-position:-264px -4px"></span> 是开启状态)。
2. `debugger` 语句
3. 一个错误(如果开发者工具是打开状态并且按钮 <span class="devtools" style="background-position:-90px -146px"></span> 是开启状态)。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3. 一个错误(如果开发者工具是打开状态并且按钮 <span class="devtools" style="background-position:-90px -146px"></span> 是开启状态)。
3. 一个错误(如果开发者工具是打开状态,并且按钮 <span class="devtools" style="background-position:-90px -146px"></span> 是开启的状态)。


然后我们就能检查变量,并逐步查看执行器在哪里走错路了
当暂停时,我们就能进行调试 —— 检查变量,并逐步查看执行器在哪里出错了
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
当暂停时,我们就能进行调试 —— 检查变量,并逐步查看执行器在哪里出错了
当脚本执行暂停时,我们就可以进行调试 —— 检查变量,跟踪代码来查看执行出错的位置


开发者工具中还有比这篇文章中更多的选项。完整的手册在 <https://developers.google.com/web/tools/chrome-devtools>
开发者工具中还有比这篇文章中更多的选项。完整的手册在 <https://developers.google.com/web/tools/chrome-devtools>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
开发者工具中还有比这篇文章中更多的选项。完整的手册在 <https://developers.google.com/web/tools/chrome-devtools>
开发人员工具中的选项比本文介绍的多得多。完整的手册请点击这个链接查看:<https://developers.google.com/web/tools/chrome-devtools>


开发者工具中还有比这篇文章中更多的选项。完整的手册在 <https://developers.google.com/web/tools/chrome-devtools>
开发者工具中还有比这篇文章中更多的选项。完整的手册在 <https://developers.google.com/web/tools/chrome-devtools>

本章节中的信息足够开始调试了,但是以后,尤其是你做了大量关于浏览器的东西后,请你去(上面的链接里)查看开发者工具的更高级功能。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
本章节中的信息足够开始调试了,但是以后,尤其是你做了大量关于浏览器的东西后,请你去(上面的链接里)查看开发者工具的更高级功能
本章节的内容足够让你上手代码调试了,但是之后,尤其是你做了大量关于浏览器的东西后,推荐你查看上面那个链接中讲的开发者工具更高级的功能


本章节中的信息足够开始调试了,但是以后,尤其是你做了大量关于浏览器的东西后,请你去(上面的链接里)查看开发者工具的更高级功能。

对了,你也可以点击开发者工具中的其他地方来看一下会显示什么。这可能是你学习开发者工具的最快的路线了。不要忘了还有右键单击哟
对了,你也可以点击开发者工具中的其他地方来看一下会显示什么。这可能是你学习开发者工具的最快的路线了。不要忘了还有右键单击和关联菜单哟
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
对了,你也可以点击开发者工具中的其他地方来看一下会显示什么。这可能是你学习开发者工具的最快的路线了。不要忘了还有右键单击和关联菜单哟
对了,你也可以点击开发者工具中的其他地方来看一下会显示什么。这可能是你学习开发者工具最快的方式了。不要忘了还有单击右键和关联菜单哟

@javascript-translate-bot

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

@MartinsYong
Copy link
Member Author

/done

@leviding leviding merged commit eebe9ae into javascript-tutorial:master Dec 3, 2019
@leviding leviding added DONE and removed needs +1 labels Dec 3, 2019
@leviding
Copy link
Member

leviding commented Dec 3, 2019

Thanks you all.

@leviding leviding removed their assignment Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants