Translation/dom navigation#168
Translation/dom navigation#168leviding merged 17 commits intojavascript-tutorial:zh-hansfrom steinliber:zh-hans
Conversation
|
resolve #129 |
|
校对认领 |
upupming
left a comment
There was a problem hiding this comment.
翻译处理的很好!
最主要问题就是 Element 有元素的意思,所以在 Node 部分尽量不要把一些单词翻译成带有“元素”这样的字眼
|  | ||
|
|
||
| Let's discuss them in more detail. | ||
| 让我们更详细的讨论这些。 |
|
|
||
| ````warn header="There's a catch: `document.body` can be `null`" | ||
| A script cannot access an element that doesn't exist at the moment of running. | ||
| ````warn header="这里有个问题:`document.body` 的值不能是 `null`" |
| ```smart header="In the DOM world `null` means \"doesn't exist\"" | ||
| In the DOM, the `null` value means "doesn't exist" or "no such node". | ||
| ``` | ||
| ```smart header="在 DOM 世界中 `null` 就意味着”不存在“” |
There was a problem hiding this comment.
引号用反了,还有注意这里是特定语法 header="...",所以最后一个引号不用改为全角
”不存在“” 改为 “不存在”"
| In the DOM, the `null` value means "doesn't exist" or "no such node". | ||
| ``` | ||
| ```smart header="在 DOM 世界中 `null` 就意味着”不存在“” | ||
| 在 DOM 中,`null` 值就意味着“不存在”或者”没有这样的节点“。 |
There was a problem hiding this comment.
引号反了
”没有这样的节点“ 改为 “没有这样的节点”
|
|
||
| `<html>` = `document.documentElement` | ||
| : The topmost document node is `document.documentElement`. That's DOM node of `<html>` tag. | ||
| :最上面的 document 节点是 `document.documentElement`。这是对应 `<html>` 标签的 DOM 节点。 |
| --- | ||
|
|
||
| # DOM children | ||
| # DOM 子元素 |
There was a problem hiding this comment.
这里的 children 应该没有 element 的意思,或许翻译成孩子比较好
| ``` | ||
|
|
||
| The second `<li>` (with Pete): | ||
| 获取第二个 `<li>`(内容里有 Pete) |
There was a problem hiding this comment.
with Pete 跟 task.md 翻译不一样了
| # 兄弟节点问题 | ||
|
|
||
| If `elem` -- is an arbitrary DOM element node... | ||
| 如果 `elem` 是任意一个 DOM 元素节点。。。 |
|
|
||
| - Is it true that `elem.lastChild.nextSibling` is always `null`? | ||
| - Is it true that `elem.children[0].previousSibling` is always `null` ? | ||
| - `elem.lastChild.nextSibling` 一直是 `null` 是不是真的? |
There was a problem hiding this comment.
这样翻译有点不合语言习惯
一直是 null 是不是真的? -> 永远是 null吗?
| @@ -1,4 +1,4 @@ | |||
| 1. Yes, true. The element `elem.lastChild` is always the last one, it has no `nextSibling`, so if there are children, then yes. | |||
| 2. No, wrong, because `elem.children[0]` is the first child among elements. But there may be non-element nodes before it. So `previousSibling` may be a text node. | |||
| 1. 是的,这是真的。`elem.lastChild` 一直是最后一个元素,它就没有 `nextSibling` ,所有如果存在子元素,这个问题的答案就是正确。 | |||
There was a problem hiding this comment.
是的,这是真的。 建议用更地道的表达
elem.lastChild 不能说是元素,会和 element 搞混。
|
@upupming 辛苦啦 @steinliber 可以修改啦 |
|
@leviding 校对认领 |
|
@Starriers ok |
|
@Starriers 等你校对哈 |
|
@leviding OK 今晚弄好 |
|
@Starriers 校对怎么样了? |
Starriers
left a comment
There was a problem hiding this comment.
@steinliber @leviding 校对完成
翻译得挺好的,总结起来 就只有两个问题:
- 破折号 用中文的 (全部)
- md(虽然不是严格意义上的 md)一般都是只空一行,这个自己再检查一下,然后我可以再给你看下,后面看的眼有点花,不一定全部指出来了。
|
|
||
| `<html>` = `document.documentElement` | ||
| : The topmost document node is `document.documentElement`. That's DOM node of `<html>` tag. | ||
| :最上面的 document 节点是 `document.documentElement`。这是对应 `<html>` 标签的 DOM 节点。 |
| @@ -1,24 +1,25 @@ | |||
| importance: 5 | |||
| 重要度:5 | |||
| @@ -1,10 +1,10 @@ | |||
| importance: 5 | |||
| 重要度:5 | |||
| @@ -1,10 +1,11 @@ | |||
| importance: 5 | |||
| 重要度:5 | |||
| @@ -1,18 +1,19 @@ | |||
| importance: 5 | |||
| 重要度:5 | |||
| 窗口坐标并不会考虑到文档滚动,它们就是基于窗口的左上角计算出来的。 | ||
|
|
||
|
|
||
| In other words, when we scroll the page, the element goes up or down, *its window coordinates change*. That's very important. |
| - Some browsers (like Chrome) also add to the result `getBoundingClientRect` properties `width` and `height`. We can get them also by subtraction: `height=bottom-top`, `width=right-left`. | ||
|
|
||
| ```warn header="Coordinates right/bottom are different from CSS properties" | ||
| If we compare window coordinates versus CSS positioning, then there are obvious similarities to `position:fixed` -- also the position relative to the viewport. |
|
|
||
| As it uses window coordinates, the element may be different depending on the current scroll position. | ||
| 因为它使用的是窗口坐标,基于现在滚动的位置会显示不同的元素。 | ||
|
|
| 这里就是一个典型的错误,如果我们不检查,它就可能会发生。 | ||
|
|
||
| Here's a typical error that may occur if we don't check for it: | ||
|
|
| - 元素的 `pageX` 和 `pageY` 坐标始终保持一致,因为它们是相对于文档计算的。 | ||
|
|
||
| ## Getting document coordinates [#getCoords] | ||
|
|
|
@steinliber 可以修改了 |
|
根据校对意见做了更改 谢谢两位,有个问题不是很确定,task 里的 importance 需要翻译吗 @leviding |
|
@steinliber 那个不翻译 |
|
ok, 已经做了相应的更改 |
|
辛苦,明天白天我 review 下 |

Translation/dom navigation