Tags:
create new tag
, view all tags

Examine proliferation of the use of javascript

I just noticed that the even a simple search now involves some javascript in the generated result:

<div class="patternSearchResultCount" id="twikiBottomResultCount">Number of topics: <b>67</b></div><!--/patternSearchResultCount-->
<script type="text/javascript">
// write results at the top
//<![CDATA[
   insertHtml('<br />Number of topics: <b>67</b>', 'twikiNumberOfResultsContainer');
   var count = 67;
   if (count < 10) {
      insertHtml('', 'twikiBottomResultCount');
   }
//]]>
</script><p />

The use of javascript has never been discussed or agreed upon. We need to have a discussion and agreement when and where javascript is appropriate. We need to understand the impact on performance of having javascript all over our topics even where maybe not really needed.

The point is not the particular example above, but the use of Java Script in general.

I don't know whether javascript is or is not appropriate. However, my understanding is that we have we always kept javascript to a minimum, but I notice that the reliance of javascript is creeping up. We should set some standards or policies around this, I think.

Thus, please do not consider this topic to be "anti-java script". Instead, it is asking to first understand the impact of the proliferation of java script and then deploy that tool wisely, lest we end up with even more performance problems than we already have.

Java script occurs in

templates/attach.classic.tmpl
templates/attach.nat.tmpl
templates/attach.pattern.tmpl
templates/attach.tmpl
templates/changeform.nat.tmpl
templates/changes.nat.tmpl
templates/defaultjavascript.nat.tmpl
templates/edit.classic.tmpl
templates/edit.iejs.classic.tmpl
templates/edit.iejs.tmpl
templates/edit.kupu.tmpl
templates/edit.nat.tmpl
templates/edit.pattern.tmpl
templates/edit.tmpl
templates/editform.nat.tmpl
templates/editjavascript.nat.tmpl
templates/editjavascript.natedit.tmpl
templates/edittoolbar.natedit.tmpl
templates/edittopicactions.nat.tmpl
templates/javascript.pattern.tmpl
templates/login.pattern.tmpl
templates/messages.nat.tmpl
templates/moveattachment.nat.tmpl
templates/oops.nat.tmpl
templates/oopsempty.nat.tmpl
templates/oopslanguagechanged.nat.tmpl
templates/oopslanguagechanged.pattern.tmpl
templates/oopslanguagechanged.tmpl
templates/oopslocked.nat.tmpl
templates/oopsrev.nat.tmpl
templates/oopssaveerr.nat.tmpl
templates/page.nat.tmpl
templates/page.pattern.tmpl
templates/preview.nat.tmpl
templates/preview.pattern.tmpl
templates/previewjavascript.nat.tmpl
templates/previewtoolbar.natedit.tmpl
templates/previewtopicactions.nat.tmpl
templates/rdiff.nat.tmpl
templates/renamebase.classic.tmpl
templates/renamebase.nat.tmpl
templates/renamebase.pattern.tmpl
templates/renamebase.tmpl
templates/renamedelete.classic.tmpl
templates/renamedelete.pattern.tmpl
templates/renamedelete.tmpl
templates/renamejavascript.nat.tmpl
templates/renamewebbase.classic.tmpl
templates/renamewebbase.nat.tmpl
templates/renamewebbase.tmpl
templates/renamewebdelete.classic.tmpl
templates/renamewebdelete.tmpl
templates/renamewebjavascript.nat.tmpl
templates/searchbase.nat.tmpl
templates/searchbase.pattern.tmpl
templates/searchjavascript.nat.tmpl
templates/settings.classic.tmpl
templates/settings.nat.tmpl
templates/settings.pattern.tmpl
templates/settings.tmpl
templates/settingstoolbar.natedit.tmpl
templates/settingstopicactions.nat.tmpl
templates/twiki.classic.tmpl
templates/twiki.tmpl
templates/view.nat.tmpl
templates/view.plain.nat.tmpl
templates/view.print.nat.tmpl

Note that even the core templates contain javascript:

templates/attach.tmpl
templates/edit.iejs.tmpl
templates/edit.tmpl
templates/oopslanguagechanged.tmpl
templates/renamebase.tmpl
templates/renamedelete.tmpl
templates/renamewebbase.tmpl
templates/renamewebdelete.tmpl
templates/settings.tmpl
templates/twiki.tmpl

-- Contributors: ThomasWeigert - 08 Nov 2006

Discussion

No, actually we don't rely on javascript. Our standard is graceful degradation.

-- ArthurClemens

I agree with Thomas.

right now there is no design or strategy for the use, or sytematic architecture of javascript usage in TWiki and its plugins, and there is definitly alot of thought needed on how to better support the magic, without getting in the way of other things, or simply making yet another hard to maintain area of twiki.

Arthur and I were begining to discuss creating javascript dependancies, and then using an agregator to create single load sets, but we've along way to go in exploring what are 1) best practices in javascript and 2) what are best practices for TWiki integrated javascript.

there is quite a difference, because TWiki topics are generated - this opens the way towards generating the javascript too, or to offloading some of the rendering. Knowing which of these tradeoffs are the right ones, is the hard thing.

-- SvenDowideit - 08 Nov 2006

What is the topic being discussed? Quality of code? Performance? Graceful fallback with no javascript? All of these?

-- ArthurClemens - 08 Nov 2006

I agree that Javascript must be kept to a minimun in the core and core templates until the proper standards are set (remember, just by publishing one javascript function we are kind of "doomed" to support that functions for backward compatibility). OTOH, if a skin writter want's to use Javascript, its his/her responsability.

-- RafaelAlvarez - 08 Nov 2006

PatternSkin is the de facto standard skin, so it must be treated as if it was part of core. Nobody seems to be using the old classic skin.

-- ThomasWeigert - 08 Nov 2006

for my part I'm talking about the long term viability, maintainability and abilty to respond to changing requirements of the adhoc approach we are currently using. The list that Thomas made above certainly was a surprise to me :O

-- SvenDowideit - 08 Nov 2006

Remove Edit IE JS Tmpl

-- CrawfordCurrie - 09 Nov 2006

This relates to TWikiSecurity, particularly for Internet sites but also for intranet sites - as new security holes are discovered in JavaScript, and when users have JavaScript turned on in their browser to support TWiki, it's very easy for an attacker to write a page that embeds JavaScript to attack the browser. Unless we can robustly filter all JavaScript in editable part of pages, this remains a concern.

One way to test this is to use the FirefoxBrowser's NoScript extension, which allows you to selectively turn on JavaScript, with the default for most sites being 'off'.

-- RichardDonkin - 10 Nov 2006

Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2006-11-10 - RichardDonkin
 
  • 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.