This covers only some of the key highlights, check the links below for additional changes in Chrome 71.
Chromium source repository change list
ChromeStatus.com updates for Chrome 71
Chrome 71 deprecations & removals
使用 Intl.RelativeTimeFormat() 显示相对时间
Display relative times with Intl.RelativeTimeFormat()
在 Twitter 上面, 最新的推文显示相对时间
Twitter showing relative time for latest post
许多 web app 使用诸如 "yesterday", "in two days", 或者 "an hour ago" 的短语来代表某些事情发生了 - 或即将发生, 而不是显示所有的日期和时间.
Many web apps use phrases like “yesterday”, “in two days”, or “an hour ago” to indicate when something happened - or is going to happen, instead of displaying the full date and time.
显示相对时间变得很是广泛, 以致于大多数的常见的 日期/时间 库都提供了本地化的功能来为咱们处理这个问题. 事实上, 几乎我构建每个 web app, Moment JS 都是我添加的第一个库, 专门为此.
Displaying relative times has become so common that most of the common date/time libraries provide localized functions to handle this for us. In fact, almost every web app I build, Moment JS is one of the first libraries I add, expressly for this purpose.
Chrome 71 introduces Intl.RelativeTimeFormat(), which shifts the work to the JavaScript engine, and enables localized formatting of relative times. This gives us a small performance boost, and means we only need those libraries as a polyfill when a browser doesn’t support the new APIs yet.
Using it is simple, create a new instance and specify the locale, then just call format with the relative time. Check out Mathias’ The Intl.RelativeTimeFormat API post for full details.
When Chinese or Japanese text is displayed in a vertical flow, browsers are inconsistent with where the underline is placed, it may be on the left, or on the right.
在 Chrome 71 中, text-underline-position 如今接受 left 或者是 right, 根据 CSS3 text decoration 规范的这部分. CSS3 text decoration 规范 添加了一些新的属性, 其容许你指定像 使用的 线 的类型, 风格, 颜色 和 位置 的东西.
In Chrome 71, the text-underline-position property now accepts left or right as part of the CSS3 text decoration spec. The CSS3 text decoration spec adds several new properties that allow use to specify things like what kind of line to use, the style, color, and position.
We’ve all been surprised when we hit a site and it suddenly starts talking to us. Autoplay policies prevent sites from automatically playing playing audio, or video files with audio. Some sites have tried to get around this by using the speech synthesis API instead.
Starting in Chrome 71, the speech synthesis API now requires some kind of user activation on the page before it’ll work. This brings it in line with other autoplay policies. If you try to use it before the user has interacted with the page, it will fire an error.
Success: To make sure your code works, I recommend wrapping your speech synthesis call in a try/catch block, so if the page isn't activated, it won't break the rest of your app.
没有什么比 前往一个网站,其让你和你周围的同事感到意外更糟糕的事情了.
There’s nothing worse than going to a site and having it surprise you, and the co-workers sitting around you.
还有更多
And more!
这些只是 Chrome 71 对于开发者的一些变化.固然, 还有更多.
These are just a few of the changes in Chrome 71 for developers, of course, there’s plenty more.
The Element.requestFullscreen() method can now be customized on Android and allows you to choose between making the navigation bar visible versus a completely immersive mode where no user agent controls are shown until a user gesture is performed.
And bringing Chrome inline with the Shadow DOM v1 spec, Chrome 71 now calculates the specificity for the :host() and :host-context() pseudo classes as well as for the arguments for ::slotted().
If you didn’t make it to Chrome Dev Summit, or maybe you did, but didn’t see all the talks, check out the Chrome Dev Summit 2018 playlist on our YouTube channel.
Want to stay up to date with our videos, then subscribe to our Chrome Developers YouTube channel, and you’ll get an email notification whenever we launch a new video, or add our RSS feed to your feed reader.