Skip to content
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

用 Shadow DOM v1 和 Custom Elements v1 实现一个原生 Web Component #4826

Merged
merged 2 commits into from
Dec 17, 2018

Conversation

newraina
Copy link
Member

@newraina newraina commented Dec 8, 2018

译文翻译完成,resolve #4796

@CoderMing
Copy link
Contributor

校对认领

@fanyijihua
Copy link
Collaborator

@CoderMing 好的呢 🍺

@Raoul1996
Copy link
Contributor

校对认领

@fanyijihua
Copy link
Collaborator

@Raoul1996 妥妥哒 🍻

@leviding
Copy link
Member

@Raoul1996 抓紧校对了

@leviding leviding closed this Dec 16, 2018
@leviding leviding reopened this Dec 16, 2018
@leviding
Copy link
Member

@CoderMing 抓紧时间校对啦

Copy link
Contributor

@CoderMing CoderMing left a comment

Choose a reason for hiding this comment

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

不好意思耽误这么久。翻译得好棒!几乎没有什么小缺陷了。个人提了两点小建议,如果有疑问的话请继续交流~


You will also need a couple polyfills. The web standards that we are using are new and they are [not supported by all browsers](https://caniuse.com/#search=custom%20elements%20v1). At least for the present, polyfills are necessary. For this simple component, we only require two: [custom elements](https://github.com/webcomponents/custom-elements) and [shadydom](https://github.com/webcomponents/shadydom). You can install them with Bower:
你还需要一些 polyfills。我们使用的 web 标准非常新,[还没被所有浏览器支持](https://caniuse.com/#search=custom%20elements%20v1),至少到目前为止,polyfills 是必须的。对于我们这个简单的组件,只需要两个 polyfills:[custom elements](https://github.com/webcomponents/custom-elements) [shadydom](https://github.com/webcomponents/shadydom),可以用 Bower 安装:
Copy link
Contributor

Choose a reason for hiding this comment

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

这里 polyfills 去掉复数形式 变为 polyfill 好一点吧?

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.

我合的时候改啦

@@ -80,9 +80,9 @@ suite('<mini-form>', () => {
});
```

To run the test, we will use the [web component tester](https://github.com/Polymer/web-component-tester) created by the [Polymer Project](https://www.polymer-project.org/). Install the web-component-tester with NPM and add `node_modules/web-component-tester/browser.js` to the head of `mini-form-test.html`. Both polyfills and the `mini-form.js` script should already be on the page.
为了运行测试,我们要用到 [Polymer Project](https://www.polymer-project.org/) 创建的 [web component tester](https://github.com/Polymer/web-component-tester) 工具。用 NPM 安装好 web-component-tester 之后,在 `mini-form-test.html` head 里加上 `node_modules/web-component-tester/browser.js`polyfills `mini-form.js` 也应该在页面上了。
Copy link
Contributor

Choose a reason for hiding this comment

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

「在 mini-form-test.html head 里」 => 「在 mini-form-test.html 文件的 head 标签里」
这样子更易于理解

Copy link
Member Author

Choose a reason for hiding this comment

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

这个确实,我之后另提 PR 修改

Copy link
Member

Choose a reason for hiding this comment

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

我合的时候改啦

@leviding leviding added the 标注 待管理员 Review label Dec 16, 2018
@leviding
Copy link
Member

@Raoul1996 抓紧校对哈

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.

@newraina 本文翻译的很赞
@Raoul1996 那就不用再继续校对了

@leviding leviding merged commit c32b8f7 into xitu:master Dec 17, 2018
@leviding
Copy link
Member

@newraina 已经 merge 啦~ 快快麻溜发布到掘金然后给我发下链接,方便及时添加积分哟。

掘金翻译计划有自己的知乎专栏,你也可以投稿哈,推荐使用一个好用的插件
专栏地址:https://zhuanlan.zhihu.com/juejinfanyi

@Raoul1996
Copy link
Contributor

OK

@newraina newraina deleted the translation/native-web-components.md branch December 18, 2018 08:38
@leviding
Copy link
Member

@newraina 记得发布文章,并及时反馈给我链接

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

用 Shadow DOM v1 和 Custom Elements v1 实现一个原生 Web Component
5 participants