HTML6 無 JavaScript 的單頁應用引起一片嘩然

wdfd 9年前發布 | 14K 次閱讀 JavaScript

關于 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

 本文由用戶 wdfd 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!