This page uses the YUI Combo Handler to load the YUI Rich Text Editor. The Combo Handler is a way that developers can choose a subset of YUI modules but still get them loaded in one HTTP request from Yahoo!'s CDN. This page contains the following request for an external script from Combo Handler:
<script src="http://yui.yahooapis.com/combo
?2.5.2/build/editor/editor-beta-min.js
&2.5.2/build/yahoo-dom-event/yahoo-dom-event.js
&2.5.2/build/container/container_core-min.js
&2.5.2/build/menu/menu-min.js
&2.5.2/build/element/element-beta-min.js
&2.5.2/build/button/button-min.js">
</script>
But this page generates JavaScript errors.
That's because I rearranged the querystring parameters.
Instead of putting editor-beta-min.js
last, I put it first.
All of the other scripts are prerequisites for editor-beta-min.js
, so they need to be loaded before editor-beta-min.js
.
A future enhancement to Combo Handler would be to automatically detect prerequisites.
If this feature was available, the above request would be much simpler:
<script src="http://yui.yahooapis.com/combo?2.5.2/build/editor/editor-beta-min.js"></script>
Don't get me wrong - it's awesome that Yahoo! has made this feature available. And it's awesome that YUI supports developers picking just the modules they need, thus reducing download size. I recommend that developers using YUI take advantage of Combo Handler. It's amazing to get a custom build file that Yahoo! will host for you on their CDN.
This sample page is part of my blog post YUI.s Combo Handler CDN Service.