Editorial: note canShare is not future compatible (#273) · w3c/web-share@7f78426
marcoscacere
·
2023-03-01
·
via Recent Commits to web-share:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -488,6 +488,32 @@ <h3>
|
488 | 488 | object/API base URL=]. |
489 | 489 | </li> |
490 | 490 | </ol> |
| 491 | +<aside class="note" title="canShare() is not future compatible"> |
| 492 | +<p> |
| 493 | + The `canShare()` method of the Web Share API may return false |
| 494 | + positive results when used with objects that contain members not |
| 495 | + defined in the `ShareData` dictionary. Because of how WebIDL |
| 496 | + works, browsers drop unknown members from the input object and |
| 497 | + will return `true` when testing the remaining members. This behavior is |
| 498 | + not future-compatible. |
| 499 | +</p> |
| 500 | +<p> |
| 501 | + To ensure reliable testing of shareability, developers can |
| 502 | + construct the input object using only members defined in the |
| 503 | + {{ShareData}} dictionary. If an object contains additional |
| 504 | + members, it should be destructured to only test the defined |
| 505 | + members individually. |
| 506 | +</p> |
| 507 | +<p> |
| 508 | + Although this doesn't affect any implementations today, |
| 509 | + the Working Group will work towards addressing this issue in a future |
| 510 | + revision of the specification - especially if we make any |
| 511 | + amendments to the `ShareData` dictionary. |
| 512 | + To contribute ideas for how to address this issue, see |
| 513 | +<a href="https://github.com/w3c/web-share/issues/108">issue #108</a> |
| 514 | + on GitHub. |
| 515 | +</p> |
| 516 | +</aside> |
491 | 517 | </section> |
492 | 518 | <section> |
493 | 519 | <h3> |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。