【AICon】探索八个行业创新案例,教你在教育、金融、医疗、法律等领域实践大模型技术! >>> 了解详情
写点什么

W3C 官方推荐使用新发布的 HTML5.2

  • 2018-01-08
  • 本文字数:1745 字

    阅读完需:约 6 分钟

看新闻很累?看技术新闻更累?试试下载 InfoQ 手机客户端,每天上下班路上听新闻,有趣还有料!

W3C 于 2017 年 12 月 14 日发布了 HTML 规范 5.2 更新版本,并官方建议用户使用。此次更新增加了 dialog 标签等新功能、弃用了 HTML 插件系统等原有功能,并整合了其他 W3C 委员会的进展,如对支付请求 API(Payment Request API)和演示 API(Presentation API)的支持。

新版本的规范在 iframe 标签上新增了一些重要属性用于支持新的 JavaScript API。其添加了 allowpaymentrequest 属性以允许 iframe 控制支付请求 API 的访问。这也意味着嵌入了第三方内容的页面能够控制该第三方内容是否可向用户请求获取支付凭证,进而让可嵌入的购物车工具可以利用新的 API。来自 Forrester 的 Brendan Miller 阐述了支付请求 API 所带来的好处,他说:

该新标准让开发者可以创建一个简化的结帐页面,用户可以重复使用保存的付款和地址信息来加快结账速度,并减少错误输入。

支付请求 API已经可在Chrome、Edge 和技术预览版的Safari 中使用

HTML5.2 规范还增加了 allowpresentation 属性,该属性允许 iframe 可以访问演示API 来让页面嵌入可以访问投影仪、监控器或网络连接电视等设备的第三方演示。演示API 还只是一个W3C 候选建议,目前只在 Chrome 上可用

在新规范中也越来越重视安全性。其中集成了来自内容安全策略3 级草案中的多项建议。link 标签正式支持nonce 属性、内容安全策略可以事先阻止style 和script 标签的内联行为。这些工具使开发者能够更灵活地控制其Web 应用程序允许加载的资源,从而减少跨站脚本攻击可能带来的破坏。开发人员可以通过MDM 上的指南和文档了解如何使用内容安全策略来保护自己的应用程序。

该版本的HTML 规范还提供了对ES6 JavaScript 模块的官方支持。大多数浏览器已经实现了这一功能。从Safari 10.1、Chrome 61、Edge 16 开始都已提供支持,Firefox 则需要打开特定的功能开关。

HTML5.2 是对 HTML5 规范的第二次重大修订,它遵循了 2014 年 W3C 承诺的大致每年发布一次规范修订。本次修订中还包括大量的清理和错误修复、主要的安全更新、其他委员会的进展整合以及其他用以保持规范符合最新网络广泛使用方式的更新。开发人员可以查阅规范发布中的变更日志来了解详细变更。

感兴趣的开发者可以在官方HTML5.2 建议中了解所有变更的内容。同时委员会已经开始了HTML5.3 的制定,并伴随HTML5.2 发布了一份工作草案

查看英文原文: W3C Releases HTML 5.2 As Official Recommendation

复制代码

and `` inline behavior can be blocked a priori by a Content Security Policy. These tools allow developers more flexibility in locking down what resources their web applications are allowed to load, mitigating the damage possible from cross-site scripting attacks. To learn how to begin using CSP to protect their applications, developers can find guides and documentation on MDM.

This version of the HTML specification provides official support for ES6 JavaScript Modules. Most browsers have already implemented this functionality , with support in Safari since version 10.1, Chrome since version 61, and Edge since version 16. Firefox provides support behind a feature flag.

HTML 5.2 is the second major revision to the HTML5 specification, following up on a 2014 W3C commitment to release revisions to the specification roughly once a year. It includes substantial cleanup and bug fixes, major security updates, integration of progress from other committees, and other work to keep the spec up to date with the way the web is being used in the wild. Developers wanting to see everything that has changed can consult the changelog published as a part of the specification .

Interested developers can read all about these changes and much more in the official HTML 5.2 recommendation . The committee has already started work on the HTML 5.3 specification, releasing a working draft at the same time as the HTML 5.2 recommendation was released.

2018-01-08 18:004559
用户头像

发布了 41 篇内容, 共 12.8 次阅读, 收获喜欢 3 次。

关注

评论

发布
暂无评论
发现更多内容
W3C官方推荐使用新发布的HTML5.2_Chrome_Kevin Ball_InfoQ精选文章