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()
許多 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.