Hello, I went through some sort of incompatibility between 2 different JS libraries and I was wondering how I could specify the order of the different JS scripts/sources at render time. I rapidly found out that nothing could help in the existing code so I started to wonder how it could be done.
1/ add an "order" attribute to Resource (upper class of JSLink/JSSource) and use it to sort the js[location] just before adding it to the output dict in _process_output() 2/ this is not enough for existing/third party JS libraries like lightbox, MochiKit, etc where it could be interesting to be able to specify the order attribute "from the outside". So I added a JSSortingPattern class that you can add to your javascript list like a JSLink or JSSource. It can be used like that : sp = JSSortingPattern([name=aJSLink/JSSource_name], [mod=aJSLink_mod], order=n] then, at render time, we use this class to modify the order attribute of all JSLink/JSSource that match (name==name/mod==mod). This is done just before sorting the js list. This actually solved my problem ;-) Does this approach seems reasonable ? Your comments are welcomed. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

