Closed
Bug 521391
Opened 15 years ago
Closed 6 years ago
[HTML5] Provide a dev doc explaining how to avoid speculation failures
Categories
(Developer Documentation Graveyard :: HTML, defect, P3)
Developer Documentation Graveyard
HTML
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: hsivonen, Assigned: hsivonen)
Details
(Keywords: access, Whiteboard: u=webdev p=0 c=HTML)
Bug 482919 will introduce speculative parsing to the HTML5 parser. Web authors who care about the load times of their pages should avoid the kind of document.write() use that makes speculations fail. Need to provide a DevMo article that explains what the pitfalls are. * Don't put "\r" at the end of your last document.write() in a script. (Hopefully people who document.write() line breaks use "\n" anyway.) * Don't write unbalanced trees. <script>document.write("<div>");</script> is bad. * Don't document.write() and unfinished token. <script>document.write("<div ");</script> is bad. * Need to explain the situation where formatting elements interfere. That is the cases where <b><script>document.write("...");</script></b> is bad. * Don't insert from script or document.write() a <base> element. (Doesn't cause speculative parse to fail but causes speculative loads to fail.)
Assignee | ||
Comment 1•15 years ago
|
||
Draft: https://developer.mozilla.org/en/Optimizing_Your_Pages_for_Speculative_Parsing
Assignee | ||
Updated•15 years ago
|
Priority: -- → P2
Assignee | ||
Updated•14 years ago
|
Priority: P2 → P3
The page says <script>document.write("<div></div>");</script> is good. ALMOST. <script>document.write("<div><\/div>");</script> is good. Remember, the parser stops scanning when it reaches the first "</".
Assignee | ||
Comment 3•13 years ago
|
||
(In reply to comment #2) > The page says <script>document.write("<div></div>");</script> is good. > ALMOST. > <script>document.write("<div><\/div>");</script> is good. > Remember, the parser stops scanning when it reaches the first "</". Not so. See http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#script-data-end-tag-open-state and the related states.
Updated•12 years ago
|
Component: Documentation Requests → Documentation
Updated•12 years ago
|
Component: Documentation → General
Product: Mozilla Developer Network → Developer Documentation
Updated•11 years ago
|
Whiteboard: u=webdev p=0
Updated•11 years ago
|
Assignee | ||
Comment 4•6 years ago
|
||
FIXED per comment 1.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•