Skip to content

Commit 8fc0cc8

Browse files
committed
feat: update translation
1 parent ea97755 commit 8fc0cc8

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

3-frames-and-windows/03-cross-window-communication/article.md

+7
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ document.domain = 'site.com';
116116

117117
这样就可以了。现在它们可以无限制地进行交互了。但是再强调一遍,这仅适用于具有相同二级域的页面。
118118

119+
```warn header="已弃用,但仍有效"
120+
`document.domain` 属性正在被从 [规范](https://html.spec.whatwg.org/multipage/origin.html#relaxing-the-same-origin-restriction) 中删除。跨窗口通信(下面将很快解释到)是建议的替代方案。
121+
122+
也就是说,到目前为止,所有浏览器都支持它。并且未来也将继续支持它,而不会导致使用了 `document.domain` 的旧代码出现问题。
123+
```
124+
125+
119126
## Iframe:错误文档陷阱
120127

121128
当一个 iframe 来自同一个源时,我们可能会访问其 `document`,但是这里有一个陷阱。它与跨源无关,但你一定要知道。

4-binary/03-blob/article.md

+4-9
Original file line numberDiff line numberDiff line change
@@ -211,19 +211,14 @@ let blob = await new Promise(resolve => canvasElem.toBlob(resolve, 'image/png'))
211211

212212
`Blob` 构造器允许从几乎任何东西创建 blob,包括任何 `BufferSource`
213213

214-
但是,如果我们需要执行低级别的处理时,我们可以使用 `FileReader` 从中获取最低级别的 `ArrayBuffer`
214+
但是,如果我们需要执行低级别的处理时,我们可以从 `blob.arrayBuffer()` 中获取最低级别的 `ArrayBuffer`
215215

216216
```js
217217
// 从 bolb 获取 arrayBuffer
218-
let fileReader = new FileReader();
218+
const bufferPromise = await blob.arrayBuffer();
219219

220-
*!*
221-
fileReader.readAsArrayBuffer(blob);
222-
*/!*
223-
224-
fileReader.onload = function(event) {
225-
let arrayBuffer = fileReader.result;
226-
};
220+
//
221+
blob.arrayBuffer().then(buffer => /* 处理 ArrayBuffer */);
227222
```
228223

229224
## Blob 转换为 Stream

0 commit comments

Comments
 (0)