亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

directory search
Attributes accesskey (attribute) class (attribute) contenteditable (attribute) contextmenu (attribute) data-* (attribute) dir (attribute) draggable (attribute) dropzone (attribute) Global attributes hidden (attribute) id (attribute) itemid (attribute) itemprop (attribute) itemref (attribute) itemscope (attribute) itemtype (attribute) lang (attribute) slot (attribute) spellcheck (attribute) style (attribute) tabindex (attribute) title (attribute) translate (attribute) Elements a abbr address area article aside audio b base bdi bdo blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 head header hr html i iframe img input input type="button" input type="checkbox" input type="color" input type="date" input type="datetime"-local input type="email" input type="file" input type="hidden" input type="image" input type="month" input type="number" input type="password" input type="radio" input type="range" input type="reset" input type="search" input type="submit" input type="tel" input type="text" input type="time" input type="url" input type="week" ins kbd label legend li link main map mark menu menuitem meta meter nav noscript object ol optgroup option output p param picture pre progress q rp rt rtc ruby s samp script section select slot small source span strong style sub summary sup table tbody td template textarea tfoot th thead time title tr track u ul var video wbr Miscellaneous Attributes Block-level elements CORS enabled image CORS settings attributes Element Inline elements Kinds of HTML content Link types Microdata Optimizing your pages for speculative parsing Preloading content Reference Supported media formats Using the application cache Obsolete acronym applet basefont big blink center command content dir element font frame frameset hgroup image input type="datetime" isindex keygen listing marquee nextid noframes plaintext strike tt xmp
characters

傳統(tǒng)上,在瀏覽器中,HTML解析器已經(jīng)在主線程上運(yùn)行,并在</script>標(biāo)記后被阻塞,直到腳本從網(wǎng)絡(luò)中檢索并執(zhí)行。Firefox 4及更高版本中的HTML解析器支持對(duì)主線程進(jìn)行推測(cè)性解析。在腳本被下載和執(zhí)行時(shí),它會(huì)提前解析。與Firefox 3.5和3.6中一樣,HTML解析器會(huì)為流中發(fā)現(xiàn)的腳本,樣式表和圖像啟動(dòng)推測(cè)加載。但是,在Firefox 4及更高版本中,HTML解析器還推測(cè)性地運(yùn)行HTML樹構(gòu)建算法。好處在于,當(dāng)推測(cè)成功時(shí),不需要重新分析已經(jīng)掃描的用于腳本,樣式表和圖像的傳入文件的部分。不利的一面是,當(dāng)投機(jī)失敗時(shí),失去更多的工作。

這份文件可以幫助您避免那些使猜測(cè)失敗并減緩頁(yè)面加載速度的對(duì)象。

投機(jī)加載成功

只有一個(gè)規(guī)則可以使鏈接腳本,樣式表和圖像的投機(jī)加載成功:

  • 如果使用<base>元素來覆蓋頁(yè)面的基本URI,請(qǐng)將該元素放置在文檔的非腳本部分中。不要通過document.write()或添加它document.createElement()。

避免丟失tree builder的輸出

當(dāng)document.write()更改樹構(gòu)建器狀態(tài)時(shí),推測(cè)樹構(gòu)建失敗,使得</script>標(biāo)記之后的推測(cè)狀態(tài)在document.write()解析所有插入的內(nèi)容時(shí)不再成立。但是,只有不尋常的用途document.write()會(huì)造成麻煩。以下是要避免的事情:

  • 不要寫不平衡的樹。<script>document.write("<div>");</script>不好。<script>document.write("<div></div>");</script>沒問題。

  • 不要寫未完成的標(biāo)記。<script>document.write("<div></div");</script>不好。

  • 不要以回車完成你的編碼。<script>document.write("Hello World!\r");</script>不好。<script>document.write("Hello World!\n");</script>沒問題。

  • 請(qǐng)注意,寫入平衡標(biāo)簽可能會(huì)導(dǎo)致其他標(biāo)簽被推斷,導(dǎo)致寫入不平衡。例如<script>document.write("<div></div>");</script>head元素內(nèi)部將被解釋為<script>document.write("</head><body><div></div>");</script>不平衡。

  • 不要格式化表格的一部分。<table><script>document.write("<tr><td>Hello World!</td></tr>");</script></table>不好。但是,<script>document.write("<table><tr><td>Hello World!</td></tr></table>");</script>沒關(guān)系。

  • TODO:其他格式化元素內(nèi)的document.write。

Previous article: Next article: