HTML6你就这样抛弃JavaScript?

移动开发 Android
关于 HTML6 意在实现无 JavaScript 的单页应用,这引起了前端开发社区一片哗然。请深呼吸,然后继续下面内容。

关于 HTML6 意在实现无 JavaScript 的单页应用,这引起了前端开发社区一片哗然。请深呼吸,然后继续下面内容。

W3.org 分享了一个 casual proposal for HTML6 ,这引起了前端社区的激烈争论。来自前 NSA 雇员和创业企业级 Bobby Mozumder 提交了这份建议,声称一个高性能的响应式 Web 体验无需 JavaScript 支持。

Mozumder 写道:新兴的 Web 应用通过 JSON API 加载动态内容,这是单页应用的一个标准设计模式。大多数人采用这种方法是因为它比加载一个完整 HTML 页面要节省很多时间。

这种模式使用那么的广泛,因此 Mozumder 的建议是未来浏览器应该直接提供动态加载内容的功能,而不需要开发者编写任何 JavaScript 代码。

下面是 Mozumder 建议的 HTML 代码:

  1. <DOCTYPE html> 
  2. <HTML LANG=“en”> 
  3. <HEAD> 
  4. <FIXTURES lang=“xml”> 
  5.     <model class=“MyArticleData”> 
  6.         <rsp stat=“ok"> 
  7.             <article label=“one” id=“1"> 
  8.                 <headline>"Big News!”</headline> 
  9.                 <body>"<p>This is the first article intro.</p><p>This is the second paragraph.</p>"</body> 
  10.             </article> 
  11.             <article label=“two” id=“2"> 
  12.                 <headline>"Not so big news"</headline> 
  13.                 <body>"<p>This is the <em>second</em> article.</p>"</body> 
  14.             </article> 
  15.         </rsp> 
  16.     </model> 
  17.     <model class=“MyImageData”> 
  18.         <rsp stat=“ok"> 
  19.             <image label="Square" width="75" height="75" source="https://mycontentserver.com/image_s.jpg" id=“3"/> 
  20.             <image label=“Tall" width=“300" height=“200" source="https://mycontentserver.com/image_l.jpg" id=“4"/> 
  21.         </rsp> 
  22.         <rsp stat=“loading"> 
  23.             <image label="Square" width="75" height="75" source="https://mycontentserver.com/loading_image_s.jpg" id=“1"/> 
  24.         </rsp> 
  25.         <rsp stat=“some_error"> 
  26.             <image label="Square" width="75" height="75" source="https://mycontentserver.com/error_image_s.jpg" id=“2"/> 
  27.             <message 
  28.         </rsp> 
  29.     </model> 
  30. </FIXTURES> 
  31. </HEAD> 
  32. <BODY> 
  33.     <MENU class=“controller”> 
  34.         <A href=“http://api.mywebsite.com/api/load-new-article” model=“MyArticleData">Click here to replace the articles with different articles.</A> 
  35.         <A href=“http://api.mywebsite.com/api/load-new-image” model=“MyImageData">Click here to replace the picture with a different picture.</A> 
  36.     </MENU> 
  37.     <MAIN class=“viewer”> 
  38.         <ARTICLE class=“center"> 
  39.             <H1 model=“MyArticleData.rsp.article(label=‘one’).headline” /> 
  40.             <SPAN model="MyArticleData.rsp.article(label=’one’).body” /> 
  41.         </ARTICLE> 
  42.         <ARTICLE class=“sidebar"> 
  43.             <H1 model=“MyArticleData.rsp.article(label=’two’).headline” /> 
  44.             <SPAN model=“MyArticleData.rsp.article(label=’two’).body” /> 
  45.         </ARTICLE> 
  46.         <IMG src=“model:MyImageData.rsp.image(label=‘Square’)#source” width=“model:MyImageData.rsp.image(label=‘Square’)#width” height=“model:MyImageData.rsp.image(label=’Square’)#height”> 
  47.     </MAIN> 
  48. </BODY> 
  49. </HTML> 

 

责任编辑:chenqingxiang 来源: oschina
相关推荐

2014-12-08 11:12:23

HTML6

2015-03-30 14:53:12

HTML6JavaScript一片哗然

2015-11-10 10:12:42

重构系统.程序员

2011-01-05 16:19:34

2016-11-21 21:28:51

根目录日志代码

2015-04-16 09:48:12

APP测试

2011-05-12 11:01:26

HTML

2010-10-29 11:01:11

简历

2013-07-05 09:59:23

2009-12-03 15:06:51

Suse修改主机名

2009-06-22 15:02:00

家庭无线网络组建

2015-05-13 10:42:21

程序员代码

2021-03-04 07:59:40

压测代码日志

2015-09-01 09:44:40

2015-09-01 10:25:11

2020-09-25 07:57:42

生产事故系统

2020-03-06 11:30:08

JavaGitHub编程

2015-03-26 11:05:53

JavaScriptWeb加载速度

2018-10-17 09:00:00

JavaScript工具前端

2014-04-23 09:41:16

Windows 9Windows 7
点赞
收藏

51CTO技术栈公众号