launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #05630
Re: YUI "issue" under Windmill
>> My javascript was written to be executed onload so I added some stuff to
>> base-layout-macros.pt:
>>
>> <script id="base-layout-load-scripts" type="text/javascript">
>> LPS.use('lp.app.links',
>> function(Y) {
>> Y.on('load', function(e) {
>> Y.lp.app.links.check_valid_lp_links();
>> }, window);
>> });
>> </script>
>
> It's probably better for you if you structure this code like this:
>
> LPS.use('lp.app.links', function(Y) {
> Y.config.win.on('domready', function(e) {
> Y.lp.app.links.check_valid_lp_links();
> });
> });
>
> We shouldn't be referencing window or document in our code. We should
> be using Y.config.win and Y.config.doc.
>
Ok. Thanks for the tip. I just copied directly from what was there already:
LPS.use('node', 'lp', function(Y) {
Y.on('load', function(e) {
sortables_init();
initInlineHelp();
Y.lp.activate_collapsibles();
activateFoldables();
activateConstrainBugExpiration();
}, window);
// Hook up the function that dismisses the help window if we click
// anywhere outside of it.
Y.on('click', handleClickOnPage, window);
});
Next time someone is in the neighbourhood, I guess we could look fixing
both occurrences.
References