If I put my inline script after the DOM elements it interacts with, should I use the YUI 3 domready event ?I did not notice any problems, and it seems that I can count on the browser to load the page sequentially. (I already used YUI().use('node', ...to make sure that the YUI functions I needed were loaded, since the YUI script is a separate file.)
YUI().use('node', ...
Is there a way to speed up loading widgets like YUI 2 calendar?I load the corresponding script into an element of <head>my page. I use YUI().use('yui2-calendar', ...to make sure the Calendar widget is available. Unfortunately, this leads to a short but noticeable delay when I load my page into the calendar. If I omit the code YUI().use('yui2-calendar', ..., then it appears without a noticeable delay - but I think this could lead to the Calendar not being displayed at all if the YUI script does not load on time?
<head>
YUI().use('yui2-calendar', ...
As for No. 2, is it possible to reduce the visual artifact of a calendar that is not present, and then appears?I improved this a bit by specifying the height and width for the parent div, so at least the space is already allocated => minimum offset when it loads.
You do not need domready if the code that accesses the DOM elements comes after these markup elements. This applies to DOM scripts in general, and not just to YUI.
yui2-calendar yahooapis.com/2.8.0r4/build/calendar/calendar-min.js. API YUI 3. YUI 2 < head ( , , "body" ), yui2-calendar. . , YUI 3, <script> s < head ('yui2-calendar'). , yui2- * combo <script> yui-min.js. , css, .
< script src= "http://yui.yahooapis.com/combo?3.1.0/build/yui/yui.js" > </ script >
< script src= "http://yui.yahooapis.com/combo?2in3.1/2.8.0/build/yui2-yahoo/yui2-yahoo.js&2in3.1/2.8.0/build/yui2-dom/yui2-dom.js&2in3.1/2.8.0/build/yui2-event/yui2-event.js&2in3.1/2.8.0/build/yui2-calendar/yui2-calendar.js" > </ script >
css , . , YUI 2 , . .
, DOMContentLoaded ( domready).
DOMContentLoaded
Source: https://habr.com/ru/post/1744443/More articles:Problems displaying maxWidth on Google Map - google-mapsСколько файлов требуется для загрузки программы в Linux? - systemAn example of using extended iPhone table elements - objective-cCan java execute a timer on the command line by overwriting time on the same line? - javaSilverlight? WPF? or windows form? - compareImplementing a queue with a locked "take ()" but with an eviction policy - javaRun Ant script from another Ant script? - scriptingDatabase Design 1 to 1 - sql-serverNant-equivalent of Ant task Replace - antHow does the Windows LIve ID work? - authenticationAll Articles