Tags:
create new tag
, view all tags

Feature Proposal: JS/CSS register mechanism

Motivation

Double inclusion of common JS like Prototype should be avoided. JS load order should be customizable.

Description and Documentation

At the moment Javascripts get loaded in two ways:

  1. via a TWiki::Func::addToHeadI() call
  2. via manipulating the html output (head block) in a commonTagsHandler or PostRenderingHandler

With 1.) you have no influence on the order. In most cases the JS gets appended to the head block. Method 2.) looks somehow ugly. wink

In every case you manually have to take care if the JS is already included. This is important for common JS like Prototype. The other way around from the plugins authors perspective you have to chance to figure out, if a certain JS was already included (which your JS / plugin depends on).

See also: Bugs:Item1889

Examples

Impact and Available Solutions

WhatDoesItAffect: Rendering, Plugins, Performance, Published API
AffectedExtensions:  
HaveQuickFixFor:  

Implementation

-- Contributors: OliverKrueger

Discussion

-- OliverKrueger - 31 Aug 2006

How bad is double inclusion? If file are read from the cache the load would be minimal.

-- ArthurClemens - 31 Aug 2006

If the JS is only referenced, the impact is quite minimal. Double-inclusion is probably only a problem, if you put the actual code in there.

But double inclusion is only one aspect of this topic. The more important one (for me) is the load order.

-- OliverKrueger - 31 Aug 2006

At what level would be decided what the 'correct' order is? In the templates?

-- ArthurClemens - 31 Aug 2006

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2006-08-31 - ArthurClemens
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.