• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

It is dangerous to call certain functions in the Func API before the TWiki engine and all its plugins are fully initialized. The addToHEAD() function for example calls handleCommonTags() which as a consequence invokes the plugin's tag handlers before their initPlugin() has finished. Am I paranoid or are we just lucky by now?

In general initPlugin() should be rather lean and any further plugin initialization should be defered until the plugin is actually needed.

This item applies to all plugins actually but the TwistyPlugin is the first I came accross... fixed in SVN 8807.

As a consequence PatternSkin must import twisty's css and js whether the TwistyPlugin is installed or not...fixed in SVN 8809.

MD

So you want the Pattern skin to load - or rather the browser to load - a css file and a js file - even if it is not needed?

One reason why Dakar is slower than Cairo is because the browser needs to check for all these many files on each read. And the first topic you load from a TWiki like mine (bandwidth is limited to the 512 kbit that the ADSL can carry) takes ages to load. I already have several nasty remarks from my users. I would appreciate if things I do not need are not loaded ever by the browser.

Try and run Ethereal and watch your browsers activities loading a simple Dakar topic. Try the same in a Cairo. The number of files loaded has tripled. The number of bytes loaded tripled.

KJL

Kenneth, I share your concerns about too many file requests per page but I fear you didn't understand what has been addressed here and maybe I haven't been verbose enough about that either. I fact the changes to the TwistyPlugin do exactly what you are demanding: not to call for the twisty css and js if it is not used. That is exactly what my modification does...besides calling addToHEAD() being dangerous in initPlugin() as it calls handleCommonTags() which, for example, freaked the mailnotify command line tool.

The PatternSkin, however, calls for twisty's css and js on every page. This was the case before and after my changes. The only drawback is, when you use the PatternSkin and the TwistyPlugin, there are two links to twisty.css and twisty.js. BUT only if the current topic uses a twisty button !!! I doubt that there are four requests for two files done by the browser.

There's no way that PatternSkin and TwistyPlugin can communicate in both directions what they've already loaded and what not, even not using context variables (or I missed something). Given, the TwistyPlugin sets a a context variable called TwistyPluginDoneHEAD and the PatternSkin templates would check that, the opposite direction is not possible so that the TwistyPlugin detected that the PatternSkin already loaded the css and js files (is there?).

MD

ItemTemplate
Summary don't call TWiki::Func::addToHEAD() inside initPlugin()
ReportedBy TWiki:Main.MichaelDaum
Codebase

SVN Range Tue, 14 Feb 2006 build 8800
AppliesTo Extension
Component TwistyPlugin
Priority Enhancement
CurrentState Closed
WaitingFor

TargetRelease major
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2006-02-21 - MichaelDaum
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback