cssom

Are deferred scripts executed before DOMContentLoaded event?

喜夏-厌秋 提交于 2019-11-30 11:33:35
问题 Upon defer attirbute MDN says: This Boolean attribute is set to indicate to a browser that the script is meant to be executed after the document has been parsed, but before firing DOMContentLoaded . The defer attribute should only be used on external scripts. On DOMContentLoaded MDN also says: The DOMContentLoaded event is fired when the initial HTML document has been completely loaded and parsed, without waiting for stylesheets ... So DOMContentLoaded is fired before CSSOM is ready. This

Is JavaScript execution deferred until CSSOM is built or not?

旧街凉风 提交于 2019-11-30 02:30:35
The answer to this question has been clear to me ever since I read/learned about CSSOM, until today. I can't seem to be able to find the initial article, but it explained quite clear, with examples, that JavaScript execution is deferred until CSSOM is built from all <style> and <link> tags in <head> (except those not applying, based on @media queries). Or at least that's what I made of it at the time and I had no reason to doubt it until today. This seems to be backed up by the bold-ed statement in this sub-chapter of Web Fundamentals / Performance, from Google: ... the browser delays script

Handling <?xml-stylesheet> similar to <link rel=“stylesheet”>?

こ雲淡風輕ζ 提交于 2019-11-29 11:41:16
During investigation of advantages and disadvantages of attaching CSS with <?xml-stylesheet> processing instruction, I came upon some issues. Suppose we have a simple XHTML document (which is delivered with application/xhtml+xml MIME type and viewed in a Web browser): <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>A sample XHTML document</title> <script type="application/javascript" src="/script.js"></script> </head> <body> <h1>A heading</h1> </body> </html> Then we have an external CSS file (let it be named style.css and put in root directory): h1 { color: red; } At

Why were window.scrollY and window.scrollX introduced?

99封情书 提交于 2019-11-28 20:31:48
As far as I know, pageXOffset/pageYOffset properties were already available since Netscape 4 era. And it seems scrollX/scrollY were introduced circa Netscape 6. Alternative question: Q2. Is there a browser which implements scrollX/scrollY but doesn't support pageXOffset/pageYOffset? I will add a third question because no one was able to answer the previous ones: Q3. scrollX/scrollY was added to the latest editor's draft of the CCSOM and the working draft only got pageXOffset/pageYOffset, why are they keeping both attributes? Is there a browser which implements scrollY/X but doesn't support

Are deferred scripts executed before DOMContentLoaded event?

拜拜、爱过 提交于 2019-11-28 18:53:37
Upon defer attirbute MDN says : This Boolean attribute is set to indicate to a browser that the script is meant to be executed after the document has been parsed, but before firing DOMContentLoaded . The defer attribute should only be used on external scripts. On DOMContentLoaded MDN also says : The DOMContentLoaded event is fired when the initial HTML document has been completely loaded and parsed, without waiting for stylesheets ... So DOMContentLoaded is fired before CSSOM is ready. This means deferred scripts are executed before CSSOM is ready. But if thats true the scrips must not be able

Handling <?xml-stylesheet> similar to <link rel=“stylesheet”>?

南楼画角 提交于 2019-11-28 04:59:19
问题 During investigation of advantages and disadvantages of attaching CSS with <?xml-stylesheet> processing instruction, I came upon some issues. Suppose we have a simple XHTML document (which is delivered with application/xhtml+xml MIME type and viewed in a Web browser): <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>A sample XHTML document</title> <script type="application/javascript" src="/script.js"></script> </head> <body> <h1>A heading</h1> </body> </html> Then we

Why were window.scrollY and window.scrollX introduced?

流过昼夜 提交于 2019-11-27 12:56:36
问题 As far as I know, pageXOffset/pageYOffset properties were already available since Netscape 4 era. And it seems scrollX/scrollY were introduced circa Netscape 6. Alternative question: Q2. Is there a browser which implements scrollX/scrollY but doesn't support pageXOffset/pageYOffset? I will add a third question because no one was able to answer the previous ones: Q3. scrollX/scrollY was added to the latest editor's draft of the CCSOM and the working draft only got pageXOffset/pageYOffset, why