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

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

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

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

下面是 Mozumder 建议的 HTML 代码:

<DOCTYPE html>
<HTML LANG=“en”>
<HEAD>
<FIXTURES lang=“xml”>
    <model class=“MyArticleData”>
        <rsp stat=“ok">
            <article label=“one” id=“1">
                <headline>"Big News!”</headline>
                <body>"<p>This is the first article intro.</p><p>This is the second paragraph.</p>"</body>
            </article>
            <article label=“two” id=“2">
                <headline>"Not so big news"</headline>
                <body>"<p>This is the <em>second</em> article.</p>"</body>
            </article>
        </rsp>
    </model>
    <model class=“MyImageData”>
        <rsp stat=“ok">
            <image label="Square" width="75" height="75" source="https://mycontentserver.com/image_s.jpg" id=“3"/>
            <image label=“Tall" width=“300" height=“200" source="https://mycontentserver.com/image_l.jpg" id=“4"/>
        </rsp>
        <rsp stat=“loading">
            <image label="Square" width="75" height="75" source="https://mycontentserver.com/loading_image_s.jpg" id=“1"/>
        </rsp>
        <rsp stat=“some_error">
            <image label="Square" width="75" height="75" source="https://mycontentserver.com/error_image_s.jpg" id=“2"/>
            <message
        </rsp>
    </model>
</FIXTURES>
</HEAD>
<BODY>
    <MENU class=“controller”>
        <A href=“http://api.mywebsite.com/api/load-new-article” model=“MyArticleData">Click here to replace the articles with different articles.</A>
        <A href=“http://api.mywebsite.com/api/load-new-image” model=“MyImageData">Click here to replace the picture with a different picture.</A>
    </MENU>
    <MAIN class=“viewer”>
        <ARTICLE class=“center">
            <H1 model=“MyArticleData.rsp.article(label=‘one’).headline” />
            <SPAN model="MyArticleData.rsp.article(label=’one’).body” />
        </ARTICLE>
        <ARTICLE class=“sidebar">
            <H1 model=“MyArticleData.rsp.article(label=’two’).headline” />
            <SPAN model=“MyArticleData.rsp.article(label=’two’).body” />
        </ARTICLE>
        <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”>
    </MAIN>
</BODY>
</HTML>

你觉得这个建议靠谱吗?

via jaxenter



新闻来源:HTML6 无 JavaScript 的单页应用引起一片哗然