s/twikismart/wikismart/g and renamed dirs Foswiki in System
authorColas Nahaboo <colas@nahaboo.net>
Mon, 13 Apr 2009 21:07:37 +0200
changeset 170d6654328e6
parent 0 a2b5d9d9d8a8
child 2 60c0f6e1eff0
s/twikismart/wikismart/g and renamed dirs Foswiki in System
README-SmartEditAddOn.txt
data/Foswiki/SmartEditAddOn.txt
data/Foswiki/SmartEditAddOnHelp.txt
data/Foswiki/SmartEditContrib.txt
data/System/SmartEditAddOn.txt
data/System/SmartEditAddOnHelp.txt
data/System/SmartEditContrib.txt
pub/Foswiki/SmartEditAddOn/adjust.gif
pub/Foswiki/SmartEditAddOn/background-leftimg.gif
pub/Foswiki/SmartEditAddOn/background-toolbar.gif
pub/Foswiki/SmartEditAddOn/background-toolbar.png
pub/Foswiki/SmartEditAddOn/bg_ie.gif
pub/Foswiki/SmartEditAddOn/bgbottom.gif
pub/Foswiki/SmartEditAddOn/blockquote.gif
pub/Foswiki/SmartEditAddOn/bold.gif
pub/Foswiki/SmartEditAddOn/boldItalic.gif
pub/Foswiki/SmartEditAddOn/br.gif
pub/Foswiki/SmartEditAddOn/bullist.gif
pub/Foswiki/SmartEditAddOn/close.gif
pub/Foswiki/SmartEditAddOn/code.png
pub/Foswiki/SmartEditAddOn/down.jpg
pub/Foswiki/SmartEditAddOn/down2.jpg
pub/Foswiki/SmartEditAddOn/expand.gif
pub/Foswiki/SmartEditAddOn/exthyperlink.png
pub/Foswiki/SmartEditAddOn/forecolor.gif
pub/Foswiki/SmartEditAddOn/forecolorold.gif
pub/Foswiki/SmartEditAddOn/g040.gif
pub/Foswiki/SmartEditAddOn/g080.gif
pub/Foswiki/SmartEditAddOn/h1.gif
pub/Foswiki/SmartEditAddOn/h2.gif
pub/Foswiki/SmartEditAddOn/h3.gif
pub/Foswiki/SmartEditAddOn/h4.gif
pub/Foswiki/SmartEditAddOn/h5.gif
pub/Foswiki/SmartEditAddOn/h6.gif
pub/Foswiki/SmartEditAddOn/help.gif
pub/Foswiki/SmartEditAddOn/hr.gif
pub/Foswiki/SmartEditAddOn/includesmartedit.js
pub/Foswiki/SmartEditAddOn/includesmartediton.js
pub/Foswiki/SmartEditAddOn/indent.gif
pub/Foswiki/SmartEditAddOn/info.gif
pub/Foswiki/SmartEditAddOn/italic.gif
pub/Foswiki/SmartEditAddOn/left.jpg
pub/Foswiki/SmartEditAddOn/line.gif
pub/Foswiki/SmartEditAddOn/loupe.gif
pub/Foswiki/SmartEditAddOn/mochikit/Changes
pub/Foswiki/SmartEditAddOn/mochikit/LICENSE.txt
pub/Foswiki/SmartEditAddOn/mochikit/MANIFEST
pub/Foswiki/SmartEditAddOn/mochikit/META.json
pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/Async.html
pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/Base.html
pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/Color.html
pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/DOM.html
pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/DateTime.html
pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/Format.html
pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/Iter.html
pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/Logging.html
pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/LoggingPane.html
pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/Signal.html
pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/VersionHistory.html
pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/Visual.html
pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/index.html
pub/Foswiki/SmartEditAddOn/mochikit/doc/js/toc.js
pub/Foswiki/SmartEditAddOn/mochikit/doc/rst/MochiKit/Async.rst
pub/Foswiki/SmartEditAddOn/mochikit/doc/rst/MochiKit/Base.rst
pub/Foswiki/SmartEditAddOn/mochikit/doc/rst/MochiKit/Color.rst
pub/Foswiki/SmartEditAddOn/mochikit/doc/rst/MochiKit/DOM.rst
pub/Foswiki/SmartEditAddOn/mochikit/doc/rst/MochiKit/DateTime.rst
pub/Foswiki/SmartEditAddOn/mochikit/doc/rst/MochiKit/Format.rst
pub/Foswiki/SmartEditAddOn/mochikit/doc/rst/MochiKit/Iter.rst
pub/Foswiki/SmartEditAddOn/mochikit/doc/rst/MochiKit/Logging.rst
pub/Foswiki/SmartEditAddOn/mochikit/doc/rst/MochiKit/LoggingPane.rst
pub/Foswiki/SmartEditAddOn/mochikit/doc/rst/MochiKit/Signal.rst
pub/Foswiki/SmartEditAddOn/mochikit/doc/rst/MochiKit/VersionHistory.rst
pub/Foswiki/SmartEditAddOn/mochikit/doc/rst/MochiKit/Visual.rst
pub/Foswiki/SmartEditAddOn/mochikit/doc/rst/MochiKit/index.rst
pub/Foswiki/SmartEditAddOn/mochikit/include/css/documentation.css
pub/Foswiki/SmartEditAddOn/mochikit/include/css/general.css
pub/Foswiki/SmartEditAddOn/mochikit/lib/MochiKit/Async.js
pub/Foswiki/SmartEditAddOn/mochikit/lib/MochiKit/Base.js
pub/Foswiki/SmartEditAddOn/mochikit/lib/MochiKit/Color.js
pub/Foswiki/SmartEditAddOn/mochikit/lib/MochiKit/DOM.js
pub/Foswiki/SmartEditAddOn/mochikit/lib/MochiKit/DateTime.js
pub/Foswiki/SmartEditAddOn/mochikit/lib/MochiKit/Format.js
pub/Foswiki/SmartEditAddOn/mochikit/lib/MochiKit/Iter.js
pub/Foswiki/SmartEditAddOn/mochikit/lib/MochiKit/Logging.js
pub/Foswiki/SmartEditAddOn/mochikit/lib/MochiKit/LoggingPane.js
pub/Foswiki/SmartEditAddOn/mochikit/lib/MochiKit/MochiKit.js
pub/Foswiki/SmartEditAddOn/mochikit/lib/MochiKit/MockDOM.js
pub/Foswiki/SmartEditAddOn/mochikit/lib/MochiKit/Signal.js
pub/Foswiki/SmartEditAddOn/mochikit/lib/MochiKit/Test.js
pub/Foswiki/SmartEditAddOn/mochikit/lib/MochiKit/Visual.js
pub/Foswiki/SmartEditAddOn/mochikit/lib/MochiKit/__package__.js
pub/Foswiki/SmartEditAddOn/mochikit/packed/MochiKit/MochiKit.js
pub/Foswiki/SmartEditAddOn/mochikit/packed/MochiKit/__package__.js
pub/Foswiki/SmartEditAddOn/next.gif
pub/Foswiki/SmartEditAddOn/nop.png
pub/Foswiki/SmartEditAddOn/normal.gif
pub/Foswiki/SmartEditAddOn/numlist.gif
pub/Foswiki/SmartEditAddOn/ok.gif
pub/Foswiki/SmartEditAddOn/outdent.gif
pub/Foswiki/SmartEditAddOn/preview.gif
pub/Foswiki/SmartEditAddOn/previous.gif
pub/Foswiki/SmartEditAddOn/redo.png
pub/Foswiki/SmartEditAddOn/right.gif
pub/Foswiki/SmartEditAddOn/right1.jpg
pub/Foswiki/SmartEditAddOn/screenShotSmartEditor.JPG
pub/Foswiki/SmartEditAddOn/search.gif
pub/Foswiki/SmartEditAddOn/separator.gif
pub/Foswiki/SmartEditAddOn/smartEditAutoCompletion.js
pub/Foswiki/SmartEditAddOn/smartEditDynamicDivision.js
pub/Foswiki/SmartEditAddOn/smartEditUI.js
pub/Foswiki/SmartEditAddOn/smiley.png
pub/Foswiki/SmartEditAddOn/strings.png
pub/Foswiki/SmartEditAddOn/styles.gif
pub/Foswiki/SmartEditAddOn/testn.gif
pub/Foswiki/SmartEditAddOn/testp.gif
pub/Foswiki/SmartEditAddOn/transparent.gif
pub/Foswiki/SmartEditAddOn/undo.png
pub/Foswiki/SmartEditAddOn/up.jpg
pub/Foswiki/SmartEditAddOn/updown.gif
pub/Foswiki/SmartEditAddOn/upp.jpg
pub/Foswiki/SmartEditAddOn/validate.gif
pub/Foswiki/SmartEditAddOn/verbatim.gif
pub/Foswiki/SmartEditAddOn/warning.gif
pub/Foswiki/SmartEditAddOn/warning2.gif
pub/Foswiki/SmartEditAddOn/wikilink.png
pub/Foswiki/SmartEditAddOn/wikismartActions.js
pub/Foswiki/SmartEditAddOn/wikismartEngine.js
pub/Foswiki/SmartEditAddOn/wikismartEvents.js
pub/Foswiki/SmartEditAddOn/wikismartstyle.css
pub/System/SmartEditAddOn/adjust.gif
pub/System/SmartEditAddOn/background-leftimg.gif
pub/System/SmartEditAddOn/background-toolbar.gif
pub/System/SmartEditAddOn/background-toolbar.png
pub/System/SmartEditAddOn/bg_ie.gif
pub/System/SmartEditAddOn/bgbottom.gif
pub/System/SmartEditAddOn/blockquote.gif
pub/System/SmartEditAddOn/bold.gif
pub/System/SmartEditAddOn/boldItalic.gif
pub/System/SmartEditAddOn/br.gif
pub/System/SmartEditAddOn/bullist.gif
pub/System/SmartEditAddOn/close.gif
pub/System/SmartEditAddOn/code.png
pub/System/SmartEditAddOn/down.jpg
pub/System/SmartEditAddOn/down2.jpg
pub/System/SmartEditAddOn/expand.gif
pub/System/SmartEditAddOn/exthyperlink.png
pub/System/SmartEditAddOn/forecolor.gif
pub/System/SmartEditAddOn/forecolorold.gif
pub/System/SmartEditAddOn/g040.gif
pub/System/SmartEditAddOn/g080.gif
pub/System/SmartEditAddOn/h1.gif
pub/System/SmartEditAddOn/h2.gif
pub/System/SmartEditAddOn/h3.gif
pub/System/SmartEditAddOn/h4.gif
pub/System/SmartEditAddOn/h5.gif
pub/System/SmartEditAddOn/h6.gif
pub/System/SmartEditAddOn/help.gif
pub/System/SmartEditAddOn/hr.gif
pub/System/SmartEditAddOn/includesmartedit.js
pub/System/SmartEditAddOn/includesmartediton.js
pub/System/SmartEditAddOn/indent.gif
pub/System/SmartEditAddOn/info.gif
pub/System/SmartEditAddOn/italic.gif
pub/System/SmartEditAddOn/left.jpg
pub/System/SmartEditAddOn/line.gif
pub/System/SmartEditAddOn/loupe.gif
pub/System/SmartEditAddOn/mochikit/Changes
pub/System/SmartEditAddOn/mochikit/LICENSE.txt
pub/System/SmartEditAddOn/mochikit/MANIFEST
pub/System/SmartEditAddOn/mochikit/META.json
pub/System/SmartEditAddOn/mochikit/doc/html/MochiKit/Async.html
pub/System/SmartEditAddOn/mochikit/doc/html/MochiKit/Base.html
pub/System/SmartEditAddOn/mochikit/doc/html/MochiKit/Color.html
pub/System/SmartEditAddOn/mochikit/doc/html/MochiKit/DOM.html
pub/System/SmartEditAddOn/mochikit/doc/html/MochiKit/DateTime.html
pub/System/SmartEditAddOn/mochikit/doc/html/MochiKit/Format.html
pub/System/SmartEditAddOn/mochikit/doc/html/MochiKit/Iter.html
pub/System/SmartEditAddOn/mochikit/doc/html/MochiKit/Logging.html
pub/System/SmartEditAddOn/mochikit/doc/html/MochiKit/LoggingPane.html
pub/System/SmartEditAddOn/mochikit/doc/html/MochiKit/Signal.html
pub/System/SmartEditAddOn/mochikit/doc/html/MochiKit/VersionHistory.html
pub/System/SmartEditAddOn/mochikit/doc/html/MochiKit/Visual.html
pub/System/SmartEditAddOn/mochikit/doc/html/MochiKit/index.html
pub/System/SmartEditAddOn/mochikit/doc/js/toc.js
pub/System/SmartEditAddOn/mochikit/doc/rst/MochiKit/Async.rst
pub/System/SmartEditAddOn/mochikit/doc/rst/MochiKit/Base.rst
pub/System/SmartEditAddOn/mochikit/doc/rst/MochiKit/Color.rst
pub/System/SmartEditAddOn/mochikit/doc/rst/MochiKit/DOM.rst
pub/System/SmartEditAddOn/mochikit/doc/rst/MochiKit/DateTime.rst
pub/System/SmartEditAddOn/mochikit/doc/rst/MochiKit/Format.rst
pub/System/SmartEditAddOn/mochikit/doc/rst/MochiKit/Iter.rst
pub/System/SmartEditAddOn/mochikit/doc/rst/MochiKit/Logging.rst
pub/System/SmartEditAddOn/mochikit/doc/rst/MochiKit/LoggingPane.rst
pub/System/SmartEditAddOn/mochikit/doc/rst/MochiKit/Signal.rst
pub/System/SmartEditAddOn/mochikit/doc/rst/MochiKit/VersionHistory.rst
pub/System/SmartEditAddOn/mochikit/doc/rst/MochiKit/Visual.rst
pub/System/SmartEditAddOn/mochikit/doc/rst/MochiKit/index.rst
pub/System/SmartEditAddOn/mochikit/include/css/documentation.css
pub/System/SmartEditAddOn/mochikit/include/css/general.css
pub/System/SmartEditAddOn/mochikit/lib/MochiKit/Async.js
pub/System/SmartEditAddOn/mochikit/lib/MochiKit/Base.js
pub/System/SmartEditAddOn/mochikit/lib/MochiKit/Color.js
pub/System/SmartEditAddOn/mochikit/lib/MochiKit/DOM.js
pub/System/SmartEditAddOn/mochikit/lib/MochiKit/DateTime.js
pub/System/SmartEditAddOn/mochikit/lib/MochiKit/Format.js
pub/System/SmartEditAddOn/mochikit/lib/MochiKit/Iter.js
pub/System/SmartEditAddOn/mochikit/lib/MochiKit/Logging.js
pub/System/SmartEditAddOn/mochikit/lib/MochiKit/LoggingPane.js
pub/System/SmartEditAddOn/mochikit/lib/MochiKit/MochiKit.js
pub/System/SmartEditAddOn/mochikit/lib/MochiKit/MockDOM.js
pub/System/SmartEditAddOn/mochikit/lib/MochiKit/Signal.js
pub/System/SmartEditAddOn/mochikit/lib/MochiKit/Test.js
pub/System/SmartEditAddOn/mochikit/lib/MochiKit/Visual.js
pub/System/SmartEditAddOn/mochikit/lib/MochiKit/__package__.js
pub/System/SmartEditAddOn/mochikit/packed/MochiKit/MochiKit.js
pub/System/SmartEditAddOn/mochikit/packed/MochiKit/__package__.js
pub/System/SmartEditAddOn/next.gif
pub/System/SmartEditAddOn/nop.png
pub/System/SmartEditAddOn/normal.gif
pub/System/SmartEditAddOn/numlist.gif
pub/System/SmartEditAddOn/ok.gif
pub/System/SmartEditAddOn/outdent.gif
pub/System/SmartEditAddOn/preview.gif
pub/System/SmartEditAddOn/previous.gif
pub/System/SmartEditAddOn/redo.png
pub/System/SmartEditAddOn/right.gif
pub/System/SmartEditAddOn/right1.jpg
pub/System/SmartEditAddOn/screenShotSmartEditor.JPG
pub/System/SmartEditAddOn/search.gif
pub/System/SmartEditAddOn/separator.gif
pub/System/SmartEditAddOn/smartEditAutoCompletion.js
pub/System/SmartEditAddOn/smartEditDynamicDivision.js
pub/System/SmartEditAddOn/smartEditUI.js
pub/System/SmartEditAddOn/smiley.png
pub/System/SmartEditAddOn/strings.png
pub/System/SmartEditAddOn/styles.gif
pub/System/SmartEditAddOn/testn.gif
pub/System/SmartEditAddOn/testp.gif
pub/System/SmartEditAddOn/transparent.gif
pub/System/SmartEditAddOn/undo.png
pub/System/SmartEditAddOn/up.jpg
pub/System/SmartEditAddOn/updown.gif
pub/System/SmartEditAddOn/upp.jpg
pub/System/SmartEditAddOn/validate.gif
pub/System/SmartEditAddOn/verbatim.gif
pub/System/SmartEditAddOn/warning.gif
pub/System/SmartEditAddOn/warning2.gif
pub/System/SmartEditAddOn/wikilink.png
pub/System/SmartEditAddOn/wikismartActions.js
pub/System/SmartEditAddOn/wikismartEngine.js
pub/System/SmartEditAddOn/wikismartEvents.js
pub/System/SmartEditAddOn/wikismartstyle.css
templates/edit.smarteditor.tmpl
     1.1 --- a/README-SmartEditAddOn.txt	Mon Apr 13 12:51:06 2009 +0200
     1.2 +++ b/README-SmartEditAddOn.txt	Mon Apr 13 21:07:37 2009 +0200
     1.3 @@ -60,21 +60,21 @@
     1.4  
     1.5  <script type="text/javascript">
     1.6  // The script URL - with / at the end
     1.7 -twikismartScriptURL = '%PUBURLPATH%/%TWIKIWEB%/SmartEditAddOn/';   
     1.8 -twikismartWikiHomeURL = '%SCRIPTURL%/view'; 
     1.9 -twikismartWikiSkin = '%SKIN%';
    1.10 +wikismartScriptURL = '%PUBURLPATH%/%TWIKIWEB%/SmartEditAddOn/';   
    1.11 +wikismartWikiHomeURL = '%SCRIPTURL%/view'; 
    1.12 +wikismartWikiSkin = '%SKIN%';
    1.13  // Load all specific preferences
    1.14 -twikismartSitePreferences = ""+"%SMARTEDITSTRINGSITE%";
    1.15 -twikismartWebPreferences = ""+"%SMARTEDITSTRINGWEB%";
    1.16 -twikismartCustomerPreferences = ""+"%SMARTEDITSTRINGUSERS%";
    1.17 +wikismartSitePreferences = ""+"%SMARTEDITSTRINGSITE%";
    1.18 +wikismartWebPreferences = ""+"%SMARTEDITSTRINGWEB%";
    1.19 +wikismartCustomerPreferences = ""+"%SMARTEDITSTRINGUSERS%";
    1.20  // 3 following lines to add if you have an old smartedit addon installation
    1.21 -twikismartTWikiSiteIcons = ''+'%SMARTEDITICONSITE%';
    1.22 -twikismartTWikiWebIcons = ''+'%SMARTEDITICONWEB%';
    1.23 -twikismartTWikiUserIcons = ''+'%SMARTEDITICONUSER%';
    1.24 +wikismartTWikiSiteIcons = ''+'%SMARTEDITICONSITE%';
    1.25 +wikismartTWikiWebIcons = ''+'%SMARTEDITICONWEB%';
    1.26 +wikismartTWikiUserIcons = ''+'%SMARTEDITICONUSER%';
    1.27  // End of copy
    1.28 -twikismartCurrentWeb = "%WEB%";
    1.29 -twikismartTWikiIcons = '%SMARTEDITICONS%';
    1.30 +wikismartCurrentWeb = "%WEB%";
    1.31 +wikismartTWikiIcons = '%SMARTEDITICONS%';
    1.32  // To know the id of the textarea ... if it is not 'topic'
    1.33 -twikismartEdit('topic');
    1.34 +wikismartEdit('topic');
    1.35  </script>
    1.36  
     2.1 --- a/data/Foswiki/SmartEditAddOn.txt	Mon Apr 13 12:51:06 2009 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,164 +0,0 @@
     2.4 ----+!! <nop>Smart Edit Add-On
     2.5 -
     2.6 -Smart Edit is a !JavaScript editor "&agrave; la wikipedia" for TWiki.
     2.7 -
     2.8 -It takes an alternate approach to the WYSIWYG one, as its goals are
     2.9 -   * be useful, even for experienced wiki users
    2.10 -   * predictability: What you see is what will be saved
    2.11 -   * reliability: use only the standard TEXTAREA of the browsers
    2.12 -   * be unobstrusive: as long as you do not use the toolbar, you are still using the traditional twiki editor
    2.13 -
    2.14 -The aim is to assist TWiki.WikiSyntax editing by providing the following features as !JavaScript code:
    2.15 -
    2.16 -   * TWiki syntax insertion
    2.17 -   * Keyboard shortcuts
    2.18 -   * Configurable menus
    2.19 -   * A dynamic TWiki link selection
    2.20 -   * A search bar
    2.21 -
    2.22 -Smart Edit is a !JavaScript application, working on *Firefox* , *Internet Explorer* and *Mozilla* . The code is clearly sub-optimal, and should be rewritten as it can be too slow on big topics. It is however much faster on firefox, meaning that you will be able to edit comfortably 15k topics with IE and 80k topics on Firefox. However, we use it as our default editor on our intranet.
    2.23 -
    2.24 -*You can see a demo here* : http://twbw-test.luddeni.net/bin/view/Sandbox (<nop>DemoDemo/demo)
    2.25 -
    2.26 -<img src="%ATTACHURLPATH%/screenShotSmartEditor.JPG" alt="screenShotSmartEditor.JPG" width='766' height='67' />
    2.27 -
    2.28 -%TOC%
    2.29 -
    2.30 ----++ Features and user manual
    2.31 ----+++ Styles
    2.32 -
    2.33 -*Supported styles* : Bold, Bold Italic, Italic, Formatted, Verbatim, Blockquote, Heading 1 to 6.
    2.34 -
    2.35 -*How does it work ?*
    2.36 -
    2.37 -When you click on the bold button (for example), Smart Edit gets your selection and inserts the bold tags at the right place. This editor doesn't have a context engine so if you click 2 times on the bold button, you will have 2 bold tags.
    2.38 -
    2.39 -<nop>SmartEditAddOn aumatically detect blanks and line break to insert tags at the right place.
    2.40 -
    2.41 ----+++ Lists
    2.42 -
    2.43 -*List types* : Normal (bullet) and numered.
    2.44 -
    2.45 -*How does it work ?*
    2.46 -
    2.47 -Basically, it works like styles but a minimal context was developped to help you.
    2.48 -
    2.49 -   * A click on the list button add a list item a the beginning of the current line. You do not need to put the cursor at this place or to select the while line.
    2.50 -
    2.51 -   * You just type * and 1 space, then you type your text and when you type on the "return" key, the list item is automatically created.
    2.52 -   * If you are editing a list item and you hit the return key, a new list item will be created with the same indentation in the next line.
    2.53 -   * To indent or outdent a list item, you can just hit the "TAB" key of "SHIFT TAB" like in others editors
    2.54 -   * SHIFT+RETURN creates a br tag on the next line
    2.55 -
    2.56 ----+++ Links
    2.57 -
    2.58 -   * *External links*
    2.59 -      * Smart Edit provides you a simple and intuitive interface to insert a link. You can also watch a preview of the given link.
    2.60 -
    2.61 -   * *Internal links*
    2.62 -      * A dynamic interface help you to select and insert a TWiki link. You just have to select one web in a list, then choose a topic by its name with auto completion assistance.
    2.63 -
    2.64 ----+++ Icons
    2.65 -
    2.66 -*Configuration* via the TWiki variables SMARTEDITICONSITE, SMARTEDITICONWEB, SMARTEDITICONUSER that take a list of XML values of the ICON graphics and its LABEL like 
    2.67 -<br> =&lt;tselement&gt;&lt;tsname&gt; LABEL &lt;/tsname&gt;&lt;tsstring&gt; ICON &lt;/tsstring&gt;&lt;/tselement&gt;=
    2.68 -<br> e.g. =&lt;tselement&gt;&lt;tsname&gt; %<nop>ICON{lock}%&lt;/tsname&gt;&lt;tsstring&gt;%&lt;nop&gt;ICON{lock}%&lt;/tsstring&gt;&lt;/tselement&gt;=
    2.69 -
    2.70 -To add more than one element, you just have to copy from =&lt;tselement&gt;= to =&lt;/tselement&gt;= and to complete each one.
    2.71 -
    2.72 -*Warning*: the ICON and LABEL should only use double quotes ", not simple quotes '. The %<nop>ICON{...}% construct uses double quote, as in =&lt;img src="..."&gt;=, you should not use =&lt;img src='...'&gt;= otherwise smartedit wont run and you will stay in raw edit.
    2.73 -
    2.74 -*Use* : Just open the icon chooser with icon button and click on your image to insert it into the text.
    2.75 -
    2.76 ----+++ Insertion
    2.77 -
    2.78 -*Basic insertion* : Smart Edit provides you some basic tags to insert that are =&lt;nop&gt;=, =&lt;br /&gt;= and =&lt;hr /&gt;=. But it is possible to configure personal strings to insert by editing a simple TWiki variable.
    2.79 -
    2.80 -*Configuration* : via the TWiki variables SMARTEDITSTRINGSITE,  SMARTEDITSTRINGWEB, SMARTEDITSTRINGUSERS that take a list of XML values of the STRING to insert and its LABEL like 
    2.81 -<br> =&lt;tselement&gt;&lt;tsname&gt; LABEL &lt;/tsname&gt;&lt;tsstring&gt; STRING &lt;/tsstring&gt;&lt;/tselement&gt;=
    2.82 -<br> e.g. =&lt;tselement&gt;&lt;tsname&gt; Today's Date&lt;/tsname&gt;&lt;tsstring&gt; %<nop>GMTIME{$year-$mo-$day}%&lt;/tsstring&gt;&lt;/tselement&gt;=
    2.83 -
    2.84 -To add more than one element, you just have to copy from =&lt;tselement&gt;= to =&lt;/tselement&gt;= and to complete each one.
    2.85 -
    2.86 -*Warning*: the ICON and LABEL should only use simple quotes ', not double quotes "
    2.87 -
    2.88 -
    2.89 ----+++ Search
    2.90 -
    2.91 -Smart Edit also provides you a search toolbar. You just have to type your text and you know automatically if the typed text is found into the textarea.
    2.92 -
    2.93 -Info : When you are entering text into the search text box, a click on the "*return*" key automatically selects the first occurence of your text.
    2.94 -Textarea size
    2.95 -
    2.96 -Smart Edit gives you the ability to increase or decrease the textarea height with these buttons: . You can also set the textarea size to the exact number of lines in your text by clicking on the "Auto fit" button. 
    2.97 -
    2.98 ----+++ Keyboard shortcuts
    2.99 -
   2.100 -   * *TAB* - Indent the current line (no selection needed)
   2.101 -   * *SHIFT+TAB* - Outdent the current line (no selection needed)
   2.102 -   * *RETURN*
   2.103 -      * If there is a list item into the current line, automatically go to the next line and add a new list item with the same indentation
   2.104 -      * If there is a list item into the current line and no text, automatically go to the next line, deleting last empty list item
   2.105 -      * If your the text in the current line is indented, go to the next line with the same indentation
   2.106 -   * *SHIFT+RETURN*
   2.107 -      * Go to the next line, add a br tag with the same indentation 
   2.108 -
   2.109 ----++ Add-On Install new release
   2.110 -
   2.111 -When a new release is available, you just have to download the zip file and to unzip it from your twiki root directory.
   2.112 -
   2.113 ----++ Add-On Installation Instructions on pattern-based skins
   2.114 -   * unzip/untar the plugin at the root level of your twiki install
   2.115 -   * If you use the default pattern skin, just put in your <nop>Main.TWikiPreferences a
   2.116 -<verbatim>
   2.117 -      * Set SKIN = smarteditor, pattern
   2.118 -</verbatim>
   2.119 -   * Note that it should be compatible with other pattern modifications,
   2.120 -     e.g. =Set SKIN = smarteditor, editdefault, pattern=
   2.121 -   * Add the following declarations to the same <nop>Main.TWikiPreferences topic. You can expand and/or modify these at will
   2.122 -<verbatim>
   2.123 ----++ Smartedit
   2.124 -Warning: only use simple quotes ', not double quotes " in the following 3 vars:
   2.125 -   * Set SMARTEDITSTRINGSITE = <tselement><tsname>Today's Date</tsname><tsstring>%GMTIME{$year-$mo-$day}%</tsstring></tselement><tselement><tsname>User name</tsname><tsstring>%WIKIUSERNAME%</tsstring></tselement><tselement><tsname>Signature</tsname><tsstring>--&nbsp;%WIKIUSERNAME% - %DATE%</tsstring></tselement><tselement><tsname>Comments, signed and dated, added at top</tsname><tsstring>%<nop>COMMENT{type='top'}%</tsstring></tselement><tselement><tsname>Comments, signed and dated, added at end</tsname><tsstring>%<nop>COMMENT{type='bottom'}%</tsstring></tselement><tselement><tsname>Comments, signed and dated, added immediately before</tsname><tsstring>%<nop>COMMENT{type='above'}%</tsstring></tselement><tselement><tsname>Bullet item added immediately before</tsname><tsstring>%<nop>COMMENT{type='bulletabove'}%</tsstring></tselement><tselement><tsname>Wiki thread mode comment, signed and dated</tsname><tsstring>%<nop>COMMENT{type='threadmode'}%</tsstring></tselement><tselement><tsname>Comments, signed and dated, added recurse after comment box</tsname><tsstring>%<nop>COMMENT{type='belowthreadmode'}%</tsstring></tselement><tselement><tsname>Comments, signed and dated, added immediately below</tsname><tsstring>%<nop>COMMENT{type='below'}%</tsstring></tselement><tselement><tsname>Comments, signed and dated, added at top of table below</tsname><tsstring>%<nop>COMMENT{type='tableprepend'}%</tsstring></tselement><tselement><tsname>Comments, signed and dated, added at end of table above</tsname><tsstring>%<nop>COMMENT{type='tableappend'}%</tsstring></tselement><tselement><tsname>Add before the comment box, after the last comment</tsname><tsstring>%<nop>COMMENT{type='after'}%</tsstring></tselement><tselement><tsname>Action of Action Tracker added to action table directly above</tsname><tsstring>%<nop>COMMENT{type='action'}%</tsstring></tselement><tselement><tsname>Tablerows adding on end</tsname><tsstring>%<nop>COMMENT{type='table'}%</tsstring></tselement><tselement><tsname>Talk using TOC adding on end</tsname><tsstring>%<nop>COMMENT{type='toctalk'}%</tsstring></tselement><tselement><tsname>Create a list of annotated bookmarks</tsname><tsstring>%<nop>COMMENT{type='bookmark'}%</tsstring></tselement><tselement><tsname>Post to a different topic and return to here</tsname><tsstring>%<nop>COMMENT{type='return'}%</tsstring></tselement>
   2.126 -   * Set SMARTEDITSTRINGWEB = 
   2.127 -   * Set SMARTEDITSTRINGUSERS =
   2.128 -   
   2.129 -Warning: only use double quotes ", not single quotes ' in the following 3 vars:
   2.130 -   * Set SMARTEDITICONSITE = <tselement><tsname> %ICON{info}%</tsname><tsstring>%<nop>ICON{info}%</tsstring></tselement><tselement><tsname> %ICON{more}%</tsname><tsstring>%<nop>ICON{more}%</tsstring></tselement><tselement><tsname> %ICON{note}%</tsname><tsstring>%<nop>ICON{note}%</tsstring></tselement><tselement><tsname> %ICON{pencil}%</tsname><tsstring>%<nop>ICON{pencil}%</tsstring></tselement><tselement><tsname> %ICON{question}%</tsname><tsstring>%<nop>ICON{question}%</tsstring></tselement><tselement><tsname> %ICON{stargold}%</tsname><tsstring>%<nop>ICON{stargold}%</tsstring></tselement><tselement><tsname> %ICON{starred}%</tsname><tsstring>%<nop>ICON{starred}%</tsstring></tselement><tselement><tsname> %ICON{stop}%</tsname><tsstring>%<nop>ICON{stop}%</tsstring></tselement><tselement><tsname> %ICON{target}%</tsname><tsstring>%<nop>ICON{target}%</tsstring></tselement><tselement><tsname> %ICON{tip}%</tsname><tsstring>%<nop>ICON{tip}%</tsstring></tselement><tselement><tsname> %ICON{warning}%</tsname><tsstring>%<nop>ICON{warning}%</tsstring></tselement><tselement><tsname> %ICON{wip}%</tsname><tsstring>%<nop>ICON{wip}%</tsstring></tselement><tselement><tsname> %ICON{watch}%</tsname><tsstring>%<nop>ICON{watch}%</tsstring></tselement><tselement><tsname> %ICON{wrench}%</tsname><tsstring>%<nop>ICON{wrench}%</tsstring></tselement><tselement><tsname> %ICON{person}%</tsname><tsstring>%<nop>ICON{person}%</tsstring></tselement><tselement><tsname> %ICON{group}%</tsname><tsstring>%<nop>ICON{group}%</tsstring></tselement><tselement><tsname> %ICON{key}%</tsname><tsstring>%<nop>ICON{key}%</tsstring></tselement><tselement><tsname> %ICON{lock}%</tsname><tsstring>%<nop>ICON{lock}%</tsstring></tselement><tselement><tsname> %ICON{new}%</tsname><tsstring>%<nop>ICON{new}%</tsstring></tselement><tselement><tsname> %ICON{todo}%</tsname><tsstring>%<nop>ICON{todo}%</tsstring></tselement><tselement><tsname> %ICON{updated}%</tsname><tsstring>%<nop>ICON{updated}%</tsstring></tselement><tselement><tsname> %ICON{done}%</tsname><tsstring>%<nop>ICON{done}%</tsstring></tselement><tselement><tsname> %ICON{closed}%</tsname><tsstring>%<nop>ICON{closed}%</tsstring></tselement><tselement><tsname> %ICON{choice-yes}%</tsname><tsstring>%<nop>ICON{choice-yes}%</tsstring></tselement><tselement><tsname> %ICON{choice-no}%</tsname><tsstring>%<nop>ICON{choice-no}%</tsstring></tselement><tselement><tsname> %ICON{choice-cancel}%</tsname><tsstring>%<nop>ICON{choice-cancel}%</tsstring></tselement><tselement><tsname> %ICON{minus}%</tsname><tsstring>%<nop>ICON{minus}%</tsstring></tselement><tselement><tsname> %ICON{plus}%</tsname><tsstring>%<nop>ICON{plus}%</tsstring></tselement><tselement><tsname> %ICON{home}%</tsname><tsstring>%<nop>ICON{home}%</tsstring></tselement><tselement><tsname> %ICON{left}%</tsname><tsstring>%<nop>ICON{left}%</tsstring></tselement><tselement><tsname> %ICON{right}%</tsname><tsstring>%<nop>ICON{right}%</tsstring></tselement><tselement><tsname> %ICON{up}%</tsname><tsstring>%<nop>ICON{up}%</tsstring></tselement><tselement><tsname> %ICON{down}%</tsname><tsstring>%<nop>ICON{down}%</tsstring></tselement>
   2.131 -   * Set SMARTEDITICONWEB =
   2.132 -   * Set SMARTEDITICONUSER =
   2.133 -
   2.134 -
   2.135 -</verbatim>
   2.136 -
   2.137 ----++ Adaptation to non-pattern based skins
   2.138 -You will have to adapt your skin for it. the principles are detailed in the =README-SmartEditAddOn.txt= in the distrib
   2.139 -
   2.140 ----++ Add-On Info
   2.141 -
   2.142 -   * Set SHORTDESCRIPTION = Toolbar to help edit TWiki content
   2.143 -
   2.144 -|  Add-on Author: | TWiki:Main/GaelCrova (Special thanks to TWiki:Main/ColasNahaboo and TWiki:Main/FredericLuddeni for their help and feedback)|
   2.145 -|  Add-on Version: | 23 Jan 2008 (v2) |
   2.146 -|  Change History: | <!-- versions below in reverse order -->&nbsp; |
   2.147 -| 23 Jan 2008: | v2: Version for TWiki Freetown, 4.2.0 |
   2.148 -|  18 Aug 2006: | IE Toolbar width fixed |
   2.149 -|  16 Aug 2006: | Tab and SHIFT-TAB events disabled in Opera - Help in a specific topic with the viewprint template |
   2.150 -|  16 Aug 2006: | Blanks in external links fixed |
   2.151 -|  10 Aug 2006: | solved display bug for insert internal link |
   2.152 -|  09 Aug 2006: | solved some bugs on TWiki 4.0.2 |
   2.153 -|  09 Aug 2006: | Removed some debug information |
   2.154 -|  08 Aug 2006: | HTML Tags corrected |
   2.155 -|  08 Aug 2006: | IE display fixed - wiki link bugs fixed |
   2.156 -|  07 Aug 2006: | Initial version |
   2.157 -|  CPAN Dependencies: | none |
   2.158 -|  Other Dependencies: | none |
   2.159 -|  Perl Version: | 5.005 |
   2.160 -|  License: | GPL |
   2.161 -|  Add-on Home: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC% |
   2.162 -|  Feedback: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Dev |
   2.163 -|  Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Appraisal |
   2.164 -
   2.165 -__Related Topic:__ %TWIKIWEB%.TWikiAddOns
   2.166 -
   2.167 --- TWiki:Main/GaelCrova - 07 Aug 2006
     3.1 --- a/data/Foswiki/SmartEditAddOnHelp.txt	Mon Apr 13 12:51:06 2009 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,113 +0,0 @@
     3.4 -%META:TOPICINFO{author="GaelCrova" date="1155721530" format="1.1" version="1.1"}%
     3.5 -%META:TOPICPARENT{name="SmartEditAddOn"}%
     3.6 ----++!! !Smartedit v2 Features and user manual
     3.7 -%STARTINCLUDE%
     3.8 -%INCLUDE{"SmartEditAddOnLocal" warn="off"}%
     3.9 -%TOC%
    3.10 -
    3.11 ----+++ Styles
    3.12 -
    3.13 -*Supported styles* : Bold, Bold Italic, Italic, Formatted, Verbatim, Blockquote, Heading 1 to 6.
    3.14 -
    3.15 -*How does it work ?*
    3.16 -
    3.17 -When you click on the bold button (for example), Smart Editor get your selection and insert the bold tags at the right place. This editor doesn't have a context engine so if you click 2 times on the bold button, you will have 2 bold tags.
    3.18 -
    3.19 -<nop>SmartEditAddOn aumatically detect blanks and line break to insert tags at the right place.
    3.20 -
    3.21 ----+++ Lists
    3.22 -
    3.23 -*List types* : Normal (bullet) and numered.
    3.24 -
    3.25 -*How does it work ?*
    3.26 -
    3.27 -Basically, it works like styles but a minimal context was developped to help you.
    3.28 -
    3.29 -	* A click on the list button add a list item a the beginning of the current line. You do not need to put the cursor at this place or to select the while line.
    3.30 -
    3.31 -	* You just type * and 1 space, then you type your text and when you type on the "return" key, the list item is automatically created.
    3.32 -	* If you are editing a list item and you hit the return key, a new list item will be created with the same indentation in the next line.
    3.33 -	* To indent or outdent a list item, you can just hit the "TAB" key of "SHIFT TAB" like in others editors
    3.34 -	* SHIFT+RETURN creates a br tag on the next line
    3.35 -
    3.36 ----+++ Links
    3.37 -
    3.38 -	* *External links*
    3.39 -		* Smart Editor provides you a simple and intuitive interface to insert a link. You can also watch a preview of the given link.
    3.40 -
    3.41 -	* *Internal links*
    3.42 -		* A dynamic interface help you to select and insert a TWiki link. You just have to select one web in a list, then choose a topic by its name with auto completion assistance.
    3.43 -
    3.44 ----+++ Icons
    3.45 -
    3.46 -*Configuration* via the TWiki variables SMARTEDITICONSITE, SMARTEDITICONWEB, SMARTEDITICONUSER that take a list of XML values of the ICON graphics and its LABEL like 
    3.47 -<br> =&lt;tselement&gt;&lt;tsname&gt; LABEL &lt;/tsname&gt;&lt;tsstring&gt; ICON &lt;/tsstring&gt;&lt;/tselement&gt;=
    3.48 -<br> e.g. =&lt;tselement&gt;&lt;tsname&gt; %<nop>ICON{lock}%&lt;/tsname&gt;&lt;tsstring&gt;%&lt;nop&gt;ICON{lock}%&lt;/tsstring&gt;&lt;/tselement&gt;=
    3.49 -
    3.50 -To add more than one element, you just have to copy from =&lt;tselement&gt;= to =&lt;/tselement&gt;= and to complete each one.
    3.51 -
    3.52 -*Use* : Just open the icon chooser with icon button and click on your image to insert it into the text.
    3.53 -
    3.54 ----+++ Insertion
    3.55 -
    3.56 -*Basic insertion* : Smart Editor provides you some basic tags to insert that are =&lt;nop&gt;=, =&lt;br /&gt;= and =&lt;hr /&gt;=. But it is possible to configure personal strings to insert by editing a simple TWiki variable.
    3.57 -
    3.58 -
    3.59 -*Configuration* : via the TWiki variables SMARTEDITSTRINGSITE,  SMARTEDITSTRINGWEB, SMARTEDITSTRINGUSERS that take a list of XML values of the STRING to insert and its LABEL like 
    3.60 -<br> =&lt;tselement&gt;&lt;tsname&gt; LABEL &lt;/tsname&gt;&lt;tsstring&gt; STRING &lt;/tsstring&gt;&lt;/tselement&gt;=
    3.61 -<br> e.g. =&lt;tselement&gt;&lt;tsname&gt; Today's Date&lt;/tsname&gt;&lt;tsstring&gt; %<nop>GMTIME{$year-$mo-$day}%&lt;/tsstring&gt;&lt;/tselement&gt;=
    3.62 -
    3.63 -Example :
    3.64 -
    3.65 -<verbatim>
    3.66 -Set SMARTEDITSTRINGUSERS = <tselement><tsname>Your menu name </tsname><tsstring>you string to insert </tsstring></tselement>
    3.67 -</verbatim>
    3.68 -
    3.69 -To add more than one element, you just have to copy from =&lt;tselement&gt;= to =&lt;/tselement&gt;= and to complete each one.
    3.70 -
    3.71 ----+++ Search
    3.72 -
    3.73 -Smart Editor also provides you a search toolbar. You just have to type your text and you know automatically if the typed text is found into the textarea.
    3.74 -
    3.75 -Info : When you are entering text into the search text box, a click on the "*return*" key automatically selects the first occurence of your text.
    3.76 -Textarea size
    3.77 -
    3.78 -Smart Editor gives you the ability to increase or decrease the textarea height with these buttons: . You can also set the textarea size to the exact number of lines in your text by clicking on the "Auto fit" button. 
    3.79 -
    3.80 ----+++ Keyboard shortcuts
    3.81 -
    3.82 -	* *TAB* - Indent the current line (no selection needed)
    3.83 -	* *SHIFT+TAB* - Outdent the current line (no selection needed)
    3.84 -	* *RETURN*
    3.85 -		* If there is a list item into the current line, automatically go to the next line and add a new list item with the same indentation
    3.86 -		* If there is a list item into the current line and no text, automatically go to the next line, deleting last empty list item
    3.87 -		* If your the text in the current line is indented, go to the next line with the same indentation
    3.88 -	* *SHIFT+RETURN*
    3.89 -		* Go to the next line, add a br tag with the same indentation 
    3.90 -
    3.91 ----+++ Configure "icon" and "insert string" menus
    3.92 -
    3.93 -These manipulations automatically set the content of menus into the <nop>SmartEditAddOn toolbar.
    3.94 -If the syntax is not respected, the content of the variable will not be loaded.
    3.95 -
    3.96 ----++++ The insert Menu
    3.97 -
    3.98 -From <nop>TWikiPreferences (<nop>TWiki administrator), add or edit this variable like it follows:
    3.99 -
   3.100 -<verbatim>
   3.101 -	* Set SMARTEDITSTRINGSITE = <tselement><tsname>Table of content</tsname><tsstring>%<nop>TOC%</tsstring></tselement><tselement><tsname>your menu name</tsname><tsstring>your string</tsstring></tselement>...
   3.102 -</verbatim>
   3.103 -
   3.104 -From <nop>Web Preferences (<nop>TWiki administrator), add or edit this variable like it follows:
   3.105 -
   3.106 -<verbatim>
   3.107 -	* Set SMARTEDITSTRINGWEB  =   <tselement><tsname>Current web</tsname><tsstring>%<nop>WEB%</tsstring></tselement></tselement><tselement><tsname>your menu name</tsname><tsstring>your string</tsstring></tselement>...
   3.108 -</verbatim>
   3.109 -
   3.110 -From user preferences, every one can add or edit this variable in his personnal page <nop>Main.FirstnameLastname: 
   3.111 -
   3.112 -<verbatim>
   3.113 -	* Set SMARTEDITSTRINGUSERS =  <tselement><tsname>My email</tsname><tsstring>toto@toto.com</tsstring></tselement></tselement><tselement><tsname>your menu name</tsname><tsstring>your string</tsstring></tselement>...
   3.114 -</verbatim>
   3.115 -
   3.116 -The icon menu is set by the TWiki administrators.
     4.1 --- a/data/Foswiki/SmartEditContrib.txt	Mon Apr 13 12:51:06 2009 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,51 +0,0 @@
     4.4 ----+!! SmartEditContrib Contrib Package
     4.5 -
     4.6 -Add short description here of your SmartEditContrib contrib.
     4.7 -
     4.8 -%TOC%
     4.9 -
    4.10 ----++ Summary of Contents
    4.11 -   * 
    4.12 -   * 
    4.13 -
    4.14 ----++ Detailed Documentation
    4.15 -%$POD%
    4.16 -
    4.17 ----++ Settings
    4.18 -
    4.19 -Settings are stored as preferences variables. To reference a setting write ==%<nop>&lt;plugin&gt;_&lt;setting&gt;%==, e.g. ==%<nop>SMARTEDITCONTRIB_STUB%==
    4.20 -
    4.21 -   * One line description:
    4.22 -      * Set SHORTDESCRIPTION = Add short description here of your SmartEditContrib contrib
    4.23 -
    4.24 -   * Name of the perl package
    4.25 -      * Set STUB = %$STUB%
    4.26 -
    4.27 ----++ Installation Instructions
    4.28 -	* Download the ZIP file from the Plugin web (see below)
    4.29 -	* Unzip ==%TOPIC%.zip== in your twiki installation directory. Content:
    4.30 -	| *File:* | *Description:* |
    4.31 -%$MANIFEST%
    4.32 -	* Run ==%TOPIC%_installer.pl== to automatically check and install other modules that this module depends on. You can also do this step manually. Dependencies:
    4.33 -	%$DEPENDENCIES%
    4.34 -
    4.35 -   * Test if the installation was successful:
    4.36 -      * __enter sample here__
    4.37 -      * see also [[Sandbox.PluginTest%TOPIC%]]
    4.38 -
    4.39 ----++ Contrib Info
    4.40 -
    4.41 -|  Author: | TWiki:Main/sven |
    4.42 -|  Copyright &copy;: | <!-- e.g. "2004, SlobSoft Gmbh, All Rights Reserved" --> |
    4.43 -|  License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
    4.44 -|  Dependencies: | %$DEPENDENCIES% |
    4.45 -|  Version: | %$VERSION% |
    4.46 -|  Change History: | <!-- versions below in reverse order -->&nbsp; |
    4.47 -|  %DATE%: | Initial version |
    4.48 -|  Home: | http://foswiki.org/Extensions/%TOPIC% |
    4.49 -|  Feedback: | http://foswiki.org/Extensions/%TOPIC%Dev |
    4.50 -|  Appraisal: | http://foswiki.org/Extensions/%TOPIC%Appraisal |
    4.51 -
    4.52 -__Related Topics:__ %SYSTEMWEB%.DefaultPreferences, %USERSWEB%.SitePreferences
    4.53 -
    4.54 --- TWiki:Main/sven - %DATE%
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/data/System/SmartEditAddOn.txt	Mon Apr 13 21:07:37 2009 +0200
     5.3 @@ -0,0 +1,165 @@
     5.4 +---+!! <nop>Smart Edit Add-On
     5.5 +
     5.6 +Smart Edit is a !JavaScript editor "&agrave; la wikipedia" for TWiki.
     5.7 +
     5.8 +It takes an alternate approach to the WYSIWYG one, as its goals are
     5.9 +   * be useful, even for experienced wiki users
    5.10 +   * predictability: What you see is what will be saved
    5.11 +   * reliability: use only the standard TEXTAREA of the browsers
    5.12 +   * be unobstrusive: as long as you do not use the toolbar, you are still
    5.13 +     using the traditional raw wiki editor
    5.14 +
    5.15 +The aim is to assist TWiki.WikiSyntax editing by providing the following features as !JavaScript code:
    5.16 +
    5.17 +   * TWiki syntax insertion
    5.18 +   * Keyboard shortcuts
    5.19 +   * Configurable menus
    5.20 +   * A dynamic TWiki link selection
    5.21 +   * A search bar
    5.22 +
    5.23 +Smart Edit is a !JavaScript application, working on *Firefox* , *Internet Explorer* and *Mozilla* . The code is clearly sub-optimal, and should be rewritten as it can be too slow on big topics. It is however much faster on firefox, meaning that you will be able to edit comfortably 15k topics with IE and 80k topics on Firefox. However, we use it as our default editor on our intranet.
    5.24 +
    5.25 +*You can see a demo here* : http://twbw-test.luddeni.net/bin/view/Sandbox (<nop>DemoDemo/demo)
    5.26 +
    5.27 +<img src="%ATTACHURLPATH%/screenShotSmartEditor.JPG" alt="screenShotSmartEditor.JPG" width='766' height='67' />
    5.28 +
    5.29 +%TOC%
    5.30 +
    5.31 +---++ Features and user manual
    5.32 +---+++ Styles
    5.33 +
    5.34 +*Supported styles* : Bold, Bold Italic, Italic, Formatted, Verbatim, Blockquote, Heading 1 to 6.
    5.35 +
    5.36 +*How does it work ?*
    5.37 +
    5.38 +When you click on the bold button (for example), Smart Edit gets your selection and inserts the bold tags at the right place. This editor doesn't have a context engine so if you click 2 times on the bold button, you will have 2 bold tags.
    5.39 +
    5.40 +<nop>SmartEditAddOn aumatically detect blanks and line break to insert tags at the right place.
    5.41 +
    5.42 +---+++ Lists
    5.43 +
    5.44 +*List types* : Normal (bullet) and numered.
    5.45 +
    5.46 +*How does it work ?*
    5.47 +
    5.48 +Basically, it works like styles but a minimal context was developped to help you.
    5.49 +
    5.50 +   * A click on the list button add a list item a the beginning of the current line. You do not need to put the cursor at this place or to select the while line.
    5.51 +
    5.52 +   * You just type * and 1 space, then you type your text and when you type on the "return" key, the list item is automatically created.
    5.53 +   * If you are editing a list item and you hit the return key, a new list item will be created with the same indentation in the next line.
    5.54 +   * To indent or outdent a list item, you can just hit the "TAB" key of "SHIFT TAB" like in others editors
    5.55 +   * SHIFT+RETURN creates a br tag on the next line
    5.56 +
    5.57 +---+++ Links
    5.58 +
    5.59 +   * *External links*
    5.60 +      * Smart Edit provides you a simple and intuitive interface to insert a link. You can also watch a preview of the given link.
    5.61 +
    5.62 +   * *Internal links*
    5.63 +      * A dynamic interface help you to select and insert a TWiki link. You just have to select one web in a list, then choose a topic by its name with auto completion assistance.
    5.64 +
    5.65 +---+++ Icons
    5.66 +
    5.67 +*Configuration* via the TWiki variables SMARTEDITICONSITE, SMARTEDITICONWEB, SMARTEDITICONUSER that take a list of XML values of the ICON graphics and its LABEL like 
    5.68 +<br> =&lt;tselement&gt;&lt;tsname&gt; LABEL &lt;/tsname&gt;&lt;tsstring&gt; ICON &lt;/tsstring&gt;&lt;/tselement&gt;=
    5.69 +<br> e.g. =&lt;tselement&gt;&lt;tsname&gt; %<nop>ICON{lock}%&lt;/tsname&gt;&lt;tsstring&gt;%&lt;nop&gt;ICON{lock}%&lt;/tsstring&gt;&lt;/tselement&gt;=
    5.70 +
    5.71 +To add more than one element, you just have to copy from =&lt;tselement&gt;= to =&lt;/tselement&gt;= and to complete each one.
    5.72 +
    5.73 +*Warning*: the ICON and LABEL should only use double quotes ", not simple quotes '. The %<nop>ICON{...}% construct uses double quote, as in =&lt;img src="..."&gt;=, you should not use =&lt;img src='...'&gt;= otherwise smartedit wont run and you will stay in raw edit.
    5.74 +
    5.75 +*Use* : Just open the icon chooser with icon button and click on your image to insert it into the text.
    5.76 +
    5.77 +---+++ Insertion
    5.78 +
    5.79 +*Basic insertion* : Smart Edit provides you some basic tags to insert that are =&lt;nop&gt;=, =&lt;br /&gt;= and =&lt;hr /&gt;=. But it is possible to configure personal strings to insert by editing a simple TWiki variable.
    5.80 +
    5.81 +*Configuration* : via the TWiki variables SMARTEDITSTRINGSITE,  SMARTEDITSTRINGWEB, SMARTEDITSTRINGUSERS that take a list of XML values of the STRING to insert and its LABEL like 
    5.82 +<br> =&lt;tselement&gt;&lt;tsname&gt; LABEL &lt;/tsname&gt;&lt;tsstring&gt; STRING &lt;/tsstring&gt;&lt;/tselement&gt;=
    5.83 +<br> e.g. =&lt;tselement&gt;&lt;tsname&gt; Today's Date&lt;/tsname&gt;&lt;tsstring&gt; %<nop>GMTIME{$year-$mo-$day}%&lt;/tsstring&gt;&lt;/tselement&gt;=
    5.84 +
    5.85 +To add more than one element, you just have to copy from =&lt;tselement&gt;= to =&lt;/tselement&gt;= and to complete each one.
    5.86 +
    5.87 +*Warning*: the ICON and LABEL should only use simple quotes ', not double quotes "
    5.88 +
    5.89 +
    5.90 +---+++ Search
    5.91 +
    5.92 +Smart Edit also provides you a search toolbar. You just have to type your text and you know automatically if the typed text is found into the textarea.
    5.93 +
    5.94 +Info : When you are entering text into the search text box, a click on the "*return*" key automatically selects the first occurence of your text.
    5.95 +Textarea size
    5.96 +
    5.97 +Smart Edit gives you the ability to increase or decrease the textarea height with these buttons: . You can also set the textarea size to the exact number of lines in your text by clicking on the "Auto fit" button. 
    5.98 +
    5.99 +---+++ Keyboard shortcuts
   5.100 +
   5.101 +   * *TAB* - Indent the current line (no selection needed)
   5.102 +   * *SHIFT+TAB* - Outdent the current line (no selection needed)
   5.103 +   * *RETURN*
   5.104 +      * If there is a list item into the current line, automatically go to the next line and add a new list item with the same indentation
   5.105 +      * If there is a list item into the current line and no text, automatically go to the next line, deleting last empty list item
   5.106 +      * If your the text in the current line is indented, go to the next line with the same indentation
   5.107 +   * *SHIFT+RETURN*
   5.108 +      * Go to the next line, add a br tag with the same indentation 
   5.109 +
   5.110 +---++ Add-On Install new release
   5.111 +
   5.112 +When a new release is available, you just have to download the zip file and to unzip it from your foswiki root directory.
   5.113 +
   5.114 +---++ Add-On Installation Instructions on pattern-based skins
   5.115 +   * unzip/untar the plugin at the root level of your foswiki install
   5.116 +   * If you use the default pattern skin, just put in your <nop>Main.TWikiPreferences a
   5.117 +<verbatim>
   5.118 +      * Set SKIN = smarteditor, pattern
   5.119 +</verbatim>
   5.120 +   * Note that it should be compatible with other pattern modifications,
   5.121 +     e.g. =Set SKIN = smarteditor, editdefault, pattern=
   5.122 +   * Add the following declarations to the same <nop>Main.TWikiPreferences topic. You can expand and/or modify these at will
   5.123 +<verbatim>
   5.124 +---++ Smartedit
   5.125 +Warning: only use simple quotes ', not double quotes " in the following 3 vars:
   5.126 +   * Set SMARTEDITSTRINGSITE = <tselement><tsname>Today's Date</tsname><tsstring>%GMTIME{$year-$mo-$day}%</tsstring></tselement><tselement><tsname>User name</tsname><tsstring>%WIKIUSERNAME%</tsstring></tselement><tselement><tsname>Signature</tsname><tsstring>--&nbsp;%WIKIUSERNAME% - %DATE%</tsstring></tselement><tselement><tsname>Comments, signed and dated, added at top</tsname><tsstring>%<nop>COMMENT{type='top'}%</tsstring></tselement><tselement><tsname>Comments, signed and dated, added at end</tsname><tsstring>%<nop>COMMENT{type='bottom'}%</tsstring></tselement><tselement><tsname>Comments, signed and dated, added immediately before</tsname><tsstring>%<nop>COMMENT{type='above'}%</tsstring></tselement><tselement><tsname>Bullet item added immediately before</tsname><tsstring>%<nop>COMMENT{type='bulletabove'}%</tsstring></tselement><tselement><tsname>Wiki thread mode comment, signed and dated</tsname><tsstring>%<nop>COMMENT{type='threadmode'}%</tsstring></tselement><tselement><tsname>Comments, signed and dated, added recurse after comment box</tsname><tsstring>%<nop>COMMENT{type='belowthreadmode'}%</tsstring></tselement><tselement><tsname>Comments, signed and dated, added immediately below</tsname><tsstring>%<nop>COMMENT{type='below'}%</tsstring></tselement><tselement><tsname>Comments, signed and dated, added at top of table below</tsname><tsstring>%<nop>COMMENT{type='tableprepend'}%</tsstring></tselement><tselement><tsname>Comments, signed and dated, added at end of table above</tsname><tsstring>%<nop>COMMENT{type='tableappend'}%</tsstring></tselement><tselement><tsname>Add before the comment box, after the last comment</tsname><tsstring>%<nop>COMMENT{type='after'}%</tsstring></tselement><tselement><tsname>Action of Action Tracker added to action table directly above</tsname><tsstring>%<nop>COMMENT{type='action'}%</tsstring></tselement><tselement><tsname>Tablerows adding on end</tsname><tsstring>%<nop>COMMENT{type='table'}%</tsstring></tselement><tselement><tsname>Talk using TOC adding on end</tsname><tsstring>%<nop>COMMENT{type='toctalk'}%</tsstring></tselement><tselement><tsname>Create a list of annotated bookmarks</tsname><tsstring>%<nop>COMMENT{type='bookmark'}%</tsstring></tselement><tselement><tsname>Post to a different topic and return to here</tsname><tsstring>%<nop>COMMENT{type='return'}%</tsstring></tselement>
   5.127 +   * Set SMARTEDITSTRINGWEB = 
   5.128 +   * Set SMARTEDITSTRINGUSERS =
   5.129 +   
   5.130 +Warning: only use double quotes ", not single quotes ' in the following 3 vars:
   5.131 +   * Set SMARTEDITICONSITE = <tselement><tsname> %ICON{info}%</tsname><tsstring>%<nop>ICON{info}%</tsstring></tselement><tselement><tsname> %ICON{more}%</tsname><tsstring>%<nop>ICON{more}%</tsstring></tselement><tselement><tsname> %ICON{note}%</tsname><tsstring>%<nop>ICON{note}%</tsstring></tselement><tselement><tsname> %ICON{pencil}%</tsname><tsstring>%<nop>ICON{pencil}%</tsstring></tselement><tselement><tsname> %ICON{question}%</tsname><tsstring>%<nop>ICON{question}%</tsstring></tselement><tselement><tsname> %ICON{stargold}%</tsname><tsstring>%<nop>ICON{stargold}%</tsstring></tselement><tselement><tsname> %ICON{starred}%</tsname><tsstring>%<nop>ICON{starred}%</tsstring></tselement><tselement><tsname> %ICON{stop}%</tsname><tsstring>%<nop>ICON{stop}%</tsstring></tselement><tselement><tsname> %ICON{target}%</tsname><tsstring>%<nop>ICON{target}%</tsstring></tselement><tselement><tsname> %ICON{tip}%</tsname><tsstring>%<nop>ICON{tip}%</tsstring></tselement><tselement><tsname> %ICON{warning}%</tsname><tsstring>%<nop>ICON{warning}%</tsstring></tselement><tselement><tsname> %ICON{wip}%</tsname><tsstring>%<nop>ICON{wip}%</tsstring></tselement><tselement><tsname> %ICON{watch}%</tsname><tsstring>%<nop>ICON{watch}%</tsstring></tselement><tselement><tsname> %ICON{wrench}%</tsname><tsstring>%<nop>ICON{wrench}%</tsstring></tselement><tselement><tsname> %ICON{person}%</tsname><tsstring>%<nop>ICON{person}%</tsstring></tselement><tselement><tsname> %ICON{group}%</tsname><tsstring>%<nop>ICON{group}%</tsstring></tselement><tselement><tsname> %ICON{key}%</tsname><tsstring>%<nop>ICON{key}%</tsstring></tselement><tselement><tsname> %ICON{lock}%</tsname><tsstring>%<nop>ICON{lock}%</tsstring></tselement><tselement><tsname> %ICON{new}%</tsname><tsstring>%<nop>ICON{new}%</tsstring></tselement><tselement><tsname> %ICON{todo}%</tsname><tsstring>%<nop>ICON{todo}%</tsstring></tselement><tselement><tsname> %ICON{updated}%</tsname><tsstring>%<nop>ICON{updated}%</tsstring></tselement><tselement><tsname> %ICON{done}%</tsname><tsstring>%<nop>ICON{done}%</tsstring></tselement><tselement><tsname> %ICON{closed}%</tsname><tsstring>%<nop>ICON{closed}%</tsstring></tselement><tselement><tsname> %ICON{choice-yes}%</tsname><tsstring>%<nop>ICON{choice-yes}%</tsstring></tselement><tselement><tsname> %ICON{choice-no}%</tsname><tsstring>%<nop>ICON{choice-no}%</tsstring></tselement><tselement><tsname> %ICON{choice-cancel}%</tsname><tsstring>%<nop>ICON{choice-cancel}%</tsstring></tselement><tselement><tsname> %ICON{minus}%</tsname><tsstring>%<nop>ICON{minus}%</tsstring></tselement><tselement><tsname> %ICON{plus}%</tsname><tsstring>%<nop>ICON{plus}%</tsstring></tselement><tselement><tsname> %ICON{home}%</tsname><tsstring>%<nop>ICON{home}%</tsstring></tselement><tselement><tsname> %ICON{left}%</tsname><tsstring>%<nop>ICON{left}%</tsstring></tselement><tselement><tsname> %ICON{right}%</tsname><tsstring>%<nop>ICON{right}%</tsstring></tselement><tselement><tsname> %ICON{up}%</tsname><tsstring>%<nop>ICON{up}%</tsstring></tselement><tselement><tsname> %ICON{down}%</tsname><tsstring>%<nop>ICON{down}%</tsstring></tselement>
   5.132 +   * Set SMARTEDITICONWEB =
   5.133 +   * Set SMARTEDITICONUSER =
   5.134 +
   5.135 +
   5.136 +</verbatim>
   5.137 +
   5.138 +---++ Adaptation to non-pattern based skins
   5.139 +You will have to adapt your skin for it. the principles are detailed in the =README-SmartEditAddOn.txt= in the distrib
   5.140 +
   5.141 +---++ Add-On Info
   5.142 +
   5.143 +   * Set SHORTDESCRIPTION = Toolbar to help edit TWiki content
   5.144 +
   5.145 +|  Add-on Author: | TWiki:Main/GaelCrova (Special thanks to TWiki:Main/ColasNahaboo and TWiki:Main/FredericLuddeni for their help and feedback)|
   5.146 +|  Add-on Version: | 23 Jan 2008 (v2) |
   5.147 +|  Change History: | <!-- versions below in reverse order -->&nbsp; |
   5.148 +| 23 Jan 2008: | v2: Version for TWiki Freetown, 4.2.0 |
   5.149 +|  18 Aug 2006: | IE Toolbar width fixed |
   5.150 +|  16 Aug 2006: | Tab and SHIFT-TAB events disabled in Opera - Help in a specific topic with the viewprint template |
   5.151 +|  16 Aug 2006: | Blanks in external links fixed |
   5.152 +|  10 Aug 2006: | solved display bug for insert internal link |
   5.153 +|  09 Aug 2006: | solved some bugs on TWiki 4.0.2 |
   5.154 +|  09 Aug 2006: | Removed some debug information |
   5.155 +|  08 Aug 2006: | HTML Tags corrected |
   5.156 +|  08 Aug 2006: | IE display fixed - wiki link bugs fixed |
   5.157 +|  07 Aug 2006: | Initial version |
   5.158 +|  CPAN Dependencies: | none |
   5.159 +|  Other Dependencies: | none |
   5.160 +|  Perl Version: | 5.005 |
   5.161 +|  License: | GPL |
   5.162 +|  Add-on Home: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC% |
   5.163 +|  Feedback: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Dev |
   5.164 +|  Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Appraisal |
   5.165 +
   5.166 +__Related Topic:__ %TWIKIWEB%.TWikiAddOns
   5.167 +
   5.168 +-- TWiki:Main/GaelCrova - 07 Aug 2006
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/data/System/SmartEditAddOnHelp.txt	Mon Apr 13 21:07:37 2009 +0200
     6.3 @@ -0,0 +1,113 @@
     6.4 +%META:TOPICINFO{author="GaelCrova" date="1155721530" format="1.1" version="1.1"}%
     6.5 +%META:TOPICPARENT{name="SmartEditAddOn"}%
     6.6 +---++!! !Smartedit v2 Features and user manual
     6.7 +%STARTINCLUDE%
     6.8 +%INCLUDE{"SmartEditAddOnLocal" warn="off"}%
     6.9 +%TOC%
    6.10 +
    6.11 +---+++ Styles
    6.12 +
    6.13 +*Supported styles* : Bold, Bold Italic, Italic, Formatted, Verbatim, Blockquote, Heading 1 to 6.
    6.14 +
    6.15 +*How does it work ?*
    6.16 +
    6.17 +When you click on the bold button (for example), Smart Editor get your selection and insert the bold tags at the right place. This editor doesn't have a context engine so if you click 2 times on the bold button, you will have 2 bold tags.
    6.18 +
    6.19 +<nop>SmartEditAddOn aumatically detect blanks and line break to insert tags at the right place.
    6.20 +
    6.21 +---+++ Lists
    6.22 +
    6.23 +*List types* : Normal (bullet) and numered.
    6.24 +
    6.25 +*How does it work ?*
    6.26 +
    6.27 +Basically, it works like styles but a minimal context was developped to help you.
    6.28 +
    6.29 +	* A click on the list button add a list item a the beginning of the current line. You do not need to put the cursor at this place or to select the while line.
    6.30 +
    6.31 +	* You just type * and 1 space, then you type your text and when you type on the "return" key, the list item is automatically created.
    6.32 +	* If you are editing a list item and you hit the return key, a new list item will be created with the same indentation in the next line.
    6.33 +	* To indent or outdent a list item, you can just hit the "TAB" key of "SHIFT TAB" like in others editors
    6.34 +	* SHIFT+RETURN creates a br tag on the next line
    6.35 +
    6.36 +---+++ Links
    6.37 +
    6.38 +	* *External links*
    6.39 +		* Smart Editor provides you a simple and intuitive interface to insert a link. You can also watch a preview of the given link.
    6.40 +
    6.41 +	* *Internal links*
    6.42 +		* A dynamic interface help you to select and insert a TWiki link. You just have to select one web in a list, then choose a topic by its name with auto completion assistance.
    6.43 +
    6.44 +---+++ Icons
    6.45 +
    6.46 +*Configuration* via the TWiki variables SMARTEDITICONSITE, SMARTEDITICONWEB, SMARTEDITICONUSER that take a list of XML values of the ICON graphics and its LABEL like 
    6.47 +<br> =&lt;tselement&gt;&lt;tsname&gt; LABEL &lt;/tsname&gt;&lt;tsstring&gt; ICON &lt;/tsstring&gt;&lt;/tselement&gt;=
    6.48 +<br> e.g. =&lt;tselement&gt;&lt;tsname&gt; %<nop>ICON{lock}%&lt;/tsname&gt;&lt;tsstring&gt;%&lt;nop&gt;ICON{lock}%&lt;/tsstring&gt;&lt;/tselement&gt;=
    6.49 +
    6.50 +To add more than one element, you just have to copy from =&lt;tselement&gt;= to =&lt;/tselement&gt;= and to complete each one.
    6.51 +
    6.52 +*Use* : Just open the icon chooser with icon button and click on your image to insert it into the text.
    6.53 +
    6.54 +---+++ Insertion
    6.55 +
    6.56 +*Basic insertion* : Smart Editor provides you some basic tags to insert that are =&lt;nop&gt;=, =&lt;br /&gt;= and =&lt;hr /&gt;=. But it is possible to configure personal strings to insert by editing a simple TWiki variable.
    6.57 +
    6.58 +
    6.59 +*Configuration* : via the TWiki variables SMARTEDITSTRINGSITE,  SMARTEDITSTRINGWEB, SMARTEDITSTRINGUSERS that take a list of XML values of the STRING to insert and its LABEL like 
    6.60 +<br> =&lt;tselement&gt;&lt;tsname&gt; LABEL &lt;/tsname&gt;&lt;tsstring&gt; STRING &lt;/tsstring&gt;&lt;/tselement&gt;=
    6.61 +<br> e.g. =&lt;tselement&gt;&lt;tsname&gt; Today's Date&lt;/tsname&gt;&lt;tsstring&gt; %<nop>GMTIME{$year-$mo-$day}%&lt;/tsstring&gt;&lt;/tselement&gt;=
    6.62 +
    6.63 +Example :
    6.64 +
    6.65 +<verbatim>
    6.66 +Set SMARTEDITSTRINGUSERS = <tselement><tsname>Your menu name </tsname><tsstring>you string to insert </tsstring></tselement>
    6.67 +</verbatim>
    6.68 +
    6.69 +To add more than one element, you just have to copy from =&lt;tselement&gt;= to =&lt;/tselement&gt;= and to complete each one.
    6.70 +
    6.71 +---+++ Search
    6.72 +
    6.73 +Smart Editor also provides you a search toolbar. You just have to type your text and you know automatically if the typed text is found into the textarea.
    6.74 +
    6.75 +Info : When you are entering text into the search text box, a click on the "*return*" key automatically selects the first occurence of your text.
    6.76 +Textarea size
    6.77 +
    6.78 +Smart Editor gives you the ability to increase or decrease the textarea height with these buttons: . You can also set the textarea size to the exact number of lines in your text by clicking on the "Auto fit" button. 
    6.79 +
    6.80 +---+++ Keyboard shortcuts
    6.81 +
    6.82 +	* *TAB* - Indent the current line (no selection needed)
    6.83 +	* *SHIFT+TAB* - Outdent the current line (no selection needed)
    6.84 +	* *RETURN*
    6.85 +		* If there is a list item into the current line, automatically go to the next line and add a new list item with the same indentation
    6.86 +		* If there is a list item into the current line and no text, automatically go to the next line, deleting last empty list item
    6.87 +		* If your the text in the current line is indented, go to the next line with the same indentation
    6.88 +	* *SHIFT+RETURN*
    6.89 +		* Go to the next line, add a br tag with the same indentation 
    6.90 +
    6.91 +---+++ Configure "icon" and "insert string" menus
    6.92 +
    6.93 +These manipulations automatically set the content of menus into the <nop>SmartEditAddOn toolbar.
    6.94 +If the syntax is not respected, the content of the variable will not be loaded.
    6.95 +
    6.96 +---++++ The insert Menu
    6.97 +
    6.98 +From <nop>TWikiPreferences (<nop>TWiki administrator), add or edit this variable like it follows:
    6.99 +
   6.100 +<verbatim>
   6.101 +	* Set SMARTEDITSTRINGSITE = <tselement><tsname>Table of content</tsname><tsstring>%<nop>TOC%</tsstring></tselement><tselement><tsname>your menu name</tsname><tsstring>your string</tsstring></tselement>...
   6.102 +</verbatim>
   6.103 +
   6.104 +From <nop>Web Preferences (<nop>TWiki administrator), add or edit this variable like it follows:
   6.105 +
   6.106 +<verbatim>
   6.107 +	* Set SMARTEDITSTRINGWEB  =   <tselement><tsname>Current web</tsname><tsstring>%<nop>WEB%</tsstring></tselement></tselement><tselement><tsname>your menu name</tsname><tsstring>your string</tsstring></tselement>...
   6.108 +</verbatim>
   6.109 +
   6.110 +From user preferences, every one can add or edit this variable in his personnal page <nop>Main.FirstnameLastname: 
   6.111 +
   6.112 +<verbatim>
   6.113 +	* Set SMARTEDITSTRINGUSERS =  <tselement><tsname>My email</tsname><tsstring>toto@toto.com</tsstring></tselement></tselement><tselement><tsname>your menu name</tsname><tsstring>your string</tsstring></tselement>...
   6.114 +</verbatim>
   6.115 +
   6.116 +The icon menu is set by the TWiki administrators.
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/data/System/SmartEditContrib.txt	Mon Apr 13 21:07:37 2009 +0200
     7.3 @@ -0,0 +1,51 @@
     7.4 +---+!! SmartEditContrib Contrib Package
     7.5 +
     7.6 +Add short description here of your SmartEditContrib contrib.
     7.7 +
     7.8 +%TOC%
     7.9 +
    7.10 +---++ Summary of Contents
    7.11 +   * 
    7.12 +   * 
    7.13 +
    7.14 +---++ Detailed Documentation
    7.15 +%$POD%
    7.16 +
    7.17 +---++ Settings
    7.18 +
    7.19 +Settings are stored as preferences variables. To reference a setting write ==%<nop>&lt;plugin&gt;_&lt;setting&gt;%==, e.g. ==%<nop>SMARTEDITCONTRIB_STUB%==
    7.20 +
    7.21 +   * One line description:
    7.22 +      * Set SHORTDESCRIPTION = Add short description here of your SmartEditContrib contrib
    7.23 +
    7.24 +   * Name of the perl package
    7.25 +      * Set STUB = %$STUB%
    7.26 +
    7.27 +---++ Installation Instructions
    7.28 +	* Download the ZIP file from the Plugin web (see below)
    7.29 +	* Unzip ==%TOPIC%.zip== in your wiki installation directory. Content:
    7.30 +	| *File:* | *Description:* |
    7.31 +%$MANIFEST%
    7.32 +	* Run ==%TOPIC%_installer.pl== to automatically check and install other modules that this module depends on. You can also do this step manually. Dependencies:
    7.33 +	%$DEPENDENCIES%
    7.34 +
    7.35 +   * Test if the installation was successful:
    7.36 +      * __enter sample here__
    7.37 +      * see also [[Sandbox.PluginTest%TOPIC%]]
    7.38 +
    7.39 +---++ Contrib Info
    7.40 +
    7.41 +|  Author: | TWiki:Main/sven |
    7.42 +|  Copyright &copy;: | <!-- e.g. "2004, SlobSoft Gmbh, All Rights Reserved" --> |
    7.43 +|  License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
    7.44 +|  Dependencies: | %$DEPENDENCIES% |
    7.45 +|  Version: | %$VERSION% |
    7.46 +|  Change History: | <!-- versions below in reverse order -->&nbsp; |
    7.47 +|  %DATE%: | Initial version |
    7.48 +|  Home: | http://foswiki.org/Extensions/%TOPIC% |
    7.49 +|  Feedback: | http://foswiki.org/Extensions/%TOPIC%Dev |
    7.50 +|  Appraisal: | http://foswiki.org/Extensions/%TOPIC%Appraisal |
    7.51 +
    7.52 +__Related Topics:__ %SYSTEMWEB%.DefaultPreferences, %USERSWEB%.SitePreferences
    7.53 +
    7.54 +-- TWiki:Main/sven - %DATE%
     8.1 Binary file pub/Foswiki/SmartEditAddOn/adjust.gif has changed
     9.1 Binary file pub/Foswiki/SmartEditAddOn/background-leftimg.gif has changed
    10.1 Binary file pub/Foswiki/SmartEditAddOn/background-toolbar.gif has changed
    11.1 Binary file pub/Foswiki/SmartEditAddOn/background-toolbar.png has changed
    12.1 Binary file pub/Foswiki/SmartEditAddOn/bg_ie.gif has changed
    13.1 Binary file pub/Foswiki/SmartEditAddOn/bgbottom.gif has changed
    14.1 Binary file pub/Foswiki/SmartEditAddOn/blockquote.gif has changed
    15.1 Binary file pub/Foswiki/SmartEditAddOn/bold.gif has changed
    16.1 Binary file pub/Foswiki/SmartEditAddOn/boldItalic.gif has changed
    17.1 Binary file pub/Foswiki/SmartEditAddOn/br.gif has changed
    18.1 Binary file pub/Foswiki/SmartEditAddOn/bullist.gif has changed
    19.1 Binary file pub/Foswiki/SmartEditAddOn/close.gif has changed
    20.1 Binary file pub/Foswiki/SmartEditAddOn/code.png has changed
    21.1 Binary file pub/Foswiki/SmartEditAddOn/down.jpg has changed
    22.1 Binary file pub/Foswiki/SmartEditAddOn/down2.jpg has changed
    23.1 Binary file pub/Foswiki/SmartEditAddOn/expand.gif has changed
    24.1 Binary file pub/Foswiki/SmartEditAddOn/exthyperlink.png has changed
    25.1 Binary file pub/Foswiki/SmartEditAddOn/forecolor.gif has changed
    26.1 Binary file pub/Foswiki/SmartEditAddOn/forecolorold.gif has changed
    27.1 Binary file pub/Foswiki/SmartEditAddOn/g040.gif has changed
    28.1 Binary file pub/Foswiki/SmartEditAddOn/g080.gif has changed
    29.1 Binary file pub/Foswiki/SmartEditAddOn/h1.gif has changed
    30.1 Binary file pub/Foswiki/SmartEditAddOn/h2.gif has changed
    31.1 Binary file pub/Foswiki/SmartEditAddOn/h3.gif has changed
    32.1 Binary file pub/Foswiki/SmartEditAddOn/h4.gif has changed
    33.1 Binary file pub/Foswiki/SmartEditAddOn/h5.gif has changed
    34.1 Binary file pub/Foswiki/SmartEditAddOn/h6.gif has changed
    35.1 Binary file pub/Foswiki/SmartEditAddOn/help.gif has changed
    36.1 Binary file pub/Foswiki/SmartEditAddOn/hr.gif has changed
    37.1 --- a/pub/Foswiki/SmartEditAddOn/includesmartedit.js	Mon Apr 13 12:51:06 2009 +0200
    37.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.3 @@ -1,3 +0,0 @@
    37.4 -function twikismartEdit(variable){
    37.5 -	variable = "topic";
    37.6 -}
    37.7 \ No newline at end of file
    38.1 --- a/pub/Foswiki/SmartEditAddOn/includesmartediton.js	Mon Apr 13 12:51:06 2009 +0200
    38.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.3 @@ -1,17 +0,0 @@
    38.4 -function include_dom(script_filename) {
    38.5 -    var html_doc = document.getElementsByTagName('head').item(0);
    38.6 -    var js = document.createElement('script');
    38.7 -    js.setAttribute('language', 'javascript');
    38.8 -    js.setAttribute('type', 'text/javascript');
    38.9 -    js.setAttribute('src', script_filename);
   38.10 -    html_doc.appendChild(js);
   38.11 -    return false;
   38.12 -}
   38.13 -include_dom(twikismartScriptURL+"mochikit/lib/MochiKit/MochiKit.js");
   38.14 -include_dom(twikismartScriptURL+"wikismartEngine.js");
   38.15 -include_dom(twikismartScriptURL+"wikismartActions.js");
   38.16 -include_dom(twikismartScriptURL+"smartEditUI.js");
   38.17 -include_dom(twikismartScriptURL+"wikismartEvents.js");
   38.18 -include_dom(twikismartScriptURL+"smartEditAutoCompletion.js");
   38.19 -include_dom(twikismartScriptURL+"smartEditDynamicDivision.js");
   38.20 -
    39.1 Binary file pub/Foswiki/SmartEditAddOn/indent.gif has changed
    40.1 Binary file pub/Foswiki/SmartEditAddOn/info.gif has changed
    41.1 Binary file pub/Foswiki/SmartEditAddOn/italic.gif has changed
    42.1 Binary file pub/Foswiki/SmartEditAddOn/left.jpg has changed
    43.1 Binary file pub/Foswiki/SmartEditAddOn/line.gif has changed
    44.1 Binary file pub/Foswiki/SmartEditAddOn/loupe.gif has changed
    45.1 --- a/pub/Foswiki/SmartEditAddOn/mochikit/Changes	Mon Apr 13 12:51:06 2009 +0200
    45.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.3 @@ -1,244 +0,0 @@
    45.4 -2006-04-29      v1.3.1 (bug fix release)
    45.5 -
    45.6 -- Fix sendXMLHttpRequest sendContent regression
    45.7 -- Internet Explorer fix in MochiKit.Logging (printfire exception)
    45.8 -- Internet Explorer XMLHttpRequest object leak fixed in MochiKit.Async
    45.9 -
   45.10 -2006-04-26      v1.3 "warp zone"
   45.11 -
   45.12 -- IMPORTANT: Renamed MochiKit.Base.forward to forwardCall (for export)
   45.13 -- IMPORTANT: Renamed MochiKit.Base.find to findValue (for export)
   45.14 -- New MochiKit.Base.method as a convenience form of bind that takes the
   45.15 -  object before the method
   45.16 -- New MochiKit.Base.flattenArguments for flattening a list of arguments to
   45.17 -  a single Array
   45.18 -- Refactored MochiRegExp example to use MochiKit.Signal
   45.19 -- New key_events example demonstrating use of MochiKit.Signal's key handling
   45.20 -  capabilities.
   45.21 -- MochiKit.DOM.createDOM API change for convenience: if attrs is a string,
   45.22 -  null is used and the string will be considered the first node. This
   45.23 -  allows for the more natural P("foo") rather than P(null, "foo").
   45.24 -- MochiKit Interpreter example refactored to use MochiKit.Signal and now
   45.25 -  provides multi-line input and a help() function to get MochiKit function
   45.26 -  signature from the documentation.
   45.27 -- Native Console Logging for the default MochiKit.Logging logger
   45.28 -- New MochiKit.Async.DeferredList, gatherResults, maybeDeferred
   45.29 -- New MochiKit.Signal example: draggable
   45.30 -- Added sanity checking to Deferred to ensure that errors happen when chaining
   45.31 -  is used incorrectly
   45.32 -- Opera sendXMLHttpRequest fix (sends empty string instead of null by default)
   45.33 -- Fix a bug in MochiKit.Color that incorrectly generated hex colors for
   45.34 -  component values smaller than 16/255.
   45.35 -- Fix a bug in MochiKit.Logging that prevented logs from being capped at a
   45.36 -  maximum size
   45.37 -- MochiKit.Async.Deferred will now wrap thrown objects that are not instanceof
   45.38 -  Error, so that the errback chain is used instead of the callback chain.
   45.39 -- MochiKit.DOM.appendChildNodes and associated functions now append iterables
   45.40 -  in the correct order.
   45.41 -- New MochiKit-based SimpleTest test runner as a replacement for Test.Simple
   45.42 -- MochiKit.Base.isNull no longer matches undefined
   45.43 -- example doctypes changed to HTML4
   45.44 -- isDateLike no longer throws error on null
   45.45 -- New MochiKit.Signal module, modeled after the slot/signal mechanism in Qt
   45.46 -- updated elementDimensions to calculate width from offsetWidth instead
   45.47 -  of clientWidth 
   45.48 -- formContents now works with FORM tags that have a name attribute
   45.49 -- Documentation now uses MochiKit to generate a function index
   45.50 -
   45.51 -2006-01-26      v1.2 "the ocho"
   45.52 -
   45.53 -- Fixed MochiKit.Color.Color.lighterColorWithLevel
   45.54 -- Added new MochiKit.Base.findIdentical function to find the index of an
   45.55 -  element in an Array-like object. Uses === for identity comparison.
   45.56 -- Added new MochiKit.Base.find function to find the index of an element in
   45.57 -  an Array-like object. Uses compare for rich comparison.
   45.58 -- MochiKit.Base.bind will accept a string for func, which will be immediately
   45.59 -  looked up as self[func].
   45.60 -- MochiKit.DOM.formContents no longer skips empty form elements for Zope
   45.61 -  compatibility
   45.62 -- MochiKit.Iter.forEach will now catch StopIteration to break
   45.63 -- New MochiKit.DOM.elementDimensions(element) for determining the width and
   45.64 -  height of an element in the document
   45.65 -- MochiKit.DOM's initialization is now compatible with
   45.66 -  HTMLUnit + JWebUnit + Rhino
   45.67 -- MochiKit.LoggingPane will now re-use a ``_MochiKit_LoggingPane`` DIV element
   45.68 -  currently in the document instead of always creating one.
   45.69 -- MochiKit.Base now has operator.mul
   45.70 -- MochiKit.DOM.formContents correctly handles unchecked checkboxes that have
   45.71 -  a custom value attribute
   45.72 -- Added new MochiKit.Color constructors fromComputedStyle and fromText
   45.73 -- MochiKit.DOM.setNodeAttribute should work now
   45.74 -- MochiKit.DOM now has a workaround for an IE bug when setting the style
   45.75 -  property to a string
   45.76 -- MochiKit.DOM.createDOM now has workarounds for IE bugs when setting the
   45.77 -  name and for properties
   45.78 -- MochiKit.DOM.scrapeText now walks the DOM tree in-order
   45.79 -- MochiKit.LoggingPane now sanitizes the window name to work around IE bug
   45.80 -- MochiKit.DOM now translates usemap to useMap to work around IE bug
   45.81 -- MochiKit.Logging is now resistant to Prototype's dumb Object.prototype hacks
   45.82 -- Added new MochiKit.DOM documentation on element visibility
   45.83 -- New MochiKit.DOM.elementPosition(element[, relativeTo={x: 0, y: 0}])
   45.84 -  for determining the position of an element in the document
   45.85 -- Added new MochiKit.DOM createDOMFunc aliases: CANVAS, STRONG
   45.86 -
   45.87 -2005-11-14      v1.1
   45.88 -
   45.89 -- Fixed a bug in numberFormatter with large numbers
   45.90 -- Massively overhauled documentation
   45.91 -- Fast-path for primitives in MochiKit.Base.compare
   45.92 -- New groupby and groupby_as_array in MochiKit.Iter
   45.93 -- Added iterator factory adapter for objects that implement iterateNext()
   45.94 -- Fixed isoTimestamp to handle timestamps with time zone correctly
   45.95 -- Added new MochiKit.DOM createDOMFunc aliases: SELECT, OPTION, OPTGROUP, 
   45.96 -  LEGEND, FIELDSET
   45.97 -- New MochiKit.DOM formContents and enhancement to queryString to support it
   45.98 -- Updated view_source example to use dp.SyntaxHighlighter 1.3.0
   45.99 -- MochiKit.LoggingPane now uses named windows based on the URL so that
  45.100 -  a given URL will get the same LoggingPane window after a reload
  45.101 -  (at the same position, etc.)
  45.102 -- MochiKit.DOM now has currentWindow() and currentDocument() context
  45.103 -  variables that are set with withWindow() and withDocument(). These
  45.104 -  context variables affect all MochiKit.DOM functionality (getElement,
  45.105 -  createDOM, etc.)
  45.106 -- MochiKit.Base.items will now catch and ignore exceptions for properties
  45.107 -  that are enumerable but not accessible (e.g. permission denied)
  45.108 -- MochiKit.Async.Deferred's addCallback/addErrback/addBoth
  45.109 -  now accept additional arguments that are used to create a partially
  45.110 -  applied function. This differs from Twisted in that the callback/errback
  45.111 -  result becomes the *last* argument, not the first when this feature
  45.112 -  is used.
  45.113 -- MochiKit.Async's doSimpleXMLHttpRequest will now accept additional
  45.114 -  arguments which are used to create a GET query string
  45.115 -- Did some refactoring to reduce the footprint of MochiKit by a few
  45.116 -  kilobytes
  45.117 -- escapeHTML to longer escapes ' (apos) and now uses
  45.118 -  String.replace instead of iterating over every char.
  45.119 -- Added DeferredLock to Async
  45.120 -- Renamed getElementsComputedStyle to computedStyle and moved
  45.121 -  it from MochiKit.Visual to MochiKit.DOM
  45.122 -- Moved all color support out of MochiKit.Visual and into MochiKit.Color
  45.123 -- Fixed range() to accept a negative step
  45.124 -- New alias to MochiKit.swapDOM called removeElement
  45.125 -- New MochiKit.DOM.setNodeAttribute(node, attr, value) which sets
  45.126 -  an attribute on a node without raising, roughly equivalent to:
  45.127 -  updateNodeAttributes(node, {attr: value})
  45.128 -- New MochiKit.DOM.getNodeAttribute(node, attr) which gets the value of
  45.129 -  a node's attribute or returns null without raising
  45.130 -- Fixed a potential IE memory leak if using MochiKit.DOM.addToCallStack
  45.131 -  directly (addLoadEvent did not leak, since it clears the handler)
  45.132 -
  45.133 -2005-10-24      v1.0
  45.134 -
  45.135 -- New interpreter example that shows usage of MochiKit.DOM  to make
  45.136 -  an interactive JavaScript interpreter
  45.137 -- New MochiKit.LoggingPane for use with the MochiKit.Logging
  45.138 -  debuggingBookmarklet, with logging_pane example to show its usage
  45.139 -- New mochiregexp example that demonstrates MochiKit.DOM and MochiKit.Async
  45.140 -  in order to provide a live regular expression matching tool
  45.141 -- Added advanced number formatting capabilities to MochiKit.Format:
  45.142 -  numberFormatter(pattern, placeholder="", locale="default") and
  45.143 -  formatLocale(locale="default")
  45.144 -- Added updatetree(self, obj[, ...]) to MochiKit.Base, and changed
  45.145 -  MochiKit.DOM's updateNodeAttributes(node, attrs) to use it when appropiate.
  45.146 -- Added new MochiKit.DOM createDOMFunc aliases: BUTTON, TT, PRE
  45.147 -- Added truncToFixed(aNumber, precision) and roundToFixed(aNumber, precision)
  45.148 -  to MochiKit.Format
  45.149 -- MochiKit.DateTime can now handle full ISO 8601 timestamps, specifically
  45.150 -  isoTimestamp(isoString) will convert them to Date objects, and
  45.151 -  toISOTimestamp(date, true) will return an ISO 8601 timestamp in UTC
  45.152 -- Fixed missing errback for sendXMLHttpRequest when the server does not
  45.153 -  respond
  45.154 -- Fixed infinite recusion bug when using roundClass("DIV", ...)
  45.155 -- Fixed a bug in MochiKit.Async wait (and callLater) that prevented them
  45.156 -  from being cancelled properly
  45.157 -- Workaround in MochiKit.Base bind (and partial) for functions that don't
  45.158 -  have an apply method, such as alert
  45.159 -- Reliably return null from the string parsing/manipulation functions if
  45.160 -  the input can't be coerced to a string (s + "") or the input makes no sense;
  45.161 -  e.g. isoTimestamp(null) and isoTimestamp("") return null
  45.162 -
  45.163 -2005-10-08      v0.90
  45.164 -
  45.165 -- Fixed ISO compliance with toISODate
  45.166 -- Added missing operator.sub
  45.167 -- Placated Mozilla's strict warnings a bit
  45.168 -- Added JSON serialization and unserialization support to MochiKit.Base:
  45.169 -  serializeJSON, evalJSON, registerJSON. This is very similar to the repr
  45.170 -  API.
  45.171 -- Fixed a bug in the script loader that failed in some scenarios when a script
  45.172 -  tag did not have a "src" attribute (thanks Ian!)
  45.173 -- Added new MochiKit.DOM createDOMFunc aliases: H1, H2, H3, BR, HR, TEXTAREA,
  45.174 -  P, FORM
  45.175 -- Use encodeURIComponent / decodeURIComponent for MochiKit.Base urlEncode
  45.176 -  and parseQueryString, when available.
  45.177 -
  45.178 -2005-08-12      v0.80
  45.179 -
  45.180 -- Source highlighting in all examples, moved to a view-source example
  45.181 -- Added some experimental syntax highlighting for the Rounded Corners example,
  45.182 -  via the LGPL dp.SyntaxHighlighter 1.2.0 now included in examples/common/lib
  45.183 -- Use an indirect binding for the logger conveniences, so that the global
  45.184 -  logger could be replaced by setting MochiKit.Logger.logger to something else
  45.185 -  (though an observer is probably a better choice).
  45.186 -- Allow MochiKit.DOM.getElementsByTagAndClassName to take a string for parent,
  45.187 -  which will be looked up with getElement
  45.188 -- Fixed bug in MochiKit.Color.fromBackground (was using node.parent instead of
  45.189 -  node.parentNode)
  45.190 -- Consider a 304 (NOT_MODIFIED) response from XMLHttpRequest to be success
  45.191 -- Disabled Mozilla map(...) fast-path due to Deer Park compatibility issues
  45.192 -- Possible workaround for Safari issue with swapDOM, where it would get
  45.193 -  confused because two elements were in the DOM at the same time with the
  45.194 -  same id
  45.195 -- Added missing THEAD convenience function to MochiKit.DOM
  45.196 -- Added lstrip, rstrip, strip to MochiKit.Format
  45.197 -- Added updateNodeAttributes, appendChildNodes, replaceChildNodes to
  45.198 -  MochiKit.DOM
  45.199 -- MochiKit.Iter.iextend now has a fast-path for array-like objects
  45.200 -- Added HSV color space support to MochiKit.Visual
  45.201 -- Fixed a bug in the sortable_tables example, it now converts types
  45.202 -  correctly
  45.203 -- Fixed a bug where MochiKit.DOM referenced MochiKit.Iter.next from global
  45.204 -  scope
  45.205 -
  45.206 -2005-08-04      v0.70
  45.207 -
  45.208 -- New ajax_tables example, which shows off XMLHttpRequest, ajax, json, and
  45.209 -  a little TAL-ish DOM templating attribute language.
  45.210 -- sendXMLHttpRequest and functions that use it (loadJSONDoc, etc.) no longer
  45.211 -  ignore requests with status == 0, which seems to happen for cached or local
  45.212 -  requests
  45.213 -- Added sendXMLHttpRequest to MochiKit.Async.EXPORT, d'oh.
  45.214 -- Changed scrapeText API to return a string by default. This is API-breaking!
  45.215 -  It was dumb to have the default return value be the form you almost never
  45.216 -  want. Sorry.
  45.217 -- Added special form to swapDOM(dest, src). If src is null, dest is removed
  45.218 -  (where previously you'd likely get a DOM exception).
  45.219 -- Added three new functions to MochiKit.Base for dealing with URL query
  45.220 -  strings: urlEncode, queryString, parseQueryString
  45.221 -- MochiKit.DOM.createDOM will now use attr[k] = v for all browsers if the name
  45.222 -  starts with "on" (e.g. "onclick"). If v is a string, it will set it to
  45.223 -  new Function(v).
  45.224 -- Another workaround for Internet "worst browser ever" Explorer's setAttribute
  45.225 -  usage in MochiKit.DOM.createDOM (checked -> defaultChecked).
  45.226 -- Added UL, OL, LI convenience createDOM aliases to MochiKit.DOM
  45.227 -- Packing is now done by Dojo's custom Rhino interpreter, so it's much smaller
  45.228 -  now!
  45.229 -
  45.230 -2005-07-29      v0.60
  45.231 -
  45.232 -- Beefed up the MochiKit.DOM test suite
  45.233 -- Fixed return value for MochiKit.DOM.swapElementClass, could return
  45.234 -  false unexpectedly before
  45.235 -- Added an optional "parent" argument to
  45.236 -  MochiKit.DOM.getElementsByTagAndClassName
  45.237 -- Added a "packed" version in packed/MochiKit/MochiKit.js
  45.238 -- Changed build script to rewrite the URLs in tests to account for the
  45.239 -  JSAN-required reorganization
  45.240 -- MochiKit.Compat to potentially work around IE 5.5 issues
  45.241 -  (5.0 still not supported). Test.Simple doesn't seem to work there,
  45.242 -  though.
  45.243 -- Several minor documentation corrections
  45.244 -
  45.245 -2005-07-27      v0.50
  45.246 -
  45.247 -- Initial Release
    46.1 --- a/pub/Foswiki/SmartEditAddOn/mochikit/LICENSE.txt	Mon Apr 13 12:51:06 2009 +0200
    46.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.3 @@ -1,69 +0,0 @@
    46.4 -MochiKit is dual-licensed software.  It is available under the terms of the
    46.5 -MIT License, or the Academic Free License version 2.1.  The full text of
    46.6 -each license is included below.
    46.7 -
    46.8 -MIT License
    46.9 -===========
   46.10 -
   46.11 -Copyright (c) 2005 Bob Ippolito.  All rights reserved.
   46.12 -
   46.13 -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
   46.14 -
   46.15 -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
   46.16 -
   46.17 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   46.18 -
   46.19 -
   46.20 -Academic Free License v. 2.1
   46.21 -============================
   46.22 -
   46.23 -Copyright (c) 2005 Bob Ippolito.  All rights reserved.
   46.24 -
   46.25 -This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following notice immediately following the copyright notice for the Original Work:
   46.26 -
   46.27 -Licensed under the Academic Free License version 2.1
   46.28 -
   46.29 -1) Grant of Copyright License. Licensor hereby grants You a world-wide, royalty-free, non-exclusive, perpetual, sublicenseable license to do the following:
   46.30 -
   46.31 -a) to reproduce the Original Work in copies;
   46.32 -
   46.33 -b) to prepare derivative works ("Derivative Works") based upon the Original Work;
   46.34 -
   46.35 -c) to distribute copies of the Original Work and Derivative Works to the public;
   46.36 -
   46.37 -d) to perform the Original Work publicly; and
   46.38 -
   46.39 -e) to display the Original Work publicly.
   46.40 -
   46.41 -2) Grant of Patent License. Licensor hereby grants You a world-wide, royalty-free, non-exclusive, perpetual, sublicenseable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, to make, use, sell and offer for sale the Original Work and Derivative Works.
   46.42 -
   46.43 -3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor hereby agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work, and by publishing the address of that information repository in a notice immediately following the copyright notice that applies to the Original Work.
   46.44 -
   46.45 -4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior written permission of the Licensor. Nothing in this License shall be deemed to grant any rights to trademarks, copyrights, patents, trade secrets or any other intellectual property of Licensor except as expressly stated herein. No patent license is granted to make, use, sell or offer to sell embodiments of any patent claims other than the licensed claims defined in Section 2. No right is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under different terms from this License any Original Work that Licensor otherwise would have a right to license.
   46.46 -
   46.47 -5) This section intentionally omitted.
   46.48 -
   46.49 -6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
   46.50 -
   46.51 -7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately proceeding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to Original Work is granted hereunder except under this disclaimer.
   46.52 -
   46.53 -8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to any person for any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to liability for death or personal injury resulting from Licensor's negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to You.
   46.54 -
   46.55 -9) Acceptance and Termination. If You distribute copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. Nothing else but this License (or another written agreement between Licensor and You) grants You permission to create Derivative Works based upon the Original Work or to exercise any of the rights granted in Section 1 herein, and any attempt to do so except under the terms of this License (or another written agreement between Licensor and You) is expressly prohibited by U.S. copyright law, the equivalent laws of other countries, and by international treaty. Therefore, by exercising any of the rights granted to You in Section 1 herein, You indicate Your acceptance of this License and all of its terms and conditions.
   46.56 -
   46.57 -10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
   46.58 -
   46.59 -11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of the U.S. Copyright Act, 17 U.S.C. ยง 101 et seq., the equivalent laws of other countries, and international treaty. This section shall survive the termination of this License.
   46.60 -
   46.61 -12) Attorneys Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
   46.62 -
   46.63 -13) Miscellaneous. This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
   46.64 -
   46.65 -14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
   46.66 -
   46.67 -15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
   46.68 -
   46.69 -This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved. Permission is hereby granted to copy and distribute this license without modification. This license may not be modified without the express written permission of its copyright owner.
   46.70 -
   46.71 - 
   46.72 -
    47.1 --- a/pub/Foswiki/SmartEditAddOn/mochikit/MANIFEST	Mon Apr 13 12:51:06 2009 +0200
    47.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.3 @@ -1,115 +0,0 @@
    47.4 -Changes
    47.5 -META.json
    47.6 -MANIFEST			This list of files
    47.7 -LICENSE.txt
    47.8 -doc/html/MochiKit/Async.html
    47.9 -doc/html/MochiKit/Base.html
   47.10 -doc/html/MochiKit/Color.html
   47.11 -doc/html/MochiKit/DateTime.html
   47.12 -doc/html/MochiKit/DOM.html
   47.13 -doc/html/MochiKit/Format.html
   47.14 -doc/html/MochiKit/index.html
   47.15 -doc/html/MochiKit/Iter.html
   47.16 -doc/html/MochiKit/Logging.html
   47.17 -doc/html/MochiKit/LoggingPane.html
   47.18 -doc/html/MochiKit/Signal.html
   47.19 -doc/html/MochiKit/VersionHistory.html
   47.20 -doc/html/MochiKit/Visual.html
   47.21 -doc/js/toc.js
   47.22 -doc/rst/MochiKit/Async.rst
   47.23 -doc/rst/MochiKit/Base.rst
   47.24 -doc/rst/MochiKit/Color.rst
   47.25 -doc/rst/MochiKit/DateTime.rst
   47.26 -doc/rst/MochiKit/DOM.rst
   47.27 -doc/rst/MochiKit/Format.rst
   47.28 -doc/rst/MochiKit/index.rst
   47.29 -doc/rst/MochiKit/Iter.rst
   47.30 -doc/rst/MochiKit/Logging.rst
   47.31 -doc/rst/MochiKit/LoggingPane.rst
   47.32 -doc/rst/MochiKit/Signal.rst
   47.33 -doc/rst/MochiKit/VersionHistory.rst
   47.34 -doc/rst/MochiKit/Visual.rst
   47.35 -examples/ajax_tables/ajax_tables.css
   47.36 -examples/ajax_tables/ajax_tables.js
   47.37 -examples/ajax_tables/domains.json
   47.38 -examples/ajax_tables/domains.xml
   47.39 -examples/ajax_tables/index.html
   47.40 -examples/color_wheel/color_wheel.css
   47.41 -examples/color_wheel/color_wheel.js
   47.42 -examples/color_wheel/index.html
   47.43 -examples/draggable/draggable.css
   47.44 -examples/draggable/draggable.js
   47.45 -examples/draggable/index.html
   47.46 -examples/interpreter/index.html
   47.47 -examples/interpreter/interpreter.css
   47.48 -examples/interpreter/interpreter.js
   47.49 -examples/key_events/index.html
   47.50 -examples/key_events/key_events.css
   47.51 -examples/key_events/key_events.js
   47.52 -examples/logging_pane/index.html
   47.53 -examples/logging_pane/logging_pane.css
   47.54 -examples/logging_pane/logging_pane.js
   47.55 -examples/mochiregexp/index.html
   47.56 -examples/mochiregexp/mochiregexp.css
   47.57 -examples/mochiregexp/mochiregexp.js
   47.58 -examples/rounded_corners/index.html
   47.59 -examples/rounded_corners/rounded_corners.css
   47.60 -examples/rounded_corners/rounded_corners.js
   47.61 -examples/sortable_tables/index.html
   47.62 -examples/sortable_tables/sortable_tables.css
   47.63 -examples/sortable_tables/sortable_tables.js
   47.64 -examples/view-source/view-source.css
   47.65 -examples/view-source/view-source.html
   47.66 -examples/view-source/view-source.js
   47.67 -examples/view-source/lib/SyntaxHighlighter/shBrushCSharp.js
   47.68 -examples/view-source/lib/SyntaxHighlighter/shBrushDelphi.js
   47.69 -examples/view-source/lib/SyntaxHighlighter/shBrushJScript.js
   47.70 -examples/view-source/lib/SyntaxHighlighter/shBrushPhp.js
   47.71 -examples/view-source/lib/SyntaxHighlighter/shBrushPython.js
   47.72 -examples/view-source/lib/SyntaxHighlighter/shBrushSql.js
   47.73 -examples/view-source/lib/SyntaxHighlighter/shBrushVb.js
   47.74 -examples/view-source/lib/SyntaxHighlighter/shBrushXml.js
   47.75 -examples/view-source/lib/SyntaxHighlighter/shCore.js
   47.76 -examples/view-source/lib/SyntaxHighlighter/SyntaxHighlighter.css
   47.77 -examples/view-source/lib/SyntaxHighlighter/Tests.html
   47.78 -include/css/documentation.css
   47.79 -include/css/general.css
   47.80 -MochiKit/__package__.js
   47.81 -MochiKit/Async.js
   47.82 -MochiKit/Base.js
   47.83 -MochiKit/Color.js
   47.84 -MochiKit/DateTime.js
   47.85 -MochiKit/DOM.js
   47.86 -MochiKit/Format.js
   47.87 -MochiKit/Iter.js
   47.88 -MochiKit/Logging.js
   47.89 -MochiKit/LoggingPane.js
   47.90 -MochiKit/MochiKit.js
   47.91 -MochiKit/MockDOM.js
   47.92 -MochiKit/Signal.js
   47.93 -MochiKit/Test.js
   47.94 -MochiKit/Visual.js
   47.95 -packed/MochiKit/__package__.js
   47.96 -packed/MochiKit/MochiKit.js
   47.97 -tests/index.html
   47.98 -tests/test_Base.js
   47.99 -tests/test_Color.js
  47.100 -tests/test_DateTime.js
  47.101 -tests/test_Format.js
  47.102 -tests/test_Iter.js
  47.103 -tests/test_Logging.js
  47.104 -tests/test_MochiKit-Async.html
  47.105 -tests/test_MochiKit-Base.html
  47.106 -tests/test_MochiKit-Color.html
  47.107 -tests/test_MochiKit-DateTime.html
  47.108 -tests/test_MochiKit-DOM.html
  47.109 -tests/test_MochiKit-Format.html
  47.110 -tests/test_MochiKit-Iter.html
  47.111 -tests/test_MochiKit-JSAN.html
  47.112 -tests/test_MochiKit-Logging.html
  47.113 -tests/test_MochiKit-MochiKit.html
  47.114 -tests/test_MochiKit-Signal.html
  47.115 -tests/test_Signal.js
  47.116 -tests/SimpleTest/SimpleTest.js
  47.117 -tests/SimpleTest/test.css
  47.118 -tests/SimpleTest/TestRunner.js
    48.1 --- a/pub/Foswiki/SmartEditAddOn/mochikit/META.json	Mon Apr 13 12:51:06 2009 +0200
    48.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.3 @@ -1,17 +0,0 @@
    48.4 -{
    48.5 -    "recommends": {
    48.6 -        "JSAN": "0.10"
    48.7 -    },
    48.8 -    "name": "MochiKit",
    48.9 -    "license": "mit",
   48.10 -    "author": [
   48.11 -        "Bob Ippolito <bob@redivi.com>"
   48.12 -    ],
   48.13 -    "abstract": "Python-inspired JavaScript kit",
   48.14 -    "generated_by": "MochiKit's build script",
   48.15 -    "build_requires": {
   48.16 -        "Test.Simple": "0.11"
   48.17 -    },
   48.18 -    "version": "1.3.1",
   48.19 -    "provides": {}
   48.20 -}
   48.21 \ No newline at end of file
    49.1 --- a/pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/Async.html	Mon Apr 13 12:51:06 2009 +0200
    49.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.3 @@ -1,606 +0,0 @@
    49.4 -<?xml version="1.0" encoding="utf-8" ?>
    49.5 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    49.6 -
    49.7 -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    49.8 -<head>
    49.9 -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   49.10 -<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
   49.11 -<title>MochiKit.Async - manage asynchronous tasks</title>
   49.12 -
   49.13 -<link rel="stylesheet" href="../../../include/css/documentation.css" type="text/css" />
   49.14 -<script type="text/javascript" src="../../../packed/lib/MochiKit/MochiKit.js"></script>
   49.15 -<script type="text/javascript" src="../../js/toc.js"></script>
   49.16 -</head>
   49.17 -<body>
   49.18 -<div class="document">
   49.19 -<div class="section">
   49.20 -<h1><a id="name" name="name">Name</a></h1>
   49.21 -<p>MochiKit.Async - manage asynchronous tasks</p>
   49.22 -</div>
   49.23 -<div class="section">
   49.24 -<h1><a id="synopsis" name="synopsis">Synopsis</a></h1>
   49.25 -<pre class="literal-block">
   49.26 -var url = &quot;/src/b/bo/bob/MochiKit.Async/META.json&quot;;
   49.27 -/*
   49.28 -
   49.29 -    META.json looks something like this:
   49.30 -
   49.31 -    {&quot;name&quot;: &quot;MochiKit&quot;, &quot;version&quot;: &quot;0.5&quot;}
   49.32 -
   49.33 -*/
   49.34 -var d = loadJSONDoc(url);
   49.35 -var gotMetadata = function (meta) {
   49.36 -    if (MochiKit.Async.VERSION == meta.version) {
   49.37 -        alert(&quot;You have the newest MochiKit.Async!&quot;);
   49.38 -    } else {
   49.39 -        alert(&quot;MochiKit.Async &quot;
   49.40 -            + meta.version
   49.41 -            + &quot; is available, upgrade!&quot;);
   49.42 -    }
   49.43 -};
   49.44 -var metadataFetchFailed = function (err) {
   49.45 -  alert(&quot;The metadata for MochiKit.Async could not be fetched :(&quot;);
   49.46 -};
   49.47 -d.addCallbacks(gotMetadata, metadataFetchFailed);
   49.48 -</pre>
   49.49 -</div>
   49.50 -<div class="section">
   49.51 -<h1><a id="description" name="description">Description</a></h1>
   49.52 -<p>MochiKit.Async provides facilities to manage asynchronous
   49.53 -(as in AJAX <a class="footnote-reference" href="#id7" id="id1" name="id1">[1]</a>) tasks. The model for asynchronous computation
   49.54 -used in this module is heavily inspired by Twisted <a class="footnote-reference" href="#id8" id="id2" name="id2">[2]</a>.</p>
   49.55 -</div>
   49.56 -<div class="section">
   49.57 -<h1><a id="dependencies" name="dependencies">Dependencies</a></h1>
   49.58 -<ul class="simple">
   49.59 -<li><a class="mochiref reference" href="Base.html">MochiKit.Base</a></li>
   49.60 -</ul>
   49.61 -</div>
   49.62 -<div class="section">
   49.63 -<h1><a id="overview" name="overview">Overview</a></h1>
   49.64 -<div class="section">
   49.65 -<h2><a id="deferred" name="deferred">Deferred</a></h2>
   49.66 -<p>The Deferred constructor encapsulates a single value that
   49.67 -is not available yet. The most important example of this
   49.68 -in the context of a web browser would be an <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt>
   49.69 -to a server. The importance of the Deferred is that it
   49.70 -allows a consistent API to be exposed for all asynchronous
   49.71 -computations that occur exactly once.</p>
   49.72 -<p>The producer of the Deferred is responsible for doing all
   49.73 -of the complicated work behind the scenes. This often
   49.74 -means waiting for a timer to fire, or waiting for an event
   49.75 -(e.g. <tt class="docutils literal"><span class="pre">onreadystatechange</span></tt> of <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt>).
   49.76 -It could also be coordinating several events (e.g.
   49.77 -<tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> with a timeout, or several Deferreds
   49.78 -(e.g. fetching a set of XML documents that should be
   49.79 -processed at the same time).</p>
   49.80 -<p>Since these sorts of tasks do not respond immediately, the
   49.81 -producer of the Deferred does the following steps before
   49.82 -returning to the consumer:</p>
   49.83 -<ol class="arabic simple">
   49.84 -<li>Create a <tt class="docutils literal"><span class="pre">new</span></tt> <a class="mochiref reference" href="#fn-deferred">Deferred();</a> object and keep a reference
   49.85 -to it, because it will be needed later when the value is
   49.86 -ready.</li>
   49.87 -<li>Setup the conditions to create the value requested (e.g.
   49.88 -create a new <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt>, set its
   49.89 -<tt class="docutils literal"><span class="pre">onreadystatechange</span></tt>).</li>
   49.90 -<li>Return the <a class="mochiref reference" href="#fn-deferred">Deferred</a> object.</li>
   49.91 -</ol>
   49.92 -<p>Since the value is not yet ready, the consumer attaches
   49.93 -a function to the Deferred that will be called when the
   49.94 -value is ready. This is not unlike <tt class="docutils literal"><span class="pre">setTimeout</span></tt>, or
   49.95 -other similar facilities you may already be familiar with.
   49.96 -The consumer can also attach an &quot;errback&quot; to the
   49.97 -<a class="mochiref reference" href="#fn-deferred">Deferred</a>, which is a callback for error handling.</p>
   49.98 -<p>When the value is ready, the producer simply calls
   49.99 -<tt class="docutils literal"><span class="pre">myDeferred.callback(theValue)</span></tt>. If an error occurred,
  49.100 -it should call <tt class="docutils literal"><span class="pre">myDeferred.errback(theValue)</span></tt> instead.
  49.101 -As soon as this happens, the callback that the consumer
  49.102 -attached to the <a class="mochiref reference" href="#fn-deferred">Deferred</a> is called with <tt class="docutils literal"><span class="pre">theValue</span></tt>
  49.103 -as the only argument.</p>
  49.104 -<p>There are quite a few additional &quot;advanced&quot; features
  49.105 -baked into <a class="mochiref reference" href="#fn-deferred">Deferred</a>, such as cancellation and
  49.106 -callback chains, so take a look at the API
  49.107 -reference if you would like to know more!</p>
  49.108 -</div>
  49.109 -</div>
  49.110 -<div class="section">
  49.111 -<h1><a id="api-reference" name="api-reference">API Reference</a></h1>
  49.112 -<div class="section">
  49.113 -<h2><a id="errors" name="errors">Errors</a></h2>
  49.114 -<p>
  49.115 -<a name="fn-alreadycallederror"></a>
  49.116 -<a class="mochidef reference" href="#fn-alreadycallederror">AlreadyCalledError</a>:</p>
  49.117 -<blockquote>
  49.118 -Thrown by a <a class="mochiref reference" href="#fn-deferred">Deferred</a> if <tt class="docutils literal"><span class="pre">.callback</span></tt> or
  49.119 -<tt class="docutils literal"><span class="pre">.errback</span></tt> are called more than once.</blockquote>
  49.120 -<p>
  49.121 -<a name="fn-browsercomplianceerror"></a>
  49.122 -<a class="mochidef reference" href="#fn-browsercomplianceerror">BrowserComplianceError</a>:</p>
  49.123 -<blockquote>
  49.124 -Thrown when the JavaScript runtime is not capable of performing
  49.125 -the given function. Currently, this happens if the browser
  49.126 -does not support <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt>.</blockquote>
  49.127 -<p>
  49.128 -<a name="fn-cancellederror"></a>
  49.129 -<a class="mochidef reference" href="#fn-cancellederror">CancelledError</a>:</p>
  49.130 -<blockquote>
  49.131 -Thrown by a <a class="mochiref reference" href="#fn-deferred">Deferred</a> when it is cancelled,
  49.132 -unless a canceller is present and throws something else.</blockquote>
  49.133 -<p>
  49.134 -<a name="fn-genericerror"></a>
  49.135 -<a class="mochidef reference" href="#fn-genericerror">GenericError</a>:</p>
  49.136 -<blockquote>
  49.137 -Results passed to <tt class="docutils literal"><span class="pre">.fail</span></tt> or <tt class="docutils literal"><span class="pre">.errback</span></tt> of a <a class="mochiref reference" href="#fn-deferred">Deferred</a>
  49.138 -are wrapped by this <tt class="docutils literal"><span class="pre">Error</span></tt> if <tt class="docutils literal"><span class="pre">!(result</span> <span class="pre">instanceof</span> <span class="pre">Error)</span></tt>.</blockquote>
  49.139 -<p>
  49.140 -<a name="fn-xmlhttprequesterror"></a>
  49.141 -<a class="mochidef reference" href="#fn-xmlhttprequesterror">XMLHttpRequestError</a>:</p>
  49.142 -<blockquote>
  49.143 -Thrown when an <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> does not complete successfully
  49.144 -for any reason. The <tt class="docutils literal"><span class="pre">req</span></tt> property of the error is the failed
  49.145 -<tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> object, and for convenience the <tt class="docutils literal"><span class="pre">number</span></tt>
  49.146 -property corresponds to <tt class="docutils literal"><span class="pre">req.status</span></tt>.</blockquote>
  49.147 -</div>
  49.148 -<div class="section">
  49.149 -<h2><a id="constructors" name="constructors">Constructors</a></h2>
  49.150 -<p>
  49.151 -<a name="fn-deferred"></a>
  49.152 -<a class="mochidef reference" href="#fn-deferred">Deferred()</a>:</p>
  49.153 -<blockquote>
  49.154 -Encapsulates a sequence of callbacks in response to a value that
  49.155 -may not yet be available. This is modeled after the Deferred class
  49.156 -from Twisted <a class="footnote-reference" href="#id9" id="id3" name="id3">[3]</a>.</blockquote>
  49.157 -<blockquote>
  49.158 -<p>Why do we want this?  JavaScript has no threads, and even if it did,
  49.159 -threads are hard. Deferreds are a way of abstracting non-blocking
  49.160 -events, such as the final response to an <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt>.</p>
  49.161 -<p>The sequence of callbacks is internally represented as a list
  49.162 -of 2-tuples containing the callback/errback pair. For example,
  49.163 -the following call sequence:</p>
  49.164 -<pre class="literal-block">
  49.165 -var d = new Deferred();
  49.166 -d.addCallback(myCallback);
  49.167 -d.addErrback(myErrback);
  49.168 -d.addBoth(myBoth);
  49.169 -d.addCallbacks(myCallback, myErrback);
  49.170 -</pre>
  49.171 -<p>is translated into a <a class="mochiref reference" href="#fn-deferred">Deferred</a> with the following internal
  49.172 -representation:</p>
  49.173 -<pre class="literal-block">
  49.174 -[
  49.175 -    [myCallback, null],
  49.176 -    [null, myErrback],
  49.177 -    [myBoth, myBoth],
  49.178 -    [myCallback, myErrback]
  49.179 -]
  49.180 -</pre>
  49.181 -<p>The <a class="mochiref reference" href="#fn-deferred">Deferred</a> also keeps track of its current status (fired).
  49.182 -Its status may be one of the following three values:</p>
  49.183 -<blockquote>
  49.184 -<table border="1" class="docutils">
  49.185 -<colgroup>
  49.186 -<col width="14%" />
  49.187 -<col width="86%" />
  49.188 -</colgroup>
  49.189 -<thead valign="bottom">
  49.190 -<tr><th class="head">Value</th>
  49.191 -<th class="head">Condition</th>
  49.192 -</tr>
  49.193 -</thead>
  49.194 -<tbody valign="top">
  49.195 -<tr><td>-1</td>
  49.196 -<td>no value yet (initial condition)</td>
  49.197 -</tr>
  49.198 -<tr><td>0</td>
  49.199 -<td>success</td>
  49.200 -</tr>
  49.201 -<tr><td>1</td>
  49.202 -<td>error</td>
  49.203 -</tr>
  49.204 -</tbody>
  49.205 -</table>
  49.206 -</blockquote>
  49.207 -<p>A <a class="mochiref reference" href="#fn-deferred">Deferred</a> will be in the error state if one of the following
  49.208 -conditions are met:</p>
  49.209 -<ol class="arabic simple">
  49.210 -<li>The result given to callback or errback is &quot;<tt class="docutils literal"><span class="pre">instanceof</span> <span class="pre">Error</span></tt>&quot;</li>
  49.211 -<li>The callback or errback threw while executing. If the thrown object
  49.212 -is not <tt class="docutils literal"><span class="pre">instanceof</span> <span class="pre">Error</span></tt>, it will be wrapped with
  49.213 -<a class="mochiref reference" href="#fn-genericerror">GenericError</a>.</li>
  49.214 -</ol>
  49.215 -<p>Otherwise, the <a class="mochiref reference" href="#fn-deferred">Deferred</a> will be in the success state. The state
  49.216 -of the <a class="mochiref reference" href="#fn-deferred">Deferred</a> determines the next element in the callback
  49.217 -sequence to run.</p>
  49.218 -<p>When a callback or errback occurs with the example deferred chain, something
  49.219 -equivalent to the following will happen (imagine that exceptions are caught
  49.220 -and returned as-is):</p>
  49.221 -<pre class="literal-block">
  49.222 -// d.callback(result) or d.errback(result)
  49.223 -if (!(result instanceof Error)) {
  49.224 -    result = myCallback(result);
  49.225 -}
  49.226 -if (result instanceof Error) {
  49.227 -    result = myErrback(result);
  49.228 -}
  49.229 -result = myBoth(result);
  49.230 -if (result instanceof Error) {
  49.231 -    result = myErrback(result);
  49.232 -} else {
  49.233 -    result = myCallback(result);
  49.234 -}
  49.235 -</pre>
  49.236 -<p>The result is then stored away in case another step is added to the
  49.237 -callback sequence. Since the <a class="mochiref reference" href="#fn-deferred">Deferred</a> already has a value
  49.238 -available, any new callbacks added will be called immediately.</p>
  49.239 -<p>There are two other &quot;advanced&quot; details about this implementation that are
  49.240 -useful:</p>
  49.241 -<p>Callbacks are allowed to return <a class="mochiref reference" href="#fn-deferred">Deferred</a> instances,
  49.242 -so you can build complicated sequences of events with (relative) ease.</p>
  49.243 -<p>The creator of the <a class="mochiref reference" href="#fn-deferred">Deferred</a> may specify a canceller. The
  49.244 -canceller is a function that will be called if
  49.245 -<a class="mochiref reference" href="#fn-deferred.prototype.cancel">Deferred.prototype.cancel</a> is called before the
  49.246 -<a class="mochiref reference" href="#fn-deferred">Deferred</a> fires. You can use this to allow an
  49.247 -<tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> to be cleanly cancelled, for example. Note that
  49.248 -cancel will fire the <a class="mochiref reference" href="#fn-deferred">Deferred</a> with a
  49.249 -<a class="mochiref reference" href="#fn-cancellederror">CancelledError</a> (unless your canceller throws or returns
  49.250 -a different <tt class="docutils literal"><span class="pre">Error</span></tt>), so errbacks should be prepared to handle that
  49.251 -<tt class="docutils literal"><span class="pre">Error</span></tt> gracefully for cancellable <a class="mochiref reference" href="#fn-deferred">Deferred</a> instances.</p>
  49.252 -</blockquote>
  49.253 -<p>
  49.254 -<a name="fn-deferred.prototype.addboth"></a>
  49.255 -<a class="mochidef reference" href="#fn-deferred.prototype.addboth">Deferred.prototype.addBoth(func)</a>:</p>
  49.256 -<blockquote>
  49.257 -<p>Add the same function as both a callback and an errback as the
  49.258 -next element on the callback sequence. This is useful for code
  49.259 -that you want to guarantee to run, e.g. a finalizer.</p>
  49.260 -<p>If additional arguments are given, then <tt class="docutils literal"><span class="pre">func</span></tt> will be replaced
  49.261 -with <a class="mochiref reference" href="Base.html#fn-partial">MochiKit.Base.partial.apply(null, arguments)</a>. This
  49.262 -differs from <a class="reference" href="http://twistedmatrix.com/">Twisted</a>, because the result of the callback or
  49.263 -errback will be the <em>last</em> argument passed to <tt class="docutils literal"><span class="pre">func</span></tt>.</p>
  49.264 -<p>If <tt class="docutils literal"><span class="pre">func</span></tt> returns a <a class="mochiref reference" href="#fn-deferred">Deferred</a>, then it will be chained
  49.265 -(its value or error will be passed to the next callback). Note that
  49.266 -once the returned <tt class="docutils literal"><span class="pre">Deferred</span></tt> is chained, it can no longer accept new
  49.267 -callbacks.</p>
  49.268 -</blockquote>
  49.269 -<p>
  49.270 -<a name="fn-deferred.prototype.addcallback"></a>
  49.271 -<a class="mochidef reference" href="#fn-deferred.prototype.addcallback">Deferred.prototype.addCallback(func[, ...])</a>:</p>
  49.272 -<blockquote>
  49.273 -<p>Add a single callback to the end of the callback sequence.</p>
  49.274 -<p>If additional arguments are given, then <tt class="docutils literal"><span class="pre">func</span></tt> will be replaced
  49.275 -with <a class="mochiref reference" href="Base.html#fn-partial">MochiKit.Base.partial.apply(null, arguments)</a>. This
  49.276 -differs from <a class="reference" href="http://twistedmatrix.com/">Twisted</a>, because the result of the callback will
  49.277 -be the <em>last</em> argument passed to <tt class="docutils literal"><span class="pre">func</span></tt>.</p>
  49.278 -<p>If <tt class="docutils literal"><span class="pre">func</span></tt> returns a <a class="mochiref reference" href="#fn-deferred">Deferred</a>, then it will be chained
  49.279 -(its value or error will be passed to the next callback). Note that
  49.280 -once the returned <tt class="docutils literal"><span class="pre">Deferred</span></tt> is chained, it can no longer accept new
  49.281 -callbacks.</p>
  49.282 -</blockquote>
  49.283 -<p>
  49.284 -<a name="fn-deferred.prototype.addcallbacks"></a>
  49.285 -<a class="mochidef reference" href="#fn-deferred.prototype.addcallbacks">Deferred.prototype.addCallbacks(callback, errback)</a>:</p>
  49.286 -<blockquote>
  49.287 -<p>Add separate callback and errback to the end of the callback
  49.288 -sequence. Either callback or errback may be <tt class="docutils literal"><span class="pre">null</span></tt>,
  49.289 -but not both.</p>
  49.290 -<p>If <tt class="docutils literal"><span class="pre">callback</span></tt> or <tt class="docutils literal"><span class="pre">errback</span></tt> returns a <a class="mochiref reference" href="#fn-deferred">Deferred</a>,
  49.291 -then it will be chained (its value or error will be passed to the
  49.292 -next callback). Note that once the returned <tt class="docutils literal"><span class="pre">Deferred</span></tt> is chained,
  49.293 -it can no longer accept new callbacks.</p>
  49.294 -</blockquote>
  49.295 -<p>
  49.296 -<a name="fn-deferred.prototype.adderrback"></a>
  49.297 -<a class="mochidef reference" href="#fn-deferred.prototype.adderrback">Deferred.prototype.addErrback(func)</a>:</p>
  49.298 -<blockquote>
  49.299 -<p>Add a single errback to the end of the callback sequence.</p>
  49.300 -<p>If additional arguments are given, then <tt class="docutils literal"><span class="pre">func</span></tt> will be replaced
  49.301 -with <a class="mochiref reference" href="Base.html#fn-partial">MochiKit.Base.partial.apply(null, arguments)</a>. This
  49.302 -differs from <a class="reference" href="http://twistedmatrix.com/">Twisted</a>, because the result of the errback will
  49.303 -be the <em>last</em> argument passed to <tt class="docutils literal"><span class="pre">func</span></tt>.</p>
  49.304 -<p>If <tt class="docutils literal"><span class="pre">func</span></tt> returns a <a class="mochiref reference" href="#fn-deferred">Deferred</a>, then it will be chained
  49.305 -(its value or error will be passed to the next callback). Note that
  49.306 -once the returned <tt class="docutils literal"><span class="pre">Deferred</span></tt> is chained, it can no longer accept new
  49.307 -callbacks.</p>
  49.308 -</blockquote>
  49.309 -<p>
  49.310 -<a name="fn-deferred.prototype.callback"></a>
  49.311 -<a class="mochidef reference" href="#fn-deferred.prototype.callback">Deferred.prototype.callback([result])</a>:</p>
  49.312 -<blockquote>
  49.313 -<p>Begin the callback sequence with a non-<tt class="docutils literal"><span class="pre">Error</span></tt> result. Result
  49.314 -may be any value except for a <a class="mochiref reference" href="#fn-deferred">Deferred</a>.</p>
  49.315 -<p>Either <tt class="docutils literal"><span class="pre">.callback</span></tt> or <tt class="docutils literal"><span class="pre">.errback</span></tt> should
  49.316 -be called exactly once on a <a class="mochiref reference" href="#fn-deferred">Deferred</a>.</p>
  49.317 -</blockquote>
  49.318 -<p>
  49.319 -<a name="fn-deferred.prototype.cancel"></a>
  49.320 -<a class="mochidef reference" href="#fn-deferred.prototype.cancel">Deferred.prototype.cancel()</a>:</p>
  49.321 -<blockquote>
  49.322 -<p>Cancels a <a class="mochiref reference" href="#fn-deferred">Deferred</a> that has not yet received a value,
  49.323 -or is waiting on another <a class="mochiref reference" href="#fn-deferred">Deferred</a> as its value.</p>
  49.324 -<p>If a canceller is defined, the canceller is called.
  49.325 -If the canceller did not return an <tt class="docutils literal"><span class="pre">Error</span></tt>, or there
  49.326 -was no canceller, then the errback chain is started
  49.327 -with <a class="mochiref reference" href="#fn-cancellederror">CancelledError</a>.</p>
  49.328 -</blockquote>
  49.329 -<p>
  49.330 -<a name="fn-deferred.prototype.errback"></a>
  49.331 -<a class="mochidef reference" href="#fn-deferred.prototype.errback">Deferred.prototype.errback([result])</a>:</p>
  49.332 -<blockquote>
  49.333 -<p>Begin the callback sequence with an error result.
  49.334 -Result may be any value except for a <a class="mochiref reference" href="#fn-deferred">Deferred</a>,
  49.335 -but if <tt class="docutils literal"><span class="pre">!(result</span> <span class="pre">instanceof</span> <span class="pre">Error)</span></tt>, it will be wrapped
  49.336 -with <a class="mochiref reference" href="#fn-genericerror">GenericError</a>.</p>
  49.337 -<p>Either <tt class="docutils literal"><span class="pre">.callback</span></tt> or <tt class="docutils literal"><span class="pre">.errback</span></tt> should
  49.338 -be called exactly once on a 
  49.339 -<a name="fn-deferred"></a>
  49.340 -<a class="mochidef reference" href="#fn-deferred">Deferred</a>.</p>
  49.341 -</blockquote>
  49.342 -<p>
  49.343 -<a name="fn-deferredlock"></a>
  49.344 -<a class="mochidef reference" href="#fn-deferredlock">DeferredLock()</a>:</p>
  49.345 -<blockquote>
  49.346 -<p>A lock for asynchronous systems.</p>
  49.347 -<p>The <tt class="docutils literal"><span class="pre">locked</span></tt> property of a <a class="mochiref reference" href="#fn-deferredlock">DeferredLock</a> will be <tt class="docutils literal"><span class="pre">true</span></tt> if
  49.348 -it locked, <tt class="docutils literal"><span class="pre">false</span></tt> otherwise. Do not change this property.</p>
  49.349 -</blockquote>
  49.350 -<p>
  49.351 -<a name="fn-deferredlock.prototype.acquire"></a>
  49.352 -<a class="mochidef reference" href="#fn-deferredlock.prototype.acquire">DeferredLock.prototype.acquire()</a>:</p>
  49.353 -<blockquote>
  49.354 -Attempt to acquire the lock. Returns a <a class="mochiref reference" href="#fn-deferred">Deferred</a> that fires on
  49.355 -lock acquisition with the <a class="mochiref reference" href="#fn-deferredlock">DeferredLock</a> as the value.
  49.356 -If the lock is locked, then the <a class="mochiref reference" href="#fn-deferred">Deferred</a> goes into a waiting
  49.357 -list.</blockquote>
  49.358 -<p>
  49.359 -<a name="fn-deferredlock.prototype.release"></a>
  49.360 -<a class="mochidef reference" href="#fn-deferredlock.prototype.release">DeferredLock.prototype.release()</a>:</p>
  49.361 -<blockquote>
  49.362 -Release the lock. If there is a waiting list, then the first
  49.363 -<a class="mochiref reference" href="#fn-deferred">Deferred</a> in that waiting list will be called back.</blockquote>
  49.364 -<p>
  49.365 -<a name="fn-deferredlist"></a>
  49.366 -<a class="mochidef reference" href="#fn-deferredlist">DeferredList(list, [fireOnOneCallback, fireOnOneErrback, consumeErrors, canceller])</a>:</p>
  49.367 -<blockquote>
  49.368 -<p>Combine a list of <a class="mochiref reference" href="#fn-deferred">Deferred</a> into one. Track the callbacks and
  49.369 -return a list of (success, result) tuples, 'success' being a boolean
  49.370 -indicating whether result is a normal result or an error.</p>
  49.371 -<p>Once created, you have access to all <a class="mochiref reference" href="#fn-deferred">Deferred</a> methods, like
  49.372 -addCallback, addErrback, addBoth. The behaviour can be changed by the
  49.373 -following options:</p>
  49.374 -<dl class="docutils">
  49.375 -<dt><tt class="docutils literal"><span class="pre">fireOnOneCallback</span></tt>:</dt>
  49.376 -<dd>Flag for launching the callback once the first Deferred of the list
  49.377 -has returned.</dd>
  49.378 -<dt><tt class="docutils literal"><span class="pre">fireOnOneErrback</span></tt>:</dt>
  49.379 -<dd>Flag for calling the errback at the first error of a Deferred.</dd>
  49.380 -<dt><tt class="docutils literal"><span class="pre">consumeErrors</span></tt>:</dt>
  49.381 -<dd>Flag indicating that any errors raised in the Deferreds should be
  49.382 -consumed by the DeferredList.</dd>
  49.383 -</dl>
  49.384 -<p>Example:</p>
  49.385 -<pre class="literal-block">
  49.386 -// We need to fetch data from 2 different urls
  49.387 -var d1 = loadJSONDoc(url1);
  49.388 -var d2 = loadJSONDoc(url2);
  49.389 -var l1 = new DeferredList([d1, d2], false, false, true);
  49.390 -l1.addCallback(function (resultList) {
  49.391 -    MochiKit.Base.map(function (result) {
  49.392 -        if (result[0]) {
  49.393 -            alert(&quot;Data is here: &quot; + result[1]);
  49.394 -        } else {
  49.395 -            alert(&quot;Got an error: &quot; + result[1]);
  49.396 -        }
  49.397 -    }, resultList);
  49.398 -});
  49.399 -</pre>
  49.400 -</blockquote>
  49.401 -</div>
  49.402 -<div class="section">
  49.403 -<h2><a id="functions" name="functions">Functions</a></h2>
  49.404 -<p>
  49.405 -<a name="fn-calllater"></a>
  49.406 -<a class="mochidef reference" href="#fn-calllater">callLater(seconds, func[, args...])</a>:</p>
  49.407 -<blockquote>
  49.408 -<p>Call <tt class="docutils literal"><span class="pre">func(args...)</span></tt> after at least <tt class="docutils literal"><span class="pre">seconds</span></tt> seconds have elapsed.
  49.409 -This is a convenience method for:</p>
  49.410 -<pre class="literal-block">
  49.411 -func = partial.apply(extend(null, arguments, 1));
  49.412 -return wait(seconds).addCallback(function (res) { return func() });
  49.413 -</pre>
  49.414 -<p>Returns a cancellable <a class="mochiref reference" href="#fn-deferred">Deferred</a>.</p>
  49.415 -</blockquote>
  49.416 -<p>
  49.417 -<a name="fn-dosimplexmlhttprequest"></a>
  49.418 -<a class="mochidef reference" href="#fn-dosimplexmlhttprequest">doSimpleXMLHttpRequest(url[, queryArguments...])</a>:</p>
  49.419 -<blockquote>
  49.420 -<p>Perform a simple <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> and wrap it with a
  49.421 -<a class="mochiref reference" href="#fn-deferred">Deferred</a> that may be cancelled.</p>
  49.422 -<p>Note that currently, only <tt class="docutils literal"><span class="pre">200</span></tt> (OK) and <tt class="docutils literal"><span class="pre">304</span></tt>
  49.423 -(NOT_MODIFIED) are considered success codes at this time, other
  49.424 -status codes will result in an errback with an <tt class="docutils literal"><span class="pre">XMLHttpRequestError</span></tt>.</p>
  49.425 -<dl class="docutils">
  49.426 -<dt><tt class="docutils literal"><span class="pre">url</span></tt>:</dt>
  49.427 -<dd>The URL to GET</dd>
  49.428 -<dt><tt class="docutils literal"><span class="pre">queryArguments</span></tt>:</dt>
  49.429 -<dd><p class="first">If this function is called with more than one argument, a <tt class="docutils literal"><span class="pre">&quot;?&quot;</span></tt>
  49.430 -and the result of <a class="mochiref reference" href="Base.html#fn-querystring">MochiKit.Base.queryString</a> with
  49.431 -the rest of the arguments are appended to the URL.</p>
  49.432 -<p>For example, this will do a GET request to the URL
  49.433 -<tt class="docutils literal"><span class="pre">http://example.com?bar=baz</span></tt>:</p>
  49.434 -<pre class="last literal-block">
  49.435 -doSimpleXMLHttpRequest(&quot;http://example.com&quot;, {bar: &quot;baz&quot;});
  49.436 -</pre>
  49.437 -</dd>
  49.438 -<dt><em>returns</em>:</dt>
  49.439 -<dd><a class="mochiref reference" href="#fn-deferred">Deferred</a> that will callback with the <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt>
  49.440 -instance on success</dd>
  49.441 -</dl>
  49.442 -</blockquote>
  49.443 -<p>
  49.444 -<a name="fn-evaljsonrequest"></a>
  49.445 -<a class="mochidef reference" href="#fn-evaljsonrequest">evalJSONRequest(req)</a>:</p>
  49.446 -<blockquote>
  49.447 -<p>Evaluate a JSON <a class="footnote-reference" href="#id10" id="id4" name="id4">[4]</a> <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt></p>
  49.448 -<dl class="docutils">
  49.449 -<dt><tt class="docutils literal"><span class="pre">req</span></tt>:</dt>
  49.450 -<dd>The request whose <tt class="docutils literal"><span class="pre">.responseText</span></tt> property is to be evaluated</dd>
  49.451 -<dt><em>returns</em>:</dt>
  49.452 -<dd>A JavaScript object</dd>
  49.453 -</dl>
  49.454 -</blockquote>
  49.455 -<p>
  49.456 -<a name="fn-fail"></a>
  49.457 -<a class="mochidef reference" href="#fn-fail">fail([result])</a>:</p>
  49.458 -<blockquote>
  49.459 -<p>Return a <a class="mochiref reference" href="#fn-deferred">Deferred</a> that has already had <tt class="docutils literal"><span class="pre">.errback(result)</span></tt>
  49.460 -called.</p>
  49.461 -<p>See <tt class="docutils literal"><span class="pre">succeed</span></tt> documentation for rationale.</p>
  49.462 -<dl class="docutils">
  49.463 -<dt><tt class="docutils literal"><span class="pre">result</span></tt>:</dt>
  49.464 -<dd>The result to give to <a class="mochiref reference" href="#fn-deferred.prototype.errback">Deferred.prototype.errback(result)</a>.</dd>
  49.465 -<dt><em>returns</em>:</dt>
  49.466 -<dd>A <tt class="docutils literal"><span class="pre">new</span></tt> <a class="mochiref reference" href="#fn-deferred">Deferred()</a></dd>
  49.467 -</dl>
  49.468 -</blockquote>
  49.469 -<p>
  49.470 -<a name="fn-gatherresults"></a>
  49.471 -<a class="mochidef reference" href="#fn-gatherresults">gatherResults(deferreds)</a>:</p>
  49.472 -<blockquote>
  49.473 -A convenience function that returns a <a class="mochiref reference" href="#fn-deferredlist">DeferredList</a>
  49.474 -from the given <tt class="docutils literal"><span class="pre">Array</span></tt> of <a class="mochiref reference" href="#fn-deferred">Deferred</a> instances
  49.475 -that will callback with an <tt class="docutils literal"><span class="pre">Array</span></tt> of just results when
  49.476 -they're available, or errback on the first array.</blockquote>
  49.477 -<p>
  49.478 -<a name="fn-getxmlhttprequest"></a>
  49.479 -<a class="mochidef reference" href="#fn-getxmlhttprequest">getXMLHttpRequest()</a>:</p>
  49.480 -<blockquote>
  49.481 -<p>Return an <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> compliant object for the current
  49.482 -platform.</p>
  49.483 -<p>In order of preference:</p>
  49.484 -<ul class="simple">
  49.485 -<li><tt class="docutils literal"><span class="pre">new</span> <span class="pre">XMLHttpRequest()</span></tt></li>
  49.486 -<li><tt class="docutils literal"><span class="pre">new</span> <span class="pre">ActiveXObject('Msxml2.XMLHTTP')</span></tt></li>
  49.487 -<li><tt class="docutils literal"><span class="pre">new</span> <span class="pre">ActiveXObject('Microsoft.XMLHTTP')</span></tt></li>
  49.488 -<li><tt class="docutils literal"><span class="pre">new</span> <span class="pre">ActiveXObject('Msxml2.XMLHTTP.4.0')</span></tt></li>
  49.489 -</ul>
  49.490 -</blockquote>
  49.491 -<p>
  49.492 -<a name="fn-maybedeferred"></a>
  49.493 -<a class="mochidef reference" href="#fn-maybedeferred">maybeDeferred(func[, argument...])</a>:</p>
  49.494 -<blockquote>
  49.495 -<p>Call a <tt class="docutils literal"><span class="pre">func</span></tt> with the given arguments and ensure the result is a
  49.496 -<a class="mochiref reference" href="#fn-deferred">Deferred</a>.</p>
  49.497 -<dl class="docutils">
  49.498 -<dt><tt class="docutils literal"><span class="pre">func</span></tt>:</dt>
  49.499 -<dd>The function to call.</dd>
  49.500 -<dt><em>returns</em>:</dt>
  49.501 -<dd>A new <a class="mochiref reference" href="#fn-deferred">Deferred</a> based on the call to <tt class="docutils literal"><span class="pre">func</span></tt>. If <tt class="docutils literal"><span class="pre">func</span></tt>
  49.502 -does not naturally return a <a class="mochiref reference" href="#fn-deferred">Deferred</a>, its result or error
  49.503 -value will be wrapped by one.</dd>
  49.504 -</dl>
  49.505 -</blockquote>
  49.506 -<p>
  49.507 -<a name="fn-loadjsondoc"></a>
  49.508 -<a class="mochidef reference" href="#fn-loadjsondoc">loadJSONDoc(url)</a>:</p>
  49.509 -<blockquote>
  49.510 -<p>Do a simple <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> to a URL and get the response
  49.511 -as a JSON <a class="footnote-reference" href="#id10" id="id5" name="id5">[4]</a> document.</p>
  49.512 -<dl class="docutils">
  49.513 -<dt><tt class="docutils literal"><span class="pre">url</span></tt>:</dt>
  49.514 -<dd>The URL to GET</dd>
  49.515 -<dt><em>returns</em>:</dt>
  49.516 -<dd><a class="mochiref reference" href="#fn-deferred">Deferred</a> that will callback with the evaluated JSON <a class="footnote-reference" href="#id10" id="id6" name="id6">[4]</a>
  49.517 -response upon successful <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt></dd>
  49.518 -</dl>
  49.519 -</blockquote>
  49.520 -<p>
  49.521 -<a name="fn-sendxmlhttprequest"></a>
  49.522 -<a class="mochidef reference" href="#fn-sendxmlhttprequest">sendXMLHttpRequest(req[, sendContent])</a>:</p>
  49.523 -<blockquote>
  49.524 -<p>Set an <tt class="docutils literal"><span class="pre">onreadystatechange</span></tt> handler on an <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> object
  49.525 -and send it off. Will return a cancellable <a class="mochiref reference" href="#fn-deferred">Deferred</a> that will
  49.526 -callback on success.</p>
  49.527 -<p>Note that currently, only <tt class="docutils literal"><span class="pre">200</span></tt> (OK) and <tt class="docutils literal"><span class="pre">304</span></tt>
  49.528 -(NOT_MODIFIED) are considered success codes at this time, other
  49.529 -status codes will result in an errback with an <tt class="docutils literal"><span class="pre">XMLHttpRequestError</span></tt>.</p>
  49.530 -<dl class="docutils">
  49.531 -<dt><tt class="docutils literal"><span class="pre">req</span></tt>:</dt>
  49.532 -<dd>An preconfigured <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt> object (open has been called).</dd>
  49.533 -<dt><tt class="docutils literal"><span class="pre">sendContent</span></tt>:</dt>
  49.534 -<dd>Optional string or DOM content to send over the <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt>.</dd>
  49.535 -<dt><em>returns</em>:</dt>
  49.536 -<dd><a class="mochiref reference" href="#fn-deferred">Deferred</a> that will callback with the <tt class="docutils literal"><span class="pre">XMLHttpRequest</span></tt>
  49.537 -instance on success.</dd>
  49.538 -</dl>
  49.539 -</blockquote>
  49.540 -<p>
  49.541 -<a name="fn-succeed"></a>
  49.542 -<a class="mochidef reference" href="#fn-succeed">succeed([result])</a>:</p>
  49.543 -<blockquote>
  49.544 -<p>Return a <a class="mochiref reference" href="#fn-deferred">Deferred</a> that has already had <tt class="docutils literal"><span class="pre">.callback(result)</span></tt>
  49.545 -called.</p>
  49.546 -<p>This is useful when you're writing synchronous code to an asynchronous
  49.547 -interface: i.e., some code is calling you expecting a <a class="mochiref reference" href="#fn-deferred">Deferred</a>
  49.548 -result, but you don't actually need to do anything asynchronous. Just
  49.549 -return <tt class="docutils literal"><span class="pre">succeed(theResult)</span></tt>.</p>
  49.550 -<p>See <tt class="docutils literal"><span class="pre">fail</span></tt> for a version of this function that uses a failing
  49.551 -<a class="mochiref reference" href="#fn-deferred">Deferred</a> rather than a successful one.</p>
  49.552 -<dl class="docutils">
  49.553 -<dt><tt class="docutils literal"><span class="pre">result</span></tt>:</dt>
  49.554 -<dd>The result to give to <a class="mochiref reference" href="#fn-deferred.prototype.callback">Deferred.prototype.callback(result)</a></dd>
  49.555 -<dt><em>returns</em>:</dt>
  49.556 -<dd>a <tt class="docutils literal"><span class="pre">new</span></tt> <a class="mochiref reference" href="#fn-deferred">Deferred</a></dd>
  49.557 -</dl>
  49.558 -</blockquote>
  49.559 -<p>
  49.560 -<a name="fn-wait"></a>
  49.561 -<a class="mochidef reference" href="#fn-wait">wait(seconds[, res])</a>:</p>
  49.562 -<blockquote>
  49.563 -Return a new cancellable <a class="mochiref reference" href="#fn-deferred">Deferred</a> that will <tt class="docutils literal"><span class="pre">.callback(res)</span></tt>
  49.564 -after at least <tt class="docutils literal"><span class="pre">seconds</span></tt> seconds have elapsed.</blockquote>
  49.565 -</div>
  49.566 -</div>
  49.567 -<div class="section">
  49.568 -<h1><a id="see-also" name="see-also">See Also</a></h1>
  49.569 -<table class="docutils footnote" frame="void" id="id7" rules="none">
  49.570 -<colgroup><col class="label" /><col /></colgroup>
  49.571 -<tbody valign="top">
  49.572 -<tr><td class="label"><a class="fn-backref" href="#id1" name="id7">[1]</a></td><td>AJAX, Asynchronous JavaScript and XML: <a class="reference" href="http://en.wikipedia.org/wiki/AJAX">http://en.wikipedia.org/wiki/AJAX</a></td></tr>
  49.573 -</tbody>
  49.574 -</table>
  49.575 -<table class="docutils footnote" frame="void" id="id8" rules="none">
  49.576 -<colgroup><col class="label" /><col /></colgroup>
  49.577 -<tbody valign="top">
  49.578 -<tr><td class="label"><a class="fn-backref" href="#id2" name="id8">[2]</a></td><td>Twisted, an event-driven networking framework written in Python: <a class="reference" href="http://twistedmatrix.com/">http://twistedmatrix.com/</a></td></tr>
  49.579 -</tbody>
  49.580 -</table>
  49.581 -<table class="docutils footnote" frame="void" id="id9" rules="none">
  49.582 -<colgroup><col class="label" /><col /></colgroup>
  49.583 -<tbody valign="top">
  49.584 -<tr><td class="label"><a class="fn-backref" href="#id3" name="id9">[3]</a></td><td>Twisted Deferred Reference: <a class="reference" href="http://twistedmatrix.com/projects/core/documentation/howto/defer.html">http://twistedmatrix.com/projects/core/documentation/howto/defer.html</a></td></tr>
  49.585 -</tbody>
  49.586 -</table>
  49.587 -<table class="docutils footnote" frame="void" id="id10" rules="none">
  49.588 -<colgroup><col class="label" /><col /></colgroup>
  49.589 -<tbody valign="top">
  49.590 -<tr><td class="label"><a name="id10">[4]</a></td><td><em>(<a class="fn-backref" href="#id4">1</a>, <a class="fn-backref" href="#id5">2</a>, <a class="fn-backref" href="#id6">3</a>)</em> JSON, JavaScript Object Notation: <a class="reference" href="http://json.org/">http://json.org/</a></td></tr>
  49.591 -</tbody>
  49.592 -</table>
  49.593 -</div>
  49.594 -<div class="section">
  49.595 -<h1><a id="authors" name="authors">Authors</a></h1>
  49.596 -<ul class="simple">
  49.597 -<li>Bob Ippolito &lt;<a class="reference" href="mailto:bob&#64;redivi.com">bob&#64;redivi.com</a>&gt;</li>
  49.598 -</ul>
  49.599 -</div>
  49.600 -<div class="section">
  49.601 -<h1><a id="copyright" name="copyright">Copyright</a></h1>
  49.602 -<p>Copyright 2005 Bob Ippolito &lt;<a class="reference" href="mailto:bob&#64;redivi.com">bob&#64;redivi.com</a>&gt;. This program is dual-licensed
  49.603 -free software; you can redistribute it and/or modify it under the terms of the
  49.604 -<a class="reference" href="http://www.opensource.org/licenses/mit-license.php">MIT License</a> or the <a class="reference" href="http://www.opensource.org/licenses/afl-2.1.php">Academic Free License v2.1</a>.</p>
  49.605 -</div>
  49.606 -</div>
  49.607 -
  49.608 -</body>
  49.609 -</html>
    50.1 --- a/pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/Base.html	Mon Apr 13 12:51:06 2009 +0200
    50.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.3 @@ -1,1239 +0,0 @@
    50.4 -<?xml version="1.0" encoding="utf-8" ?>
    50.5 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    50.6 -
    50.7 -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    50.8 -<head>
    50.9 -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   50.10 -<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
   50.11 -<title>MochiKit.Base - functional programming and useful comparisons</title>
   50.12 -
   50.13 -<link rel="stylesheet" href="../../../include/css/documentation.css" type="text/css" />
   50.14 -<script type="text/javascript" src="../../../packed/lib/MochiKit/MochiKit.js"></script>
   50.15 -<script type="text/javascript" src="../../js/toc.js"></script>
   50.16 -</head>
   50.17 -<body>
   50.18 -<div class="document">
   50.19 -<div class="section">
   50.20 -<h1><a id="name" name="name">Name</a></h1>
   50.21 -<p>MochiKit.Base - functional programming and useful comparisons</p>
   50.22 -</div>
   50.23 -<div class="section">
   50.24 -<h1><a id="synopsis" name="synopsis">Synopsis</a></h1>
   50.25 -<pre class="literal-block">
   50.26 -myObjectRepr = function () {
   50.27 -    // gives a nice, stable string representation for objects,
   50.28 -    // ignoring any methods
   50.29 -    var keyValuePairs = [];
   50.30 -    for (var k in this) {
   50.31 -        var v = this[k];
   50.32 -        if (typeof(v) != 'function') {
   50.33 -            keyValuePairs.push([k, v]);
   50.34 -        }
   50.35 -    };
   50.36 -    keyValuePairs.sort(compare);
   50.37 -    return &quot;{&quot; + map(
   50.38 -        function (pair) {
   50.39 -            return map(repr, pair).join(&quot;:&quot;);
   50.40 -        },
   50.41 -        keyValuePairs
   50.42 -    ).join(&quot;, &quot;) + &quot;}&quot;;
   50.43 -};
   50.44 -
   50.45 -// repr() will look for objects that have a repr method
   50.46 -myObjectArray = [
   50.47 -    {&quot;a&quot;: 3, &quot;b&quot;: 2, &quot;repr&quot;: myObjectRepr},
   50.48 -    {&quot;a&quot;: 1, &quot;b&quot;: 2, &quot;repr&quot;: myObjectRepr}
   50.49 -];
   50.50 -
   50.51 -// sort it by the &quot;a&quot; property, check to see if it matches
   50.52 -myObjectArray.sort(keyComparator(&quot;a&quot;));
   50.53 -expectedRepr = '[{&quot;a&quot;: 1, &quot;b&quot;: 2}, {&quot;a&quot;: 3, &quot;b&quot;: 2}]';
   50.54 -assert( repr(myObjectArray) == expectedRepr );
   50.55 -
   50.56 -// get just the &quot;a&quot; values out into an array
   50.57 -sortedAValues = map(itemgetter(&quot;a&quot;), myObjectArray);
   50.58 -assert( compare(sortedAValues, [1, 3]) == 0 );
   50.59 -
   50.60 -// serialize an array as JSON, unserialize it, expect something equivalent
   50.61 -myArray = [1, 2, &quot;3&quot;, null, undefined];
   50.62 -assert( objEqual(evalJSON(serializeJSON(myArray)), myArray) );
   50.63 -</pre>
   50.64 -</div>
   50.65 -<div class="section">
   50.66 -<h1><a id="description" name="description">Description</a></h1>
   50.67 -<p><a class="mochiref reference" href="Base.html">MochiKit.Base</a> is the foundation for the MochiKit suite.
   50.68 -It provides:</p>
   50.69 -<ul class="simple">
   50.70 -<li>An extensible comparison facility
   50.71 -(<a class="mochiref reference" href="#fn-compare">compare</a>, <a class="mochiref reference" href="#fn-registercomparator">registerComparator</a>)</li>
   50.72 -<li>An extensible programmer representation facility
   50.73 -(<a class="mochiref reference" href="#fn-repr">repr</a>, <a class="mochiref reference" href="#fn-registerrepr">registerRepr</a>)</li>
   50.74 -<li>An extensible JSON <a class="footnote-reference" href="#id7" id="id1" name="id1">[1]</a> serialization and evaluation facility
   50.75 -(<a class="mochiref reference" href="#fn-serializejson">serializeJSON</a>, <a class="mochiref reference" href="#fn-evaljson">evalJSON</a>,
   50.76 -<a class="mochiref reference" href="#fn-registerjson">registerJSON</a>)</li>
   50.77 -<li>A simple adaptation facility (<a class="mochiref reference" href="#fn-adapterregistry">AdapterRegistry</a>)</li>
   50.78 -<li>Convenience functions for manipulating objects and Arrays
   50.79 -(<a class="mochiref reference" href="#fn-update">update</a>, <a class="mochiref reference" href="#fn-setdefault">setdefault</a>, <a class="mochiref reference" href="#fn-extend">extend</a>, etc.)</li>
   50.80 -<li>Array-based functional programming
   50.81 -(<a class="mochiref reference" href="#fn-map">map</a>, <a class="mochiref reference" href="#fn-filter">filter</a>, etc.)</li>
   50.82 -<li>Bound and partially applied functions
   50.83 -(<a class="mochiref reference" href="#fn-bind">bind</a>, <a class="mochiref reference" href="#fn-method">method</a>, <a class="mochiref reference" href="#fn-partial">partial</a>)</li>
   50.84 -</ul>
   50.85 -<p>Python users will feel at home with <a class="mochiref reference" href="Base.html">MochiKit.Base</a>, as the
   50.86 -facilities are quite similar to those available as part of Python and the
   50.87 -Python standard library.</p>
   50.88 -</div>
   50.89 -<div class="section">
   50.90 -<h1><a id="dependencies" name="dependencies">Dependencies</a></h1>
   50.91 -<p>None.</p>
   50.92 -</div>
   50.93 -<div class="section">
   50.94 -<h1><a id="overview" name="overview">Overview</a></h1>
   50.95 -<div class="section">
   50.96 -<h2><a id="comparison" name="comparison">Comparison</a></h2>
   50.97 -<p>The comparators (operators for comparison) in JavaScript are deeply broken,
   50.98 -and it is not possible to teach them new tricks.</p>
   50.99 -<p>MochiKit exposes an extensible comparison facility as a simple
  50.100 -<a class="mochiref reference" href="#fn-compare">compare(a, b)</a> function, which should be used in lieu of
  50.101 -JavaScript's operators whenever comparing objects other than numbers
  50.102 -or strings (though you can certainly use <a class="mochiref reference" href="#fn-compare">compare</a> for those, too!).</p>
  50.103 -<p>The <a class="mochiref reference" href="#fn-compare">compare</a> function has the same signature and return value as a
  50.104 -sort function for <tt class="docutils literal"><span class="pre">Array.prototype.sort</span></tt>, and is often used in that context.</p>
  50.105 -<p>Defining new comparators for the <a class="mochiref reference" href="#fn-compare">compare</a> function to use is done
  50.106 -by adding an entry to its <a class="mochiref reference" href="#fn-adapterregistry">AdapterRegistry</a> with the
  50.107 -<a class="mochiref reference" href="#fn-registercomparator">registerComparator</a> function.</p>
  50.108 -</div>
  50.109 -<div class="section">
  50.110 -<h2><a id="programmer-representation" name="programmer-representation">Programmer Representation</a></h2>
  50.111 -<p>JavaScript's default representation mechanism, <tt class="docutils literal"><span class="pre">toString</span></tt>, is notorious
  50.112 -for having terrible default behavior. It's also very unwise to change that
  50.113 -default, as other JavaScript code you may be using may depend on it.</p>
  50.114 -<p>It's also useful to separate the concept of a &quot;string representation&quot; and a
  50.115 -&quot;string representation for programmers&quot;, much like Python does with its str
  50.116 -and repr protocols.</p>
  50.117 -<p><a class="mochiref reference" href="#fn-repr">repr</a> provides this programmer representation for JavaScript,
  50.118 -in a way that doesn't require object prototype hacking: using an
  50.119 -<a class="mochiref reference" href="#fn-adapterregistry">AdapterRegistry</a>.</p>
  50.120 -<p>Objects that implement the repr protocol can either implement a <tt class="docutils literal"><span class="pre">.repr()</span></tt>
  50.121 -or <tt class="docutils literal"><span class="pre">.__repr__()</span></tt> method, or they can simply have an adapter setup to
  50.122 -generate programmer representations. By default, the registry provides
  50.123 -nice representations for <tt class="docutils literal"><span class="pre">null</span></tt>, <tt class="docutils literal"><span class="pre">undefined</span></tt>, <tt class="docutils literal"><span class="pre">Array</span></tt>, and objects or
  50.124 -functions with a <tt class="docutils literal"><span class="pre">NAME</span></tt> attribute that use the default <tt class="docutils literal"><span class="pre">toString</span></tt>. For
  50.125 -objects that <tt class="docutils literal"><span class="pre">repr</span></tt> doesn't already understand, it simply defaults to
  50.126 -<tt class="docutils literal"><span class="pre">toString</span></tt>, so it will integrate seamlessly with code that implements
  50.127 -the idiomatic JavaScript <tt class="docutils literal"><span class="pre">toString</span></tt> method!</p>
  50.128 -<p>To define a programmer representation for your own objects, simply add
  50.129 -a <tt class="docutils literal"><span class="pre">.repr()</span></tt> or <tt class="docutils literal"><span class="pre">.__repr__()</span></tt> method that returns a string. For
  50.130 -objects that you didn't create (e.g., from a script you didn't write, or a
  50.131 -built-in object), it is instead recommended that you create an adapter
  50.132 -with <a class="mochiref reference" href="#fn-registerrepr">registerRepr</a>.</p>
  50.133 -</div>
  50.134 -<div class="section">
  50.135 -<h2><a id="json-serialization" name="json-serialization">JSON Serialization</a></h2>
  50.136 -<p>JSON <a class="footnote-reference" href="#id7" id="id2" name="id2">[1]</a>, JavaScript Object Notation, is a widely used serialization format
  50.137 -in the context of web development. It's extremely simple, lightweight, and
  50.138 -fast. In its essence, JSON is a restricted subset of JavaScript syntax
  50.139 -suitable for sending over the wire that can be unserialized with a simple
  50.140 -eval. It's often used as an alternative to XML in &quot;AJAX&quot; contexts because it
  50.141 -is compact, fast, and much simpler to use for most purposes.</p>
  50.142 -<p>To create a JSON serialization of any object, simply call
  50.143 -<a class="mochiref reference" href="#fn-serializejson">serializeJSON()</a> with that object. To unserialize a JSON string,
  50.144 -simply call <a class="mochiref reference" href="#fn-evaljson">evalJSON()</a>
  50.145 -with the serialization.</p>
  50.146 -<p>In order of precedence, <a class="mochiref reference" href="#fn-serializejson">serializeJSON</a> coerces the given argument
  50.147 -into a JSON serialization:</p>
  50.148 -<ol class="arabic simple">
  50.149 -<li>Primitive types are returned as their JSON representation:
  50.150 -<tt class="docutils literal"><span class="pre">undefined</span></tt>, <tt class="docutils literal"><span class="pre">string</span></tt>, <tt class="docutils literal"><span class="pre">number</span></tt>, <tt class="docutils literal"><span class="pre">boolean</span></tt>, <tt class="docutils literal"><span class="pre">null</span></tt>.</li>
  50.151 -<li>If the object has a <tt class="docutils literal"><span class="pre">__json__</span></tt> or <tt class="docutils literal"><span class="pre">json</span></tt> method, then it is called
  50.152 -with no arguments. If the result of this method is not the object itself,
  50.153 -then the new object goes through rule processing again (e.g. it may return
  50.154 -a string, which is then serialized in JSON format).</li>
  50.155 -<li>If the object is <tt class="docutils literal"><span class="pre">Array</span></tt>-like (has a <tt class="docutils literal"><span class="pre">length</span></tt> property that is a
  50.156 -number, and is not a function), then it is serialized as a JSON array.
  50.157 -Each element will be processed according to these rules in order.
  50.158 -Elements that can not be serialized (e.g. functions) will be replaced with
  50.159 -<tt class="docutils literal"><span class="pre">undefined</span></tt>.</li>
  50.160 -<li>The <tt class="docutils literal"><span class="pre">jsonRegistry</span></tt> <a class="mochiref reference" href="#fn-adapterregistry">AdapterRegistry</a> is consulted for an
  50.161 -adapter for this object. JSON adapters take one argument (the object),
  50.162 -and are expected to behave like a <tt class="docutils literal"><span class="pre">__json__</span></tt> or <tt class="docutils literal"><span class="pre">json</span></tt> method
  50.163 -(return another object to be serialized, or itself).</li>
  50.164 -<li>If no adapter is available, the object is enumerated and serialized as a
  50.165 -JSON object (name:value pairs). All names are expected to be strings.
  50.166 -Each value is serialized according to these rules, and if it can not be
  50.167 -serialized (e.g. methods), then that name:value pair will be skipped.</li>
  50.168 -</ol>
  50.169 -</div>
  50.170 -<div class="section">
  50.171 -<h2><a id="adapter-registries" name="adapter-registries">Adapter Registries</a></h2>
  50.172 -<p>MochiKit makes extensive use of adapter registries, which enable you to
  50.173 -implement object-specific behaviors for objects that you do not necessarily
  50.174 -want to modify, such as built-in objects. This is especially useful because
  50.175 -JavaScript does not provide a method for hiding user-defined properties from
  50.176 -<tt class="docutils literal"><span class="pre">for</span> <span class="pre">propName</span> <span class="pre">in</span> <span class="pre">obj</span></tt> enumeration.</p>
  50.177 -<p><a class="mochiref reference" href="#fn-adapterregistry">AdapterRegistry</a> is simply an encapsulation for an ordered list of
  50.178 -&quot;check&quot; and &quot;wrap&quot; function pairs. Each <a class="mochiref reference" href="#fn-adapterregistry">AdapterRegistry</a> instance
  50.179 -should perform one function, but may have multiple ways to achieve that
  50.180 -function based upon the arguments. One way to think of it is as a poor man's
  50.181 -generic function, or multiple dispatch (on arbitrary functions, not just type!).</p>
  50.182 -<p>Check functions take one or more arguments, and return <tt class="docutils literal"><span class="pre">true</span></tt> if the
  50.183 -argument list is suitable for the wrap function. Check functions should
  50.184 -perform &quot;cheap&quot; checks of an object's type or contents, before the
  50.185 -&quot;expensive&quot; wrap function is called.</p>
  50.186 -<p>Wrap functions take the same arguments as check functions and do some
  50.187 -operation, such as creating a programmer representation or comparing
  50.188 -both arguments.</p>
  50.189 -</div>
  50.190 -<div class="section">
  50.191 -<h2><a id="convenience-functions" name="convenience-functions">Convenience Functions</a></h2>
  50.192 -<p>Much of <a class="mochiref reference" href="Base.html">MochiKit.Base</a> is there to simply remove the grunt work of
  50.193 -doing generic JavaScript programming.</p>
  50.194 -<p>Need to take every property from one object and set them on another? No
  50.195 -problem, just call <a class="mochiref reference" href="#fn-update">update(dest, src)</a>! What if you just wanted to
  50.196 -update keys that weren't already set? Look no further than
  50.197 -<a class="mochiref reference" href="#fn-setdefault">setdefault(dest, src[, ...])</a>.</p>
  50.198 -<p>Want to return a mutable object, but don't want to suffer the consequences
  50.199 -if the user mutates it? Just <a class="mochiref reference" href="#fn-clone">clone(it)</a> and you'll get a
  50.200 -copy-on-write clone. Cheaper than a copy!</p>
  50.201 -<p>Need to extend an <tt class="docutils literal"><span class="pre">Array</span></tt> with another array? Or even an <tt class="docutils literal"><span class="pre">Array</span></tt>-like
  50.202 -object such as a <tt class="docutils literal"><span class="pre">NodeList</span></tt> or the special <tt class="docutils literal"><span class="pre">arguments</span></tt> object? Even if you
  50.203 -need to skip the first few elements of the source <tt class="docutils literal"><span class="pre">Array</span></tt>-like object, it's
  50.204 -no problem with <a class="mochiref reference" href="#fn-extend">extend(dstArray, srcArrayLike[, skip])</a>!</p>
  50.205 -<p>Wouldn't it be convenient to have all of the JavaScript operators were
  50.206 -available as functions somewhere? That's what the <a class="mochiref reference" href="#fn-operators">operators</a> table
  50.207 -is for, and it even comes with additional operators based on the
  50.208 -<a class="mochiref reference" href="#fn-compare">compare</a> function.</p>
  50.209 -<p>Need to walk some tree of objects and manipulate or find something in it?
  50.210 -A DOM element tree perhaps? Use <a class="mochiref reference" href="#fn-nodewalk">nodeWalk(node, visitor)</a>!</p>
  50.211 -<p>There's plenty more, so check out the <a class="reference" href="#api-reference">API Reference</a> below.</p>
  50.212 -</div>
  50.213 -<div class="section">
  50.214 -<h2><a id="functional-programming" name="functional-programming">Functional Programming</a></h2>
  50.215 -<p>Functional programming constructs such as <a class="mochiref reference" href="#fn-map">map</a> and
  50.216 -<a class="mochiref reference" href="#fn-filter">filter</a> can save you a lot of time, because JavaScript iteration is
  50.217 -error-prone and arduous. Writing less code is the best way to prevent bugs,
  50.218 -and functional programming can help you do that.</p>
  50.219 -<p><a class="mochiref reference" href="Base.html">MochiKit.Base</a> ships with a few simple Array-based functional
  50.220 -programming constructs, namely <a class="mochiref reference" href="#fn-map">map</a> and <a class="mochiref reference" href="#fn-filter">filter</a>, and
  50.221 -their &quot;extended&quot; brethren, <a class="mochiref reference" href="#fn-xmap">xmap</a> and <a class="mochiref reference" href="#fn-xfilter">xfilter</a>.</p>
  50.222 -<p><a class="mochiref reference" href="#fn-map">map(func, arrayLike[, ...])</a> takes a function and an <tt class="docutils literal"><span class="pre">Array</span></tt>-like
  50.223 -object, and creates a new <tt class="docutils literal"><span class="pre">Array</span></tt>. The new <tt class="docutils literal"><span class="pre">Array</span></tt> is the result of
  50.224 -<tt class="docutils literal"><span class="pre">func(element)</span></tt> for every element of <tt class="docutils literal"><span class="pre">arrayLike</span></tt>, much
  50.225 -like the <tt class="docutils literal"><span class="pre">Array.prototype.map</span></tt> extension in Mozilla. However,
  50.226 -<a class="mochiref reference" href="Base.html">MochiKit.Base</a> takes that a step further and gives you the full
  50.227 -blown Python version of <a class="mochiref reference" href="#fn-map">map</a>, which will take several
  50.228 -<tt class="docutils literal"><span class="pre">Array</span></tt>-like objects, and calls the function with one argument per given
  50.229 -<tt class="docutils literal"><span class="pre">Array</span></tt>-like, e.g.:</p>
  50.230 -<pre class="literal-block">
  50.231 -var arrayOne = [1, 2, 3, 4, 5];
  50.232 -var arrayTwo = [1, 5, 2, 4, 3];
  50.233 -var arrayThree = [5, 2, 1, 3, 4];
  50.234 -var biggestElements = map(objMax, arrayOne, arrayTwo, arrayThree);
  50.235 -assert( objEqual(biggestElements, [5, 5, 3, 4, 5]) );
  50.236 -</pre>
  50.237 -<p><a class="mochiref reference" href="#fn-filter">filter(func, arrayLike[, self])</a> takes a function and an
  50.238 -<tt class="docutils literal"><span class="pre">Array</span></tt>-like object, and returns a new <tt class="docutils literal"><span class="pre">Array</span></tt>.
  50.239 -This is basically identical to the <tt class="docutils literal"><span class="pre">Array.prototype.filter</span></tt>
  50.240 -extension in Mozilla. self, if given, will be
  50.241 -used as <tt class="docutils literal"><span class="pre">this</span></tt> in the context of func when called.</p>
  50.242 -<p><a class="mochiref reference" href="#fn-xmap">xmap</a> and <a class="mochiref reference" href="#fn-xfilter">xfilter</a> are just special forms of
  50.243 -<a class="mochiref reference" href="#fn-map">map</a> and <a class="mochiref reference" href="#fn-filter">filter</a> that accept a function as the first
  50.244 -argument, and use the extra arguments as the <tt class="docutils literal"><span class="pre">Array</span></tt>-like. Not terribly
  50.245 -interesting, but a definite time-saver in some cases.</p>
  50.246 -<p>If you appreciate the functional programming facilities here,
  50.247 -you should definitely check out <a class="mochiref reference" href="Iter.html">MochiKit.Iter</a>, which provides
  50.248 -full blown iterators, <a class="mochiref reference" href="Iter.html#fn-range">MochiKit.Iter.range</a>,
  50.249 -<a class="mochiref reference" href="Iter.html#fn-reduce">MochiKit.Iter.reduce</a>, and a near-complete port of Python's
  50.250 -itertools <a class="footnote-reference" href="#id8" id="id3" name="id3">[2]</a> module, with some extra stuff thrown in for good measure!</p>
  50.251 -</div>
  50.252 -<div class="section">
  50.253 -<h2><a id="bound-and-partial-functions" name="bound-and-partial-functions">Bound and Partial Functions</a></h2>
  50.254 -<p>JavaScript's method-calling special form and lack of bound functions (functions
  50.255 -that know what <tt class="docutils literal"><span class="pre">this</span></tt> should be) are one of the first stumbling blocks that
  50.256 -programmers new to JavaScript face. The <a class="mochiref reference" href="#fn-bind">bind(func, self)</a> method
  50.257 -fixes that right up by returning a new function that calls func with the right
  50.258 -<tt class="docutils literal"><span class="pre">this</span></tt>.</p>
  50.259 -<p>In order to take real advantage of all this fancy functional programming stuff,
  50.260 -you're probably going to want partial application. This allows you to create
  50.261 -a new function from an existing function that remembers some of the arguments.
  50.262 -For example, if you wanted to compare a given object to a slew of other
  50.263 -objects, you could do something like this:</p>
  50.264 -<pre class="literal-block">
  50.265 -compareWithOne = partial(compare, 1);
  50.266 -results = map(compareWithOne, [0, 1, 2, 3]);
  50.267 -assert( objEqual(results, [-1, 0, 1, 1]) );
  50.268 -</pre>
  50.269 -<p>One of the better uses of partial functions is in <a class="mochiref reference" href="DOM.html">MochiKit.DOM</a>,
  50.270 -which is certainly a must-see for those of you creating lots of DOM elements
  50.271 -with JavaScript!</p>
  50.272 -</div>
  50.273 -</div>
  50.274 -<div class="section">
  50.275 -<h1><a id="api-reference" name="api-reference">API Reference</a></h1>
  50.276 -<div class="section">
  50.277 -<h2><a id="errors" name="errors">Errors</a></h2>
  50.278 -<p>
  50.279 -<a name="fn-notfound"></a>
  50.280 -<a class="mochidef reference" href="#fn-notfound">NotFound</a>:</p>
  50.281 -<blockquote>
  50.282 -A singleton error raised when no suitable adapter is found</blockquote>
  50.283 -</div>
  50.284 -<div class="section">
  50.285 -<h2><a id="constructors" name="constructors">Constructors</a></h2>
  50.286 -<p>
  50.287 -<a name="fn-adapterregistry"></a>
  50.288 -<a class="mochidef reference" href="#fn-adapterregistry">AdapterRegistry</a>:</p>
  50.289 -<blockquote>
  50.290 -<p>A registry to facilitate adaptation.</p>
  50.291 -<p>All <tt class="docutils literal"><span class="pre">check</span></tt>/<tt class="docutils literal"><span class="pre">wrap</span></tt> function pairs in a given registry
  50.292 -should take the same number of arguments.</p>
  50.293 -</blockquote>
  50.294 -<p>
  50.295 -<a name="fn-adapterregistry.prototype.register"></a>
  50.296 -<a class="mochidef reference" href="#fn-adapterregistry.prototype.register">AdapterRegistry.prototype.register(name, check, wrap[, override])</a>:</p>
  50.297 -<blockquote>
  50.298 -<dl class="docutils">
  50.299 -<dt><tt class="docutils literal"><span class="pre">name</span></tt>:</dt>
  50.300 -<dd>a unique identifier used to identify this adapter so that it
  50.301 -may be unregistered.</dd>
  50.302 -<dt><tt class="docutils literal"><span class="pre">check</span></tt>:</dt>
  50.303 -<dd>function that should return <tt class="docutils literal"><span class="pre">true</span></tt> if the given arguments are
  50.304 -appropriate for the <tt class="docutils literal"><span class="pre">wrap</span></tt> function.</dd>
  50.305 -<dt><tt class="docutils literal"><span class="pre">wrap</span></tt>:</dt>
  50.306 -<dd>function that takes the same parameters as <tt class="docutils literal"><span class="pre">check</span></tt> and does
  50.307 -the adaptation.  Every <tt class="docutils literal"><span class="pre">wrap</span></tt>/<tt class="docutils literal"><span class="pre">check</span></tt> function pair in the
  50.308 -registry should have the same number of arguments.</dd>
  50.309 -<dt><tt class="docutils literal"><span class="pre">override</span></tt>:</dt>
  50.310 -<dd>if <tt class="docutils literal"><span class="pre">true</span></tt>, the <tt class="docutils literal"><span class="pre">check</span></tt> function will be
  50.311 -given highest priority. Otherwise, the lowest.</dd>
  50.312 -</dl>
  50.313 -</blockquote>
  50.314 -<p>
  50.315 -<a name="fn-adapterregistry.prototype.match"></a>
  50.316 -<a class="mochidef reference" href="#fn-adapterregistry.prototype.match">AdapterRegistry.prototype.match(obj[, ...])</a>:</p>
  50.317 -<blockquote>
  50.318 -<p>Find an adapter for the given arguments by calling every
  50.319 -<tt class="docutils literal"><span class="pre">check</span></tt> function until one returns <tt class="docutils literal"><span class="pre">true</span></tt>.</p>
  50.320 -<p>If no suitable adapter is found, throws <a class="mochiref reference" href="#fn-notfound">NotFound</a>.</p>
  50.321 -</blockquote>
  50.322 -<p>
  50.323 -<a name="fn-adapterregistry.prototype.unregister"></a>
  50.324 -<a class="mochidef reference" href="#fn-adapterregistry.prototype.unregister">AdapterRegistry.prototype.unregister(name)</a>:</p>
  50.325 -<blockquote>
  50.326 -Remove a named adapter from the registry</blockquote>
  50.327 -<p>
  50.328 -<a name="fn-namederror"></a>
  50.329 -<a class="mochidef reference" href="#fn-namederror">NamedError</a>:</p>
  50.330 -<blockquote>
  50.331 -Convenience constructor for creating new errors (e.g. <a class="mochiref reference" href="#fn-notfound">NotFound</a>)</blockquote>
  50.332 -</div>
  50.333 -<div class="section">
  50.334 -<h2><a id="functions" name="functions">Functions</a></h2>
  50.335 -<p>
  50.336 -<a name="fn-arrayequal"></a>
  50.337 -<a class="mochidef reference" href="#fn-arrayequal">arrayEqual(self, arr)</a>:</p>
  50.338 -<blockquote>
  50.339 -Compare the arrays <tt class="docutils literal"><span class="pre">self</span></tt> and <tt class="docutils literal"><span class="pre">arr</span></tt> for equality using <tt class="docutils literal"><span class="pre">compare</span></tt>
  50.340 -on each element. Uses a fast-path for length differences.</blockquote>
  50.341 -<p>
  50.342 -<a name="fn-bind"></a>
  50.343 -<a class="mochidef reference" href="#fn-bind">bind(func, self[, arg, ...])</a>:</p>
  50.344 -<blockquote>
  50.345 -<p>Return a copy of <tt class="docutils literal"><span class="pre">func</span></tt> bound to <tt class="docutils literal"><span class="pre">self</span></tt>. This means whenever
  50.346 -and however the returned function is called, <tt class="docutils literal"><span class="pre">this</span></tt> will always
  50.347 -reference the given <tt class="docutils literal"><span class="pre">self</span></tt>. <tt class="docutils literal"><span class="pre">func</span></tt> may be either a function
  50.348 -object, or a string. If it is a string, then <tt class="docutils literal"><span class="pre">self[func]</span></tt> will
  50.349 -be used, making these two statements equivalent:</p>
  50.350 -<pre class="literal-block">
  50.351 -bind(&quot;method&quot;, self);
  50.352 -bind(self.method, self);
  50.353 -</pre>
  50.354 -<p>Calling <a class="mochiref reference" href="#fn-bind">bind(func, self)</a> on an already bound function will
  50.355 -return a new function that is bound to the new <tt class="docutils literal"><span class="pre">self</span></tt>! If
  50.356 -<tt class="docutils literal"><span class="pre">self</span></tt> is <tt class="docutils literal"><span class="pre">undefined</span></tt>, then the previous <tt class="docutils literal"><span class="pre">self</span></tt> is used.
  50.357 -If <tt class="docutils literal"><span class="pre">self</span></tt> is <tt class="docutils literal"><span class="pre">null</span></tt>, then the <tt class="docutils literal"><span class="pre">this</span></tt> object is used
  50.358 -(which may or may not be the global object). To force binding
  50.359 -to the global object, you should pass it explicitly.</p>
  50.360 -<p>Additional arguments, if given, will be partially applied to
  50.361 -the function. These three expressions are equivalent and
  50.362 -return equally efficient functions (<a class="mochiref reference" href="#fn-bind">bind</a> and
  50.363 -<a class="mochiref reference" href="#fn-partial">partial</a> share the same code path):</p>
  50.364 -<ul class="simple">
  50.365 -<li><a class="mochiref reference" href="#fn-bind">bind(oldfunc, self, arg1, arg2)</a></li>
  50.366 -<li><a class="mochiref reference" href="#fn-bind">bind(partial(oldfunc, arg1, arg2), self)</a></li>
  50.367 -<li><a class="mochiref reference" href="#fn-partial">partial(bind(oldfunc, self), arg1, arg2)</a></li>
  50.368 -</ul>
  50.369 -</blockquote>
  50.370 -<p>
  50.371 -<a name="fn-bindmethods"></a>
  50.372 -<a class="mochidef reference" href="#fn-bindmethods">bindMethods(self)</a>:</p>
  50.373 -<blockquote>
  50.374 -Replace all functions <tt class="docutils literal"><span class="pre">meth</span></tt> on <tt class="docutils literal"><span class="pre">self</span></tt> with
  50.375 -<a class="mochiref reference" href="#fn-bind">bind(meth, self)</a>.  This emulates
  50.376 -Python's bound instance methods, where there is no
  50.377 -need to worry about preserving <tt class="docutils literal"><span class="pre">this</span></tt> when the
  50.378 -method is used as a callback.</blockquote>
  50.379 -<p>
  50.380 -<a name="fn-clone"></a>
  50.381 -<a class="mochidef reference" href="#fn-clone">clone(obj)</a>:</p>
  50.382 -<blockquote>
  50.383 -<p>Return a new object using <tt class="docutils literal"><span class="pre">obj</span></tt> as its prototype. Use this
  50.384 -if you want to return a mutable object (e.g. instance state),
  50.385 -but don't want the user to mutate it. If they do, it won't
  50.386 -have any effect on the original <tt class="docutils literal"><span class="pre">obj</span></tt>.</p>
  50.387 -<p>Note that this is a shallow clone, so mutable properties will
  50.388 -have to be cloned separately if you want to &quot;protect&quot; them.</p>
  50.389 -</blockquote>
  50.390 -<p>
  50.391 -<a name="fn-compare"></a>
  50.392 -<a class="mochidef reference" href="#fn-compare">compare(a, b)</a>:</p>
  50.393 -<blockquote>
  50.394 -<p>Compare two objects in a sensible manner. Currently this is:</p>
  50.395 -<ol class="arabic simple">
  50.396 -<li><tt class="docutils literal"><span class="pre">undefined</span></tt> and <tt class="docutils literal"><span class="pre">null</span></tt> compare equal to each other</li>
  50.397 -<li><tt class="docutils literal"><span class="pre">undefined</span></tt> and <tt class="docutils literal"><span class="pre">null</span></tt> are less than anything else</li>
  50.398 -<li>If JavaScript says <tt class="docutils literal"><span class="pre">a</span> <span class="pre">==</span> <span class="pre">b</span></tt>, then we trust it</li>
  50.399 -<li>comparators registered with registerComparator are
  50.400 -used to find a good comparator. Built-in comparators
  50.401 -are currently available for <tt class="docutils literal"><span class="pre">Array</span></tt>-like and <tt class="docutils literal"><span class="pre">Date</span></tt>-like
  50.402 -objects.</li>
  50.403 -<li>Otherwise hope that the built-in comparison operators
  50.404 -do something useful, which should work for numbers
  50.405 -and strings.</li>
  50.406 -<li>If neither <tt class="docutils literal"><span class="pre">a</span> <span class="pre">&lt;</span> <span class="pre">b</span></tt> or <tt class="docutils literal"><span class="pre">a</span> <span class="pre">&gt;</span> <span class="pre">b</span></tt>, then throw a <tt class="docutils literal"><span class="pre">TypeError</span></tt></li>
  50.407 -</ol>
  50.408 -<p>Returns what one would expect from a comparison function:</p>
  50.409 -<table border="1" class="docutils">
  50.410 -<colgroup>
  50.411 -<col width="42%" />
  50.412 -<col width="58%" />
  50.413 -</colgroup>
  50.414 -<tbody valign="top">
  50.415 -<tr><td>Value</td>
  50.416 -<td>Condition</td>
  50.417 -</tr>
  50.418 -<tr><td><tt class="docutils literal"><span class="pre">0</span></tt></td>
  50.419 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">==</span> <span class="pre">b</span></tt></td>
  50.420 -</tr>
  50.421 -<tr><td><tt class="docutils literal"><span class="pre">1</span></tt></td>
  50.422 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">&gt;</span> <span class="pre">b</span></tt></td>
  50.423 -</tr>
  50.424 -<tr><td><tt class="docutils literal"><span class="pre">-1</span></tt></td>
  50.425 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">&lt;</span> <span class="pre">b</span></tt></td>
  50.426 -</tr>
  50.427 -</tbody>
  50.428 -</table>
  50.429 -</blockquote>
  50.430 -<p>
  50.431 -<a name="fn-concat"></a>
  50.432 -<a class="mochidef reference" href="#fn-concat">concat(lst[, ...])</a>:</p>
  50.433 -<blockquote>
  50.434 -<p>Concatenates all given <tt class="docutils literal"><span class="pre">Array</span></tt>-like arguments and returns
  50.435 -a new <tt class="docutils literal"><span class="pre">Array</span></tt>:</p>
  50.436 -<pre class="literal-block">
  50.437 -var lst = concat([&quot;1&quot;,&quot;3&quot;,&quot;5&quot;], [&quot;2&quot;,&quot;4&quot;,&quot;6&quot;]);
  50.438 -assert( lst.toString() == &quot;1,3,5,2,4,6&quot; );
  50.439 -</pre>
  50.440 -</blockquote>
  50.441 -<p>
  50.442 -<a name="fn-counter"></a>
  50.443 -<a class="mochidef reference" href="#fn-counter">counter(n=1)</a>:</p>
  50.444 -<blockquote>
  50.445 -<p>Returns a function that will return a number one greater than
  50.446 -the previous returned value, starting at <tt class="docutils literal"><span class="pre">n</span></tt>. For example:</p>
  50.447 -<pre class="literal-block">
  50.448 -nextId = counter()
  50.449 -assert( nextId() == 1 )
  50.450 -assert( nextId() == 2 )
  50.451 -</pre>
  50.452 -<p>For an iterator with this behavior, see
  50.453 -<a class="mochiref reference" href="Iter.html#fn-count">MochiKit.Iter.count</a>.</p>
  50.454 -</blockquote>
  50.455 -<p>
  50.456 -<a name="fn-extend"></a>
  50.457 -<a class="mochidef reference" href="#fn-extend">extend(self, obj, skip=0)</a>:</p>
  50.458 -<blockquote>
  50.459 -<p>Mutate the array <tt class="docutils literal"><span class="pre">self</span></tt> by extending it with an <tt class="docutils literal"><span class="pre">Array</span></tt>-like
  50.460 -<tt class="docutils literal"><span class="pre">obj</span></tt>, starting from index <tt class="docutils literal"><span class="pre">skip</span></tt>. If <tt class="docutils literal"><span class="pre">null</span></tt> is given
  50.461 -as the initial array, a new one will be created.</p>
  50.462 -<p>This mutates <em>and returns</em> <tt class="docutils literal"><span class="pre">self</span></tt>, be warned.</p>
  50.463 -</blockquote>
  50.464 -<p>
  50.465 -<a name="fn-evaljson"></a>
  50.466 -<a class="mochidef reference" href="#fn-evaljson">evalJSON(aJSONString)</a>:</p>
  50.467 -<blockquote>
  50.468 -<p>Unserialize a JSON <a class="footnote-reference" href="#id7" id="id4" name="id4">[1]</a> represenation of an object.</p>
  50.469 -<p>Note that this uses the <tt class="docutils literal"><span class="pre">eval</span></tt> function of the interpreter, and
  50.470 -therefore trusts the contents of <tt class="docutils literal"><span class="pre">aJSONString</span></tt> to be safe.
  50.471 -This is acceptable when the JSON and JavaScript application
  50.472 -originate from the same server, but in other scenarios it may not be the
  50.473 -appropriate security model. Currently, a validating JSON parser is beyond
  50.474 -the scope of MochiKit, but there is one available from json.org <a class="footnote-reference" href="#id7" id="id5" name="id5">[1]</a>.</p>
  50.475 -</blockquote>
  50.476 -<p>
  50.477 -<a name="fn-filter"></a>
  50.478 -<a class="mochidef reference" href="#fn-filter">filter(fn, lst)</a>:</p>
  50.479 -<blockquote>
  50.480 -<p>Returns a new <tt class="docutils literal"><span class="pre">Array</span></tt> composed of all elements from <tt class="docutils literal"><span class="pre">lst</span></tt> where
  50.481 -<tt class="docutils literal"><span class="pre">fn(lst[i])</span></tt> returns a true value.</p>
  50.482 -<p>If <tt class="docutils literal"><span class="pre">fn</span></tt> is <tt class="docutils literal"><span class="pre">null</span></tt>, <tt class="docutils literal"><span class="pre">operator.truth</span></tt> will be used.</p>
  50.483 -</blockquote>
  50.484 -<p>
  50.485 -<a name="fn-findvalue"></a>
  50.486 -<a class="mochidef reference" href="#fn-findvalue">findValue(lst, value, start=0, end=lst.length)</a>:</p>
  50.487 -<blockquote>
  50.488 -<p>Finds the index of <tt class="docutils literal"><span class="pre">value</span></tt> in the <tt class="docutils literal"><span class="pre">Array</span></tt>-like object <tt class="docutils literal"><span class="pre">lst</span></tt> using
  50.489 -<a class="mochiref reference" href="#fn-compare">compare</a>. The search starts at the index <tt class="docutils literal"><span class="pre">start</span></tt>, and ends
  50.490 -at the index <tt class="docutils literal"><span class="pre">end</span> <span class="pre">-</span> <span class="pre">1</span></tt>. If <tt class="docutils literal"><span class="pre">value</span></tt> is not found in <tt class="docutils literal"><span class="pre">lst</span></tt>, it will
  50.491 -return <tt class="docutils literal"><span class="pre">-1</span></tt>.</p>
  50.492 -<p>For example:</p>
  50.493 -<pre class="literal-block">
  50.494 -assert( findValue([1, 2, 3, 2, 1], 2) == 1 )
  50.495 -assert( findValue([1, 2, 3, 2, 1], 2, 2) == 3 )
  50.496 -</pre>
  50.497 -</blockquote>
  50.498 -<p>
  50.499 -<a name="fn-findidentical"></a>
  50.500 -<a class="mochidef reference" href="#fn-findidentical">findIdentical(lst, value, start=0, end=lst.length)</a>:</p>
  50.501 -<blockquote>
  50.502 -<p>Finds the index of <tt class="docutils literal"><span class="pre">value</span></tt> in the <tt class="docutils literal"><span class="pre">Array</span></tt>-like object <tt class="docutils literal"><span class="pre">lst</span></tt> using
  50.503 -the <tt class="docutils literal"><span class="pre">===</span></tt> operator. The search starts at the index <tt class="docutils literal"><span class="pre">start</span></tt>, and ends
  50.504 -at the index <tt class="docutils literal"><span class="pre">end</span> <span class="pre">-</span> <span class="pre">1</span></tt>. If <tt class="docutils literal"><span class="pre">value</span></tt> is not found in <tt class="docutils literal"><span class="pre">lst</span></tt>, it will
  50.505 -return <tt class="docutils literal"><span class="pre">-1</span></tt>.</p>
  50.506 -<p>You should use this function instead of <a class="mochiref reference" href="#fn-findvalue">findValue</a> if <tt class="docutils literal"><span class="pre">lst</span></tt> may
  50.507 -be comprised of objects for which no comparator is defined and all you care
  50.508 -about is finding an identical object (e.g. the same instance), or if
  50.509 -<tt class="docutils literal"><span class="pre">lst</span></tt> is comprised of just numbers or strings and performance is
  50.510 -important.</p>
  50.511 -<p>For example:</p>
  50.512 -<pre class="literal-block">
  50.513 -assert( findIdentical([1, 2, 3, 2, 1], 2) == 1 )
  50.514 -assert( findIdentical([1, 2, 3, 2, 1], 2, 2) == 3 )
  50.515 -</pre>
  50.516 -</blockquote>
  50.517 -<p>
  50.518 -<a name="fn-flattenarguments"></a>
  50.519 -<a class="mochidef reference" href="#fn-flattenarguments">flattenArguments(arg[, ...])</a>:</p>
  50.520 -<blockquote>
  50.521 -<p>Given a bunch of arguments, return a single <tt class="docutils literal"><span class="pre">Array</span></tt> containing all
  50.522 -of those arguments. Any <tt class="docutils literal"><span class="pre">Array</span></tt> argument will be extended in-place,
  50.523 -e.g.:</p>
  50.524 -<pre class="literal-block">
  50.525 -compare(flattenArguments(1, [2, 3, [4, 5]]), [1, 2, 3, 4, 5]) == 0
  50.526 -</pre>
  50.527 -</blockquote>
  50.528 -<p>
  50.529 -<a name="fn-forwardcall"></a>
  50.530 -<a class="mochidef reference" href="#fn-forwardcall">forwardCall(name)</a>:</p>
  50.531 -<blockquote>
  50.532 -Returns a function that forwards a method call to <tt class="docutils literal"><span class="pre">this.name(...)</span></tt></blockquote>
  50.533 -<p>
  50.534 -<a name="fn-isarraylike"></a>
  50.535 -<a class="mochidef reference" href="#fn-isarraylike">isArrayLike(obj[, ...])</a>:</p>
  50.536 -<blockquote>
  50.537 -Returns <tt class="docutils literal"><span class="pre">true</span></tt> if all given arguments are <tt class="docutils literal"><span class="pre">Array</span></tt>-like (have a
  50.538 -<tt class="docutils literal"><span class="pre">.length</span></tt> property and <tt class="docutils literal"><span class="pre">typeof(obj)</span> <span class="pre">==</span> <span class="pre">'object'</span></tt>)</blockquote>
  50.539 -<p>
  50.540 -<a name="fn-isdatelike"></a>
  50.541 -<a class="mochidef reference" href="#fn-isdatelike">isDateLike(obj[, ...])</a>:</p>
  50.542 -<blockquote>
  50.543 -Returns <tt class="docutils literal"><span class="pre">true</span></tt> if all given arguments are <tt class="docutils literal"><span class="pre">Date</span></tt>-like (have a
  50.544 -<tt class="docutils literal"><span class="pre">.getTime()</span></tt> method)</blockquote>
  50.545 -<p>
  50.546 -<a name="fn-isempty"></a>
  50.547 -<a class="mochidef reference" href="#fn-isempty">isEmpty(obj[, ...])</a>:</p>
  50.548 -<blockquote>
  50.549 -Returns <tt class="docutils literal"><span class="pre">true</span></tt> if all the given <tt class="docutils literal"><span class="pre">Array</span></tt>-like or string arguments
  50.550 -are empty <tt class="docutils literal"><span class="pre">(obj.length</span> <span class="pre">==</span> <span class="pre">0)</span></tt></blockquote>
  50.551 -<p>
  50.552 -<a name="fn-isnotempty"></a>
  50.553 -<a class="mochidef reference" href="#fn-isnotempty">isNotEmpty(obj[, ...])</a>:</p>
  50.554 -<blockquote>
  50.555 -Returns <tt class="docutils literal"><span class="pre">true</span></tt> if all the given <tt class="docutils literal"><span class="pre">Array</span></tt>-like or string arguments
  50.556 -are not empty <tt class="docutils literal"><span class="pre">(obj.length</span> <span class="pre">&gt;</span> <span class="pre">0)</span></tt></blockquote>
  50.557 -<p>
  50.558 -<a name="fn-isnull"></a>
  50.559 -<a class="mochidef reference" href="#fn-isnull">isNull(obj[, ...])</a>:</p>
  50.560 -<blockquote>
  50.561 -Returns <tt class="docutils literal"><span class="pre">true</span></tt> if all arguments are <tt class="docutils literal"><span class="pre">null</span></tt>.</blockquote>
  50.562 -<p>
  50.563 -<a name="fn-isundefinedornull"></a>
  50.564 -<a class="mochidef reference" href="#fn-isundefinedornull">isUndefinedOrNull(obj[, ...])</a>:</p>
  50.565 -<blockquote>
  50.566 -Returns <tt class="docutils literal"><span class="pre">true</span></tt> if all arguments are undefined or <tt class="docutils literal"><span class="pre">null</span></tt></blockquote>
  50.567 -<p>
  50.568 -<a name="fn-itemgetter"></a>
  50.569 -<a class="mochidef reference" href="#fn-itemgetter">itemgetter(name)</a>:</p>
  50.570 -<blockquote>
  50.571 -Returns a <tt class="docutils literal"><span class="pre">function(obj)</span></tt> that returns <tt class="docutils literal"><span class="pre">obj[name]</span></tt></blockquote>
  50.572 -<p>
  50.573 -<a name="fn-items"></a>
  50.574 -<a class="mochidef reference" href="#fn-items">items(obj)</a>:</p>
  50.575 -<blockquote>
  50.576 -Return an <tt class="docutils literal"><span class="pre">Array</span></tt> of <tt class="docutils literal"><span class="pre">[propertyName,</span> <span class="pre">propertyValue]</span></tt> pairs for the
  50.577 -given <tt class="docutils literal"><span class="pre">obj</span></tt> (in the order determined by <tt class="docutils literal"><span class="pre">for</span> <span class="pre">propName</span> <span class="pre">in</span> <span class="pre">obj</span></tt>).</blockquote>
  50.578 -<p>
  50.579 -<a name="fn-keycomparator"></a>
  50.580 -<a class="mochidef reference" href="#fn-keycomparator">keyComparator(key[, ...])</a>:</p>
  50.581 -<blockquote>
  50.582 -<p>A comparator factory that compares <tt class="docutils literal"><span class="pre">a[key]</span></tt> with <tt class="docutils literal"><span class="pre">b[key]</span></tt>.
  50.583 -e.g.:</p>
  50.584 -<pre class="literal-block">
  50.585 -var lst = [&quot;a&quot;, &quot;bbb&quot;, &quot;cc&quot;];
  50.586 -lst.sort(keyComparator(&quot;length&quot;));
  50.587 -assert( lst.toString() == &quot;a,cc,bbb&quot; );
  50.588 -</pre>
  50.589 -</blockquote>
  50.590 -<p>
  50.591 -<a name="fn-keys"></a>
  50.592 -<a class="mochidef reference" href="#fn-keys">keys(obj)</a>:</p>
  50.593 -<blockquote>
  50.594 -Return an <tt class="docutils literal"><span class="pre">Array</span></tt> of the property names of an object
  50.595 -(in the order determined by <tt class="docutils literal"><span class="pre">for</span> <span class="pre">propName</span> <span class="pre">in</span> <span class="pre">obj</span></tt>).</blockquote>
  50.596 -<p>
  50.597 -<a name="fn-listmax"></a>
  50.598 -<a class="mochidef reference" href="#fn-listmax">listMax(lst)</a>:</p>
  50.599 -<blockquote>
  50.600 -Return the largest element of an <tt class="docutils literal"><span class="pre">Array</span></tt>-like object, as determined
  50.601 -by <a class="mochiref reference" href="#fn-compare">compare</a>. This is a special form of <a class="mochiref reference" href="#fn-listminmax">listMinMax</a>,
  50.602 -specifically <a class="mochiref reference" href="#fn-partial">partial(listMinMax, 1)</a>.</blockquote>
  50.603 -<p>
  50.604 -<a name="fn-listmin"></a>
  50.605 -<a class="mochidef reference" href="#fn-listmin">listMin(lst)</a>:</p>
  50.606 -<blockquote>
  50.607 -Return the smallest element of an <tt class="docutils literal"><span class="pre">Array</span></tt>-like object, as determined
  50.608 -by <a class="mochiref reference" href="#fn-compare">compare</a>. This is a special form of <a class="mochiref reference" href="#fn-listminmax">listMinMax</a>,
  50.609 -specifically <a class="mochiref reference" href="#fn-partial">partial(listMinMax, -1)</a>.</blockquote>
  50.610 -<p>
  50.611 -<a name="fn-listminmax"></a>
  50.612 -<a class="mochidef reference" href="#fn-listminmax">listMinMax(which, lst)</a>:</p>
  50.613 -<blockquote>
  50.614 -<p>If <tt class="docutils literal"><span class="pre">which</span> <span class="pre">==</span> <span class="pre">-1</span></tt> then it will return the smallest
  50.615 -element of the <tt class="docutils literal"><span class="pre">Array</span></tt>-like <tt class="docutils literal"><span class="pre">lst</span></tt>. This is also available
  50.616 -as <a class="mochiref reference" href="#fn-listmin">listMin(lst)</a>.</p>
  50.617 -<p>If <tt class="docutils literal"><span class="pre">which</span> <span class="pre">==</span> <span class="pre">1</span></tt> then it will return the largest
  50.618 -element of the <tt class="docutils literal"><span class="pre">Array</span></tt>-like <tt class="docutils literal"><span class="pre">lst</span></tt>. This is also available
  50.619 -as <a class="mochiref reference" href="#fn-listmax">listMax(list)</a>.</p>
  50.620 -</blockquote>
  50.621 -<p>
  50.622 -<a name="fn-map"></a>
  50.623 -<a class="mochidef reference" href="#fn-map">map(fn, lst[, ...])</a>:</p>
  50.624 -<blockquote>
  50.625 -<p>Return a new array composed of the results of <tt class="docutils literal"><span class="pre">fn(x)</span></tt> for every <tt class="docutils literal"><span class="pre">x</span></tt>
  50.626 -in <tt class="docutils literal"><span class="pre">lst</span></tt>.</p>
  50.627 -<p>If <tt class="docutils literal"><span class="pre">fn</span></tt> is <tt class="docutils literal"><span class="pre">null</span></tt>, and only one sequence argument is given the
  50.628 -identity function is used.</p>
  50.629 -<blockquote>
  50.630 -<a class="mochiref reference" href="#fn-map">map(null, lst)</a> -&gt; <tt class="docutils literal"><span class="pre">lst.slice()</span></tt>;</blockquote>
  50.631 -<p>If <tt class="docutils literal"><span class="pre">fn</span></tt> is <tt class="docutils literal"><span class="pre">null</span></tt>, and more than one sequence is given as arguments,
  50.632 -then the <tt class="docutils literal"><span class="pre">Array</span></tt> function is used, making it equivalent to
  50.633 -<a class="mochiref reference" href="#fn-zip">zip</a>.</p>
  50.634 -<blockquote>
  50.635 -<dl class="docutils">
  50.636 -<dt><a class="mochiref reference" href="#fn-map">map(null, p, q, ...)</a></dt>
  50.637 -<dd>-&gt; <a class="mochiref reference" href="#fn-zip">zip(p, q, ...)</a>
  50.638 --&gt; <tt class="docutils literal"><span class="pre">[[p0,</span> <span class="pre">q0,</span> <span class="pre">...],</span> <span class="pre">[p1,</span> <span class="pre">q1,</span> <span class="pre">...],</span> <span class="pre">...];</span></tt></dd>
  50.639 -</dl>
  50.640 -</blockquote>
  50.641 -</blockquote>
  50.642 -<p>
  50.643 -<a name="fn-merge"></a>
  50.644 -<a class="mochidef reference" href="#fn-merge">merge(obj[, ...])</a>:</p>
  50.645 -<blockquote>
  50.646 -<p>Create a new instance of <tt class="docutils literal"><span class="pre">Object</span></tt> that contains every property
  50.647 -from all given objects. If a property is defined on more than
  50.648 -one of the objects, the last property is used.</p>
  50.649 -<p>This is a special form of <a class="mochiref reference" href="#fn-update">update(self, obj[, ...])</a>,
  50.650 -specifically, it is defined as <a class="mochiref reference" href="#fn-partial">partial(update, null)</a>.</p>
  50.651 -</blockquote>
  50.652 -<p>
  50.653 -<a name="fn-method"></a>
  50.654 -<a class="mochidef reference" href="#fn-method">method(self, func, ...)</a>:</p>
  50.655 -<blockquote>
  50.656 -<p>Alternate form of <a class="mochiref reference" href="#fn-bind">bind</a> that takes the object before the
  50.657 -function. These two calls are equivalent:</p>
  50.658 -<pre class="literal-block">
  50.659 -bind(&quot;method&quot;, myobject)
  50.660 -method(myobject, &quot;method&quot;)
  50.661 -</pre>
  50.662 -</blockquote>
  50.663 -<p>
  50.664 -<a name="fn-namefunctions"></a>
  50.665 -<a class="mochidef reference" href="#fn-namefunctions">nameFunctions(namespace)</a>:</p>
  50.666 -<blockquote>
  50.667 -<p>Given a <tt class="docutils literal"><span class="pre">namespace</span></tt> (object or function) with a <tt class="docutils literal"><span class="pre">NAME</span></tt> property,
  50.668 -find all methods in it and give them nice <tt class="docutils literal"><span class="pre">NAME</span></tt> properties too
  50.669 -(for use with <a class="mochiref reference" href="#fn-repr">repr</a>). e.g.:</p>
  50.670 -<pre class="literal-block">
  50.671 -namespace = {
  50.672 -    NAME: &quot;Awesome&quot;,
  50.673 -    Dude: function () {}
  50.674 -}
  50.675 -nameFunctions(namespace);
  50.676 -assert( namespace.Dude.NAME == 'Awesome.Dude' );
  50.677 -</pre>
  50.678 -</blockquote>
  50.679 -<p>
  50.680 -<a name="fn-objequal"></a>
  50.681 -<a class="mochidef reference" href="#fn-objequal">objEqual(a, b)</a>:</p>
  50.682 -<blockquote>
  50.683 -Return <tt class="docutils literal"><span class="pre">true</span></tt> if <tt class="docutils literal"><span class="pre">compare(a,</span> <span class="pre">b)</span> <span class="pre">==</span> <span class="pre">0</span></tt></blockquote>
  50.684 -<p>
  50.685 -<a name="fn-nodewalk"></a>
  50.686 -<a class="mochidef reference" href="#fn-nodewalk">nodeWalk(node, visitor)</a>:</p>
  50.687 -<blockquote>
  50.688 -<p>Non-recursive generic node walking function (e.g. for a DOM).</p>
  50.689 -<p>The walk order for nodeWalk is breadth first, meaning that all
  50.690 -siblings will be visited before any children.</p>
  50.691 -<dl class="docutils">
  50.692 -<dt><tt class="docutils literal"><span class="pre">node</span></tt>:</dt>
  50.693 -<dd>The initial node to be searched.</dd>
  50.694 -<dt><tt class="docutils literal"><span class="pre">visitor</span></tt>:</dt>
  50.695 -<dd>The visitor function, will be called as
  50.696 -<tt class="docutils literal"><span class="pre">visitor(node)</span></tt>, and should return an <tt class="docutils literal"><span class="pre">Array</span></tt>-like
  50.697 -of nodes to be searched next (e.g. <tt class="docutils literal"><span class="pre">node.childNodes</span></tt>).
  50.698 -Leaf nodes may return <tt class="docutils literal"><span class="pre">null</span></tt> or <tt class="docutils literal"><span class="pre">undefined</span></tt>.</dd>
  50.699 -</dl>
  50.700 -</blockquote>
  50.701 -<p>
  50.702 -<a name="fn-objmax"></a>
  50.703 -<a class="mochidef reference" href="#fn-objmax">objMax(obj[, ...])</a>:</p>
  50.704 -<blockquote>
  50.705 -Return the maximum object according to <a class="mochiref reference" href="#fn-compare">compare</a> out
  50.706 -of the given arguments. This is similar to <a class="mochiref reference" href="#fn-listmax">listMax</a>,
  50.707 -except is uses the arguments instead of a given <tt class="docutils literal"><span class="pre">Array</span></tt>-like.</blockquote>
  50.708 -<p>
  50.709 -<a name="fn-objmin"></a>
  50.710 -<a class="mochidef reference" href="#fn-objmin">objMin(obj[, ...])</a>:</p>
  50.711 -<blockquote>
  50.712 -Return the minimum object according to <a class="mochiref reference" href="#fn-compare">compare</a>
  50.713 -out of the given arguments. This is similar to
  50.714 -<a class="mochiref reference" href="#fn-listmin">listMin</a>, except it uses the arguments instead of a
  50.715 -given <tt class="docutils literal"><span class="pre">Array</span></tt>-like.</blockquote>
  50.716 -<p>
  50.717 -<a name="fn-operator"></a>
  50.718 -<a class="mochidef reference" href="#fn-operator">operator</a>:</p>
  50.719 -<blockquote>
  50.720 -<p>A table of JavaScript's operators for usage with <a class="mochiref reference" href="#fn-map">map</a>,
  50.721 -<a class="mochiref reference" href="#fn-filter">filter</a>, etc.</p>
  50.722 -<p>Unary Logic Operators:</p>
  50.723 -<blockquote>
  50.724 -<table border="1" class="docutils">
  50.725 -<colgroup>
  50.726 -<col width="31%" />
  50.727 -<col width="40%" />
  50.728 -<col width="29%" />
  50.729 -</colgroup>
  50.730 -<thead valign="bottom">
  50.731 -<tr><th class="head">Operator</th>
  50.732 -<th class="head">Implementation</th>
  50.733 -<th class="head">Description</th>
  50.734 -</tr>
  50.735 -</thead>
  50.736 -<tbody valign="top">
  50.737 -<tr><td><tt class="docutils literal"><span class="pre">truth(a)</span></tt></td>
  50.738 -<td><tt class="docutils literal"><span class="pre">!!a</span></tt></td>
  50.739 -<td>Logical truth</td>
  50.740 -</tr>
  50.741 -<tr><td><tt class="docutils literal"><span class="pre">lognot(a)</span></tt></td>
  50.742 -<td><tt class="docutils literal"><span class="pre">!a</span></tt></td>
  50.743 -<td>Logical not</td>
  50.744 -</tr>
  50.745 -<tr><td><tt class="docutils literal"><span class="pre">identity(a)</span></tt></td>
  50.746 -<td><tt class="docutils literal"><span class="pre">a</span></tt></td>
  50.747 -<td>Logical identity</td>
  50.748 -</tr>
  50.749 -</tbody>
  50.750 -</table>
  50.751 -</blockquote>
  50.752 -<p>Unary Math Operators:</p>
  50.753 -<blockquote>
  50.754 -<table border="1" class="docutils">
  50.755 -<colgroup>
  50.756 -<col width="33%" />
  50.757 -<col width="43%" />
  50.758 -<col width="25%" />
  50.759 -</colgroup>
  50.760 -<thead valign="bottom">
  50.761 -<tr><th class="head">Operator</th>
  50.762 -<th class="head">Implementation</th>
  50.763 -<th class="head">Description</th>
  50.764 -</tr>
  50.765 -</thead>
  50.766 -<tbody valign="top">
  50.767 -<tr><td><tt class="docutils literal"><span class="pre">not(a)</span></tt></td>
  50.768 -<td><tt class="docutils literal"><span class="pre">~a</span></tt></td>
  50.769 -<td>Bitwise not</td>
  50.770 -</tr>
  50.771 -<tr><td><tt class="docutils literal"><span class="pre">neg(a)</span></tt></td>
  50.772 -<td><tt class="docutils literal"><span class="pre">-a</span></tt></td>
  50.773 -<td>Negation</td>
  50.774 -</tr>
  50.775 -</tbody>
  50.776 -</table>
  50.777 -</blockquote>
  50.778 -<p>Binary Operators:</p>
  50.779 -<blockquote>
  50.780 -<table border="1" class="docutils">
  50.781 -<colgroup>
  50.782 -<col width="28%" />
  50.783 -<col width="28%" />
  50.784 -<col width="45%" />
  50.785 -</colgroup>
  50.786 -<thead valign="bottom">
  50.787 -<tr><th class="head">Operator</th>
  50.788 -<th class="head">Implementation</th>
  50.789 -<th class="head">Description</th>
  50.790 -</tr>
  50.791 -</thead>
  50.792 -<tbody valign="top">
  50.793 -<tr><td><tt class="docutils literal"><span class="pre">add(a,</span> <span class="pre">b)</span></tt></td>
  50.794 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">+</span> <span class="pre">b</span></tt></td>
  50.795 -<td>Addition</td>
  50.796 -</tr>
  50.797 -<tr><td><tt class="docutils literal"><span class="pre">sub(a,</span> <span class="pre">b)</span></tt></td>
  50.798 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">-</span> <span class="pre">b</span></tt></td>
  50.799 -<td>Subtraction</td>
  50.800 -</tr>
  50.801 -<tr><td><tt class="docutils literal"><span class="pre">div(a,</span> <span class="pre">b)</span></tt></td>
  50.802 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">/</span> <span class="pre">b</span></tt></td>
  50.803 -<td>Division</td>
  50.804 -</tr>
  50.805 -<tr><td><tt class="docutils literal"><span class="pre">mod(a,</span> <span class="pre">b)</span></tt></td>
  50.806 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">%</span> <span class="pre">b</span></tt></td>
  50.807 -<td>Modulus</td>
  50.808 -</tr>
  50.809 -<tr><td><tt class="docutils literal"><span class="pre">mul(a,</span> <span class="pre">b)</span></tt></td>
  50.810 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">*</span> <span class="pre">b</span></tt></td>
  50.811 -<td>Multiplication</td>
  50.812 -</tr>
  50.813 -<tr><td><tt class="docutils literal"><span class="pre">and(a,</span> <span class="pre">b)</span></tt></td>
  50.814 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">&amp;</span> <span class="pre">b</span></tt></td>
  50.815 -<td>Bitwise and</td>
  50.816 -</tr>
  50.817 -<tr><td><tt class="docutils literal"><span class="pre">or(a,</span> <span class="pre">b)</span></tt></td>
  50.818 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">|</span> <span class="pre">b</span></tt></td>
  50.819 -<td>Bitwise or</td>
  50.820 -</tr>
  50.821 -<tr><td><tt class="docutils literal"><span class="pre">xor(a,</span> <span class="pre">b)</span></tt></td>
  50.822 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">^</span> <span class="pre">b</span></tt></td>
  50.823 -<td>Bitwise exclusive or</td>
  50.824 -</tr>
  50.825 -<tr><td><tt class="docutils literal"><span class="pre">lshift(a,</span> <span class="pre">b)</span></tt></td>
  50.826 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">&lt;&lt;</span> <span class="pre">b</span></tt></td>
  50.827 -<td>Bitwise left shift</td>
  50.828 -</tr>
  50.829 -<tr><td><tt class="docutils literal"><span class="pre">rshift(a,</span> <span class="pre">b)</span></tt></td>
  50.830 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">&gt;&gt;</span> <span class="pre">b</span></tt></td>
  50.831 -<td>Bitwise signed right shift</td>
  50.832 -</tr>
  50.833 -<tr><td><tt class="docutils literal"><span class="pre">zrshfit(a,</span> <span class="pre">b)</span></tt></td>
  50.834 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">&gt;&gt;&gt;</span> <span class="pre">b</span></tt></td>
  50.835 -<td>Bitwise unsigned right shift</td>
  50.836 -</tr>
  50.837 -</tbody>
  50.838 -</table>
  50.839 -</blockquote>
  50.840 -<p>Built-in Comparators:</p>
  50.841 -<blockquote>
  50.842 -<table border="1" class="docutils">
  50.843 -<colgroup>
  50.844 -<col width="25%" />
  50.845 -<col width="31%" />
  50.846 -<col width="44%" />
  50.847 -</colgroup>
  50.848 -<thead valign="bottom">
  50.849 -<tr><th class="head">Operator</th>
  50.850 -<th class="head">Implementation</th>
  50.851 -<th class="head">Description</th>
  50.852 -</tr>
  50.853 -</thead>
  50.854 -<tbody valign="top">
  50.855 -<tr><td><tt class="docutils literal"><span class="pre">eq(a,</span> <span class="pre">b)</span></tt></td>
  50.856 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">==</span> <span class="pre">b</span></tt></td>
  50.857 -<td>Equals</td>
  50.858 -</tr>
  50.859 -<tr><td><tt class="docutils literal"><span class="pre">ne(a,</span> <span class="pre">b)</span></tt></td>
  50.860 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">!=</span> <span class="pre">b</span></tt></td>
  50.861 -<td>Not equals</td>
  50.862 -</tr>
  50.863 -<tr><td><tt class="docutils literal"><span class="pre">gt(a,</span> <span class="pre">b)</span></tt></td>
  50.864 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">&gt;</span> <span class="pre">b</span></tt></td>
  50.865 -<td>Greater than</td>
  50.866 -</tr>
  50.867 -<tr><td><tt class="docutils literal"><span class="pre">ge(a,</span> <span class="pre">b)</span></tt></td>
  50.868 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">&gt;=</span> <span class="pre">b</span></tt></td>
  50.869 -<td>Greater than or equal to</td>
  50.870 -</tr>
  50.871 -<tr><td><tt class="docutils literal"><span class="pre">lt(a,</span> <span class="pre">b)</span></tt></td>
  50.872 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">&lt;</span> <span class="pre">b</span></tt></td>
  50.873 -<td>Less than</td>
  50.874 -</tr>
  50.875 -<tr><td><tt class="docutils literal"><span class="pre">le(a,</span> <span class="pre">b)</span></tt></td>
  50.876 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">&lt;=</span> <span class="pre">b</span></tt></td>
  50.877 -<td>Less than or equal to</td>
  50.878 -</tr>
  50.879 -</tbody>
  50.880 -</table>
  50.881 -</blockquote>
  50.882 -<p>Extended Comparators (uses <a class="mochiref reference" href="#fn-compare">compare</a>):</p>
  50.883 -<blockquote>
  50.884 -<table border="1" class="docutils">
  50.885 -<colgroup>
  50.886 -<col width="22%" />
  50.887 -<col width="39%" />
  50.888 -<col width="39%" />
  50.889 -</colgroup>
  50.890 -<thead valign="bottom">
  50.891 -<tr><th class="head">Operator</th>
  50.892 -<th class="head">Implementation</th>
  50.893 -<th class="head">Description</th>
  50.894 -</tr>
  50.895 -</thead>
  50.896 -<tbody valign="top">
  50.897 -<tr><td><tt class="docutils literal"><span class="pre">ceq(a,</span> <span class="pre">b)</span></tt></td>
  50.898 -<td><tt class="docutils literal"><span class="pre">compare(a,</span> <span class="pre">b)</span> <span class="pre">==</span> <span class="pre">0</span></tt></td>
  50.899 -<td>Equals</td>
  50.900 -</tr>
  50.901 -<tr><td><tt class="docutils literal"><span class="pre">cne(a,</span> <span class="pre">b)</span></tt></td>
  50.902 -<td><tt class="docutils literal"><span class="pre">compare(a,</span> <span class="pre">b)</span> <span class="pre">!=</span> <span class="pre">0</span></tt></td>
  50.903 -<td>Not equals</td>
  50.904 -</tr>
  50.905 -<tr><td><tt class="docutils literal"><span class="pre">cgt(a,</span> <span class="pre">b)</span></tt></td>
  50.906 -<td><tt class="docutils literal"><span class="pre">compare(a,</span> <span class="pre">b)</span> <span class="pre">==</span> <span class="pre">1</span></tt></td>
  50.907 -<td>Greater than</td>
  50.908 -</tr>
  50.909 -<tr><td><tt class="docutils literal"><span class="pre">cge(a,</span> <span class="pre">b)</span></tt></td>
  50.910 -<td><tt class="docutils literal"><span class="pre">compare(a,</span> <span class="pre">b)</span> <span class="pre">!=</span> <span class="pre">-1</span></tt></td>
  50.911 -<td>Greater than or equal to</td>
  50.912 -</tr>
  50.913 -<tr><td><tt class="docutils literal"><span class="pre">clt(a,</span> <span class="pre">b)</span></tt></td>
  50.914 -<td><tt class="docutils literal"><span class="pre">compare(a,</span> <span class="pre">b)</span> <span class="pre">==</span> <span class="pre">-1</span></tt></td>
  50.915 -<td>Less than</td>
  50.916 -</tr>
  50.917 -<tr><td><tt class="docutils literal"><span class="pre">cle(a,</span> <span class="pre">b)</span></tt></td>
  50.918 -<td><tt class="docutils literal"><span class="pre">compare(a,</span> <span class="pre">b)</span> <span class="pre">!=</span> <span class="pre">1</span></tt></td>
  50.919 -<td>Less than or equal to</td>
  50.920 -</tr>
  50.921 -</tbody>
  50.922 -</table>
  50.923 -</blockquote>
  50.924 -<p>Binary Logical Operators:</p>
  50.925 -<blockquote>
  50.926 -<table border="1" class="docutils">
  50.927 -<colgroup>
  50.928 -<col width="33%" />
  50.929 -<col width="28%" />
  50.930 -<col width="39%" />
  50.931 -</colgroup>
  50.932 -<thead valign="bottom">
  50.933 -<tr><th class="head">Operator</th>
  50.934 -<th class="head">Implementation</th>
  50.935 -<th class="head">Description</th>
  50.936 -</tr>
  50.937 -</thead>
  50.938 -<tbody valign="top">
  50.939 -<tr><td><tt class="docutils literal"><span class="pre">logand(a,</span> <span class="pre">b)</span></tt></td>
  50.940 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">&amp;&amp;</span> <span class="pre">b</span></tt></td>
  50.941 -<td>Logical and</td>
  50.942 -</tr>
  50.943 -<tr><td><tt class="docutils literal"><span class="pre">logor(a,</span> <span class="pre">b)</span></tt></td>
  50.944 -<td><tt class="docutils literal"><span class="pre">a</span> <span class="pre">||</span> <span class="pre">b</span></tt></td>
  50.945 -<td>Logical or</td>
  50.946 -</tr>
  50.947 -<tr><td><tt class="docutils literal"><span class="pre">contains(a,</span> <span class="pre">b)</span></tt></td>
  50.948 -<td><tt class="docutils literal"><span class="pre">b</span> <span class="pre">in</span> <span class="pre">a</span></tt></td>
  50.949 -<td>Has property (note order)</td>
  50.950 -</tr>
  50.951 -</tbody>
  50.952 -</table>
  50.953 -</blockquote>
  50.954 -</blockquote>
  50.955 -<p>
  50.956 -<a name="fn-parsequerystring"></a>
  50.957 -<a class="mochidef reference" href="#fn-parsequerystring">parseQueryString(encodedString[, useArrays=false])</a>:</p>
  50.958 -<blockquote>
  50.959 -<p>Parse a name=value pair URL query string into an object with a property
  50.960 -for each pair. e.g.:</p>
  50.961 -<pre class="literal-block">
  50.962 -var args = parseQueryString(&quot;foo=value%20one&amp;bar=two&quot;);
  50.963 -assert( args.foo == &quot;value one&quot; &amp;&amp; args.bar == &quot;two&quot; );
  50.964 -</pre>
  50.965 -<p>If you expect that the query string will reuse the
  50.966 -same name, then give <tt class="docutils literal"><span class="pre">true</span></tt> as a second argument, which will
  50.967 -use arrays to store the values. e.g.:</p>
  50.968 -<pre class="literal-block">
  50.969 -var args = parseQueryString(&quot;foo=one&amp;foo=two&quot;, true);
  50.970 -assert( args.foo[0] == &quot;one&quot; &amp;&amp; args.foo[1] == &quot;two&quot; );
  50.971 -</pre>
  50.972 -</blockquote>
  50.973 -<p>
  50.974 -<a name="fn-partial"></a>
  50.975 -<a class="mochidef reference" href="#fn-partial">partial(func, arg[, ...])</a>:</p>
  50.976 -<blockquote>
  50.977 -<p>Return a partially applied function, e.g.:</p>
  50.978 -<pre class="literal-block">
  50.979 -addNumbers = function (a, b) {
  50.980 -    return a + b;
  50.981 -}
  50.982 -
  50.983 -addOne = partial(addNumbers, 1);
  50.984 -
  50.985 -assert(addOne(2) == 3);
  50.986 -</pre>
  50.987 -<p><a class="mochiref reference" href="#fn-partial">partial</a> is a special form of <a class="mochiref reference" href="#fn-bind">bind</a> that does not
  50.988 -alter the bound <tt class="docutils literal"><span class="pre">self</span></tt> (if any). It is equivalent to calling:</p>
  50.989 -<pre class="literal-block">
  50.990 -bind(func, undefined, arg[, ...]);
  50.991 -</pre>
  50.992 -<p>See the documentation for <a class="mochiref reference" href="#fn-bind">bind</a> for more details about
  50.993 -this facility.</p>
  50.994 -<p>This could be used to implement, but is NOT currying.</p>
  50.995 -</blockquote>
  50.996 -<p>
  50.997 -<a name="fn-querystring"></a>
  50.998 -<a class="mochidef reference" href="#fn-querystring">queryString(names, values)</a>:</p>
  50.999 -<blockquote>
 50.1000 -<p>Creates a URL query string from a pair of <tt class="docutils literal"><span class="pre">Array</span></tt>-like objects
 50.1001 -representing <tt class="docutils literal"><span class="pre">names</span></tt> and <tt class="docutils literal"><span class="pre">values</span></tt>. Each name=value pair will
 50.1002 -be URL encoded by <a class="mochiref reference" href="#fn-urlencode">urlEncode</a>. name=value pairs with a
 50.1003 -value of <tt class="docutils literal"><span class="pre">undefined</span></tt> or <tt class="docutils literal"><span class="pre">null</span></tt> will be skipped. e.g.:</p>
 50.1004 -<pre class="literal-block">
 50.1005 -var keys = [&quot;foo&quot;, &quot;bar&quot;];
 50.1006 -var values = [&quot;value one&quot;, &quot;two&quot;];
 50.1007 -assert( queryString(keys, values) == &quot;foo=value%20one&amp;bar=two&quot; );
 50.1008 -</pre>
 50.1009 -<dl class="docutils">
 50.1010 -<dt>Alternate form 1:</dt>
 50.1011 -<dd><a class="mochiref reference" href="#fn-querystring">queryString(domElement)</a></dd>
 50.1012 -</dl>
 50.1013 -<p>If <a class="mochiref reference" href="DOM.html">MochiKit.DOM</a> is loaded, one argument is given, and that
 50.1014 -argument is either a string or has a <tt class="docutils literal"><span class="pre">nodeType</span></tt> property greater than
 50.1015 -zero, then <tt class="docutils literal"><span class="pre">names</span></tt> and <tt class="docutils literal"><span class="pre">values</span></tt> will be the result of
 50.1016 -<a class="mochiref reference" href="DOM.html#fn-formcontents">MochiKit.DOM.formContents(domElement)</a>.</p>
 50.1017 -<dl class="docutils">
 50.1018 -<dt>Alternate form 2:</dt>
 50.1019 -<dd><a class="mochiref reference" href="#fn-querystring">queryString({name: value, ...})</a></dd>
 50.1020 -</dl>
 50.1021 -<p>Note that when using the alternate form, the order of the name=value
 50.1022 -pairs in the resultant query string is dependent on how the particular
 50.1023 -JavaScript implementation handles <tt class="docutils literal"><span class="pre">for</span> <span class="pre">(..in..)</span></tt> property enumeration.</p>
 50.1024 -<p>When using the second alternate form, name=value pairs with
 50.1025 -<tt class="docutils literal"><span class="pre">typeof(value)</span> <span class="pre">==</span> <span class="pre">&quot;function&quot;</span></tt> are ignored. This is a workaround for the
 50.1026 -case where a poorly designed library has modified <tt class="docutils literal"><span class="pre">Object.prototype</span></tt>
 50.1027 -and inserted &quot;convenience functions&quot;.</p>
 50.1028 -</blockquote>
 50.1029 -<p>
 50.1030 -<a name="fn-registercomparator"></a>
 50.1031 -<a class="mochidef reference" href="#fn-registercomparator">registerComparator(name, check, comparator[, override])</a>:</p>
 50.1032 -<blockquote>
 50.1033 -<p>Register a comparator for use with <a class="mochiref reference" href="#fn-compare">compare</a>.</p>
 50.1034 -<dl class="docutils">
 50.1035 -<dt><tt class="docutils literal"><span class="pre">name</span></tt>:</dt>
 50.1036 -<dd>unique identifier describing the comparator.</dd>
 50.1037 -<dt><tt class="docutils literal"><span class="pre">check</span></tt>:</dt>
 50.1038 -<dd><tt class="docutils literal"><span class="pre">function(a,</span> <span class="pre">b)</span></tt> that returns <tt class="docutils literal"><span class="pre">true</span></tt> if <tt class="docutils literal"><span class="pre">a</span></tt> and <tt class="docutils literal"><span class="pre">b</span></tt>
 50.1039 -can be compared with <tt class="docutils literal"><span class="pre">comparator</span></tt>.</dd>
 50.1040 -<dt><tt class="docutils literal"><span class="pre">comparator</span></tt>:</dt>
 50.1041 -<dd><p class="first"><tt class="docutils literal"><span class="pre">function(a,</span> <span class="pre">b)</span></tt> that returns:</p>
 50.1042 -<table border="1" class="docutils">
 50.1043 -<colgroup>
 50.1044 -<col width="39%" />
 50.1045 -<col width="61%" />
 50.1046 -</colgroup>
 50.1047 -<tbody valign="top">
 50.1048 -<tr><td>Value</td>
 50.1049 -<td>Condition</td>
 50.1050 -</tr>
 50.1051 -<tr><td>0</td>
 50.1052 -<td>a == b</td>
 50.1053 -</tr>
 50.1054 -<tr><td>1</td>
 50.1055 -<td>a &gt; b</td>
 50.1056 -</tr>
 50.1057 -<tr><td>-1</td>
 50.1058 -<td>a &lt; b</td>
 50.1059 -</tr>
 50.1060 -</tbody>
 50.1061 -</table>
 50.1062 -<p class="last"><tt class="docutils literal"><span class="pre">comparator</span></tt> is guaranteed to only be called if <tt class="docutils literal"><span class="pre">check(a,</span> <span class="pre">b)</span></tt>
 50.1063 -returns a <tt class="docutils literal"><span class="pre">true</span></tt> value.</p>
 50.1064 -</dd>
 50.1065 -<dt><tt class="docutils literal"><span class="pre">override</span></tt>:</dt>
 50.1066 -<dd>if <tt class="docutils literal"><span class="pre">true</span></tt>, then this will be made the highest precedence comparator.
 50.1067 -Otherwise, the lowest.</dd>
 50.1068 -</dl>
 50.1069 -</blockquote>
 50.1070 -<p>
 50.1071 -<a name="fn-registerjson"></a>
 50.1072 -<a class="mochidef reference" href="#fn-registerjson">registerJSON(name, check, simplifier[, override])</a>:</p>
 50.1073 -<blockquote>
 50.1074 -<p>Register a simplifier function for use with <a class="mochiref reference" href="#fn-serializejson">serializeJSON</a>.</p>
 50.1075 -<dl class="docutils">
 50.1076 -<dt><tt class="docutils literal"><span class="pre">name</span></tt>:</dt>
 50.1077 -<dd>unique identifier describing the serialization.</dd>
 50.1078 -<dt><tt class="docutils literal"><span class="pre">check</span></tt>:</dt>
 50.1079 -<dd><tt class="docutils literal"><span class="pre">function(obj)</span></tt> that returns <tt class="docutils literal"><span class="pre">true</span></tt> if <tt class="docutils literal"><span class="pre">obj</span></tt> can
 50.1080 -can be simplified for serialization by <tt class="docutils literal"><span class="pre">simplifier</span></tt>.</dd>
 50.1081 -<dt><tt class="docutils literal"><span class="pre">simplifier</span></tt>:</dt>
 50.1082 -<dd><p class="first"><tt class="docutils literal"><span class="pre">function(obj)</span></tt> that returns a simpler object that
 50.1083 -can be further serialized by <a class="mochiref reference" href="#fn-serializejson">serializeJSON</a>. For example,
 50.1084 -you could simplify <tt class="docutils literal"><span class="pre">Date</span></tt>-like objects to ISO 8601 timestamp
 50.1085 -strings with the following simplifier:</p>
 50.1086 -<pre class="literal-block">
 50.1087 -var simplifyDateAsISO = function (obj) {
 50.1088 -    return toISOTimestamp(obj, true);
 50.1089 -};
 50.1090 -registerJSON(&quot;DateLike&quot;, isDateLike, simplifyDateAsISO);
 50.1091 -</pre>
 50.1092 -<p class="last"><tt class="docutils literal"><span class="pre">simplifier</span></tt> is guaranteed to only be called if <tt class="docutils literal"><span class="pre">check(obj)</span></tt>
 50.1093 -returns a <tt class="docutils literal"><span class="pre">true</span></tt> value.</p>
 50.1094 -</dd>
 50.1095 -<dt><tt class="docutils literal"><span class="pre">override</span></tt>:</dt>
 50.1096 -<dd>if <tt class="docutils literal"><span class="pre">true</span></tt>, then this will be made the highest precedence comparator.
 50.1097 -Otherwise, the lowest.</dd>
 50.1098 -</dl>
 50.1099 -</blockquote>
 50.1100 -<p>
 50.1101 -<a name="fn-registerrepr"></a>
 50.1102 -<a class="mochidef reference" href="#fn-registerrepr">registerRepr(name, check, wrap[, override])</a>:</p>
 50.1103 -<blockquote>
 50.1104 -<p>Register a programmer representation function.
 50.1105 -<a class="mochiref reference" href="#fn-repr">repr</a> functions should take one argument and
 50.1106 -return a string representation of it
 50.1107 -suitable for developers, primarily used when debugging.</p>
 50.1108 -<p>If <tt class="docutils literal"><span class="pre">override</span></tt> is given, it is used as the highest priority
 50.1109 -repr, otherwise it will be used as the lowest.</p>
 50.1110 -</blockquote>
 50.1111 -<p>
 50.1112 -<a name="fn-repr"></a>
 50.1113 -<a class="mochidef reference" href="#fn-repr">repr(obj)</a>:</p>
 50.1114 -<blockquote>
 50.1115 -Return a programmer representation for <tt class="docutils literal"><span class="pre">obj</span></tt>. See the
 50.1116 -<a class="reference" href="#programmer-representation">Programmer Representation</a> overview for more information about this
 50.1117 -function.</blockquote>
 50.1118 -<p>
 50.1119 -<a name="fn-reversekeycomparator"></a>
 50.1120 -<a class="mochidef reference" href="#fn-reversekeycomparator">reverseKeyComparator(key)</a>:</p>
 50.1121 -<blockquote>
 50.1122 -<p>A comparator factory that compares <tt class="docutils literal"><span class="pre">a[key]</span></tt> with <tt class="docutils literal"><span class="pre">b[key]</span></tt> in reverse.
 50.1123 -e.g.:</p>
 50.1124 -<pre class="literal-block">
 50.1125 -var lst = [&quot;a&quot;, &quot;bbb&quot;, &quot;cc&quot;];
 50.1126 -lst.sort(reverseKeyComparator(&quot;length&quot;));
 50.1127 -assert(lst.toString() == &quot;bbb,cc,a&quot;);
 50.1128 -</pre>
 50.1129 -</blockquote>
 50.1130 -<p>
 50.1131 -<a name="fn-serializejson"></a>
 50.1132 -<a class="mochidef reference" href="#fn-serializejson">serializeJSON(anObject)</a>:</p>
 50.1133 -<blockquote>
 50.1134 -<p>Serialize <tt class="docutils literal"><span class="pre">anObject</span></tt> in the JSON <a class="footnote-reference" href="#id7" id="id6" name="id6">[1]</a> format, see <a class="reference" href="#json-serialization">JSON Serialization</a>
 50.1135 -for the coercion rules. For unserializable objects (functions that do
 50.1136 -not have an adapter, <tt class="docutils literal"><span class="pre">__json__</span></tt> method, or <tt class="docutils literal"><span class="pre">json</span></tt> method), this will
 50.1137 -return <tt class="docutils literal"><span class="pre">undefined</span></tt>.</p>
 50.1138 -<p>For those familiar with Python, JSON is similar in scope to pickle, but
 50.1139 -it can not handle recursive object graphs.</p>
 50.1140 -</blockquote>
 50.1141 -<p>
 50.1142 -<a name="fn-setdefault"></a>
 50.1143 -<a class="mochidef reference" href="#fn-setdefault">setdefault(self, obj[, ...])</a>:</p>
 50.1144 -<blockquote>
 50.1145 -<p>Mutate <tt class="docutils literal"><span class="pre">self</span></tt> by adding all properties from other object(s)
 50.1146 -that it does not already have set.</p>
 50.1147 -<p>If <tt class="docutils literal"><span class="pre">self</span></tt> is <tt class="docutils literal"><span class="pre">null</span></tt>, a new <tt class="docutils literal"><span class="pre">Object</span></tt> instance will be created
 50.1148 -and returned.</p>
 50.1149 -<p>This mutates <em>and returns</em> <tt class="docutils literal"><span class="pre">self</span></tt>, be warned.</p>
 50.1150 -</blockquote>
 50.1151 -<p>
 50.1152 -<a name="fn-typematcher"></a>
 50.1153 -<a class="mochidef reference" href="#fn-typematcher">typeMatcher(typ[, ...])</a>:</p>
 50.1154 -<blockquote>
 50.1155 -Given a set of types (as string arguments),
 50.1156 -returns a <tt class="docutils literal"><span class="pre">function(obj[,</span> <span class="pre">...])</span></tt> that will return <tt class="docutils literal"><span class="pre">true</span></tt> if the
 50.1157 -types of the given arguments are all members of that set.</blockquote>
 50.1158 -<p>
 50.1159 -<a name="fn-update"></a>
 50.1160 -<a class="mochidef reference" href="#fn-update">update(self, obj[, ...])</a>:</p>
 50.1161 -<blockquote>
 50.1162 -<p>Mutate <tt class="docutils literal"><span class="pre">self</span></tt> by replacing its key:value pairs with those
 50.1163 -from other object(s). Key:value pairs from later objects will
 50.1164 -overwrite those from earlier objects.</p>
 50.1165 -<p>If <tt class="docutils literal"><span class="pre">self</span></tt> is <tt class="docutils literal"><span class="pre">null</span></tt>, a new <tt class="docutils literal"><span class="pre">Object</span></tt> instance will be created
 50.1166 -and returned.</p>
 50.1167 -<p>This mutates <em>and returns</em> <tt class="docutils literal"><span class="pre">self</span></tt>, be warned.</p>
 50.1168 -<p>A version of this function that creates a new object is available
 50.1169 -as <a class="mochiref reference" href="#fn-merge">merge(a, b[, ...])</a></p>
 50.1170 -</blockquote>
 50.1171 -<p>
 50.1172 -<a name="fn-updatetree"></a>
 50.1173 -<a class="mochidef reference" href="#fn-updatetree">updatetree(self, obj[, ...])</a>:</p>
 50.1174 -<blockquote>
 50.1175 -<p>Mutate <tt class="docutils literal"><span class="pre">self</span></tt> by replacing its key:value pairs with those
 50.1176 -from other object(s). If a given key has an object value in
 50.1177 -both <tt class="docutils literal"><span class="pre">self</span></tt> and <tt class="docutils literal"><span class="pre">obj</span></tt>, then this function will be called
 50.1178 -recursively, updating instead of replacing that object.</p>
 50.1179 -<p>If <tt class="docutils literal"><span class="pre">self</span></tt> is <tt class="docutils literal"><span class="pre">null</span></tt>, a new <tt class="docutils literal"><span class="pre">Object</span></tt> instance will be created
 50.1180 -and returned.</p>
 50.1181 -<p>This mutates <em>and returns</em> <tt class="docutils literal"><span class="pre">self</span></tt>, be warned.</p>
 50.1182 -</blockquote>
 50.1183 -<p>
 50.1184 -<a name="fn-urlencode"></a>
 50.1185 -<a class="mochidef reference" href="#fn-urlencode">urlEncode(unencoded)</a>:</p>
 50.1186 -<blockquote>
 50.1187 -<p>Converts <tt class="docutils literal"><span class="pre">unencoded</span></tt> into a URL-encoded string. In this
 50.1188 -implementation, spaces are converted to %20 instead of &quot;+&quot;. e.g.:</p>
 50.1189 -<pre class="literal-block">
 50.1190 -assert( URLencode(&quot;1+2=2&quot;) == &quot;1%2B2%3D2&quot;);
 50.1191 -</pre>
 50.1192 -</blockquote>
 50.1193 -<p>
 50.1194 -<a name="fn-xfilter"></a>
 50.1195 -<a class="mochidef reference" href="#fn-xfilter">xfilter(fn, obj[, ...])</a>:</p>
 50.1196 -<blockquote>
 50.1197 -<p>Returns a new <tt class="docutils literal"><span class="pre">Array</span></tt> composed of the arguments where
 50.1198 -<tt class="docutils literal"><span class="pre">fn(obj)</span></tt> returns a true value.</p>
 50.1199 -<p>If <tt class="docutils literal"><span class="pre">fn</span></tt> is <tt class="docutils literal"><span class="pre">null</span></tt>, <tt class="docutils literal"><span class="pre">operator.truth</span></tt> will be used.</p>
 50.1200 -</blockquote>
 50.1201 -<p>
 50.1202 -<a name="fn-xmap"></a>
 50.1203 -<a class="mochidef reference" href="#fn-xmap">xmap(fn, obj[, ...)</a>:</p>
 50.1204 -<blockquote>
 50.1205 -<p>Return a new <tt class="docutils literal"><span class="pre">Array</span></tt> composed of <tt class="docutils literal"><span class="pre">fn(obj)</span></tt> for every <tt class="docutils literal"><span class="pre">obj</span></tt>
 50.1206 -given as an argument.</p>
 50.1207 -<p>If <tt class="docutils literal"><span class="pre">fn</span></tt> is <tt class="docutils literal"><span class="pre">null</span></tt>, <tt class="docutils literal"><span class="pre">operator.identity</span></tt> is used.</p>
 50.1208 -</blockquote>
 50.1209 -</div>
 50.1210 -</div>
 50.1211 -<div class="section">
 50.1212 -<h1><a id="see-also" name="see-also">See Also</a></h1>
 50.1213 -<table class="docutils footnote" frame="void" id="id7" rules="none">
 50.1214 -<colgroup><col class="label" /><col /></colgroup>
 50.1215 -<tbody valign="top">
 50.1216 -<tr><td class="label"><a name="id7">[1]</a></td><td><em>(<a class="fn-backref" href="#id1">1</a>, <a class="fn-backref" href="#id2">2</a>, <a class="fn-backref" href="#id4">3</a>, <a class="fn-backref" href="#id5">4</a>, <a class="fn-backref" href="#id6">5</a>)</em> JSON, JavaScript Object Notation: <a class="reference" href="http://json.org/">http://json.org/</a></td></tr>
 50.1217 -</tbody>
 50.1218 -</table>
 50.1219 -<table class="docutils footnote" frame="void" id="id8" rules="none">
 50.1220 -<colgroup><col class="label" /><col /></colgroup>
 50.1221 -<tbody valign="top">
 50.1222 -<tr><td class="label"><a class="fn-backref" href="#id3" name="id8">[2]</a></td><td>Python's itertools
 50.1223 -module: <a class="reference" href="http://docs.python.org/lib/module-itertools.html">http://docs.python.org/lib/module-itertools.html</a></td></tr>
 50.1224 -</tbody>
 50.1225 -</table>
 50.1226 -</div>
 50.1227 -<div class="section">
 50.1228 -<h1><a id="authors" name="authors">Authors</a></h1>
 50.1229 -<ul class="simple">
 50.1230 -<li>Bob Ippolito &lt;<a class="reference" href="mailto:bob&#64;redivi.com">bob&#64;redivi.com</a>&gt;</li>
 50.1231 -</ul>
 50.1232 -</div>
 50.1233 -<div class="section">
 50.1234 -<h1><a id="copyright" name="copyright">Copyright</a></h1>
 50.1235 -<p>Copyright 2005 Bob Ippolito &lt;<a class="reference" href="mailto:bob&#64;redivi.com">bob&#64;redivi.com</a>&gt;. This program is dual-licensed
 50.1236 -free software; you can redistribute it and/or modify it under the terms of the
 50.1237 -<a class="reference" href="http://www.opensource.org/licenses/mit-license.php">MIT License</a> or the <a class="reference" href="http://www.opensource.org/licenses/afl-2.1.php">Academic Free License v2.1</a>.</p>
 50.1238 -</div>
 50.1239 -</div>
 50.1240 -
 50.1241 -</body>
 50.1242 -</html>
    51.1 --- a/pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/Color.html	Mon Apr 13 12:51:06 2009 +0200
    51.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.3 @@ -1,509 +0,0 @@
    51.4 -<?xml version="1.0" encoding="utf-8" ?>
    51.5 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    51.6 -
    51.7 -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    51.8 -<head>
    51.9 -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   51.10 -<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
   51.11 -<title>MochiKit.Color - color abstraction with CSS3 support</title>
   51.12 -
   51.13 -<link rel="stylesheet" href="../../../include/css/documentation.css" type="text/css" />
   51.14 -<script type="text/javascript" src="../../../packed/lib/MochiKit/MochiKit.js"></script>
   51.15 -<script type="text/javascript" src="../../js/toc.js"></script>
   51.16 -</head>
   51.17 -<body>
   51.18 -<div class="document">
   51.19 -<div class="section">
   51.20 -<h1><a id="name" name="name">Name</a></h1>
   51.21 -<p>MochiKit.Color - color abstraction with CSS3 support</p>
   51.22 -</div>
   51.23 -<div class="section">
   51.24 -<h1><a id="synopsis" name="synopsis">Synopsis</a></h1>
   51.25 -<pre class="literal-block">
   51.26 -// RGB color expressions are supported
   51.27 -assert(
   51.28 -    objEqual(Color.whiteColor(), Color.fromString(&quot;rgb(255,100%, 255)&quot;))
   51.29 -);
   51.30 -
   51.31 -// So is instantiating directly from HSL or RGB values.
   51.32 -// Note that fromRGB and fromHSL take numbers between 0.0 and 1.0!
   51.33 -assert( objEqual(Color.fromRGB(1.0, 1.0, 1.0), Color.fromHSL(0.0, 0.0, 1.0) );
   51.34 -
   51.35 -// Or even SVG color keyword names, as per CSS3!
   51.36 -assert( Color.fromString(&quot;aquamarine&quot;), &quot;#7fffd4&quot; );
   51.37 -
   51.38 -// NSColor-like colors built in
   51.39 -assert( Color.whiteColor().toHexString() == &quot;#ffffff&quot; );
   51.40 -</pre>
   51.41 -</div>
   51.42 -<div class="section">
   51.43 -<h1><a id="description" name="description">Description</a></h1>
   51.44 -<p>MochiKit.Color is an abstraction for handling colors and strings that
   51.45 -represent colors.</p>
   51.46 -</div>
   51.47 -<div class="section">
   51.48 -<h1><a id="dependencies" name="dependencies">Dependencies</a></h1>
   51.49 -<ul class="simple">
   51.50 -<li><a class="mochiref reference" href="Base.html">MochiKit.Base</a></li>
   51.51 -</ul>
   51.52 -</div>
   51.53 -<div class="section">
   51.54 -<h1><a id="overview" name="overview">Overview</a></h1>
   51.55 -<p>MochiKit.Color provides an abstraction of RGB, HSL and HSV colors with alpha.
   51.56 -It supports parsing and generating of CSS3 colors, and has a full CSS3 (SVG)
   51.57 -color table.</p>
   51.58 -<p>All of the functionality in this module is exposed through a Color constructor
   51.59 -and its prototype, but a few of its internals are available for direct use at
   51.60 -module level.</p>
   51.61 -</div>
   51.62 -<div class="section">
   51.63 -<h1><a id="api-reference" name="api-reference">API Reference</a></h1>
   51.64 -<div class="section">
   51.65 -<h2><a id="constructors" name="constructors">Constructors</a></h2>
   51.66 -<p>
   51.67 -<a name="fn-color"></a>
   51.68 -<a class="mochidef reference" href="#fn-color">Color()</a>:</p>
   51.69 -<blockquote>
   51.70 -<p>Represents a color. Component values should be integers between <tt class="docutils literal"><span class="pre">0.0</span></tt>
   51.71 -and <tt class="docutils literal"><span class="pre">1.0</span></tt>. You should use one of the <a class="mochiref reference" href="#fn-color">Color</a> factory
   51.72 -functions such as <a class="mochiref reference" href="#fn-color.fromrgb">Color.fromRGB</a>, <a class="mochiref reference" href="#fn-color.fromhsl">Color.fromHSL</a>,
   51.73 -etc. instead of constructing <a class="mochiref reference" href="#fn-color">Color</a> objects directly.</p>
   51.74 -<p><a class="mochiref reference" href="#fn-color">Color</a> instances can be compared with
   51.75 -<a class="mochiref reference" href="Base.html#fn-compare">MochiKit.Base.compare</a> (though ordering is on RGB, so is not
   51.76 -particularly meaningful except for equality), and the default <tt class="docutils literal"><span class="pre">toString</span></tt>
   51.77 -implementation returns <a class="mochiref reference" href="#fn-color.prototype.tohexstring">Color.prototype.toHexString()</a>.</p>
   51.78 -<p><a class="mochiref reference" href="#fn-color">Color</a> instances are immutable, and much of the architecture is
   51.79 -inspired by AppKit's NSColor <a class="footnote-reference" href="#id6" id="id1" name="id1">[1]</a></p>
   51.80 -</blockquote>
   51.81 -<p>
   51.82 -<a name="fn-color.frombackground"></a>
   51.83 -<a class="mochidef reference" href="#fn-color.frombackground">Color.fromBackground(elem)</a>:</p>
   51.84 -<blockquote>
   51.85 -<p>Returns a <a class="mochiref reference" href="#fn-color">Color</a> object based on the background of the provided
   51.86 -element. Equivalent to:</p>
   51.87 -<pre class="literal-block">
   51.88 -c = Color.fromComputedStyle(
   51.89 -    elem, &quot;backgroundColor&quot;, &quot;background-color&quot;) || Color.whiteColor();
   51.90 -</pre>
   51.91 -</blockquote>
   51.92 -<p>
   51.93 -<a name="fn-color.fromcomputedstyle"></a>
   51.94 -<a class="mochidef reference" href="#fn-color.fromcomputedstyle">Color.fromComputedStyle(elem, style, mozillaEquivalentCSS)</a>:</p>
   51.95 -<blockquote>
   51.96 -Returns a <a class="mochiref reference" href="#fn-color">Color</a> object based on the result of
   51.97 -<a class="mochiref reference" href="DOM.html#fn-computedstyle">MochiKit.DOM.computedStyle(elem, style, mozillaEquivalentCSS)</a>
   51.98 -or <tt class="docutils literal"><span class="pre">null</span></tt> if not found.</blockquote>
   51.99 -<p>
  51.100 -<a name="fn-color.fromhexstring"></a>
  51.101 -<a class="mochidef reference" href="#fn-color.fromhexstring">Color.fromHexString(hexString)</a>:</p>
  51.102 -<blockquote>
  51.103 -Returns a <a class="mochiref reference" href="#fn-color">Color</a> object from the given hexadecimal color string.
  51.104 -For example, <tt class="docutils literal"><span class="pre">&quot;#FFFFFF&quot;</span></tt> would return a <a class="mochiref reference" href="#fn-color">Color</a> with
  51.105 -RGB values <tt class="docutils literal"><span class="pre">[255/255,</span> <span class="pre">255/255,</span> <span class="pre">255/255]</span></tt> (white).</blockquote>
  51.106 -<p>
  51.107 -<a name="fn-color.fromhsl"></a>
  51.108 -<a class="mochidef reference" href="#fn-color.fromhsl">Color.fromHSL(hue, saturation, lightness, alpha=1.0)</a>:</p>
  51.109 -<blockquote>
  51.110 -<p>Return a <a class="mochiref reference" href="#fn-color">Color</a> object from the given <tt class="docutils literal"><span class="pre">hue</span></tt>, <tt class="docutils literal"><span class="pre">saturation</span></tt>,
  51.111 -<tt class="docutils literal"><span class="pre">lightness</span></tt> values. Values should be numbers between <tt class="docutils literal"><span class="pre">0.0</span></tt> and
  51.112 -<tt class="docutils literal"><span class="pre">1.0</span></tt>.</p>
  51.113 -<p>If <tt class="docutils literal"><span class="pre">alpha</span></tt> is not given, then <tt class="docutils literal"><span class="pre">1.0</span></tt> (completely opaque) will be used.</p>
  51.114 -<dl class="docutils">
  51.115 -<dt>Alternate form:</dt>
  51.116 -<dd><a class="mochiref reference" href="#fn-color.fromhsl">Color.fromHSL({h: hue, s: saturation, l: lightness, a: alpha})</a></dd>
  51.117 -</dl>
  51.118 -</blockquote>
  51.119 -<p>
  51.120 -<a name="fn-color.fromhslstring"></a>
  51.121 -<a class="mochidef reference" href="#fn-color.fromhslstring">Color.fromHSLString(hslString)</a>:</p>
  51.122 -<blockquote>
  51.123 -Returns a <a class="mochiref reference" href="#fn-color">Color</a> object from the given decimal hsl color string.
  51.124 -For example, <tt class="docutils literal"><span class="pre">&quot;hsl(0,0%,100%)&quot;</span></tt> would return a <a class="mochiref reference" href="#fn-color">Color</a> with
  51.125 -HSL values <tt class="docutils literal"><span class="pre">[0/360,</span> <span class="pre">0/360,</span> <span class="pre">360/360]</span></tt> (white).</blockquote>
  51.126 -<p>
  51.127 -<a name="fn-color.fromhsv"></a>
  51.128 -<a class="mochidef reference" href="#fn-color.fromhsv">Color.fromHSV(hue, saturation, value, alpha=1.0)</a>:</p>
  51.129 -<blockquote>
  51.130 -<p>Return a <a class="mochiref reference" href="#fn-color">Color</a> object from the given <tt class="docutils literal"><span class="pre">hue</span></tt>, <tt class="docutils literal"><span class="pre">saturation</span></tt>,
  51.131 -<tt class="docutils literal"><span class="pre">value</span></tt> values. Values should be numbers between <tt class="docutils literal"><span class="pre">0.0</span></tt> and
  51.132 -<tt class="docutils literal"><span class="pre">1.0</span></tt>.</p>
  51.133 -<p>If <tt class="docutils literal"><span class="pre">alpha</span></tt> is not given, then <tt class="docutils literal"><span class="pre">1.0</span></tt> (completely opaque) will be used.</p>
  51.134 -<dl class="docutils">
  51.135 -<dt>Alternate form:</dt>
  51.136 -<dd><a class="mochiref reference" href="#fn-color.fromhsv">Color.fromHSV({h: hue, s: saturation, v: value, a: alpha})</a></dd>
  51.137 -</dl>
  51.138 -</blockquote>
  51.139 -<p>
  51.140 -<a name="fn-color.fromname"></a>
  51.141 -<a class="mochidef reference" href="#fn-color.fromname">Color.fromName(colorName)</a>:</p>
  51.142 -<blockquote>
  51.143 -Returns a <a class="mochiref reference" href="#fn-color">Color</a> object corresponding to the given
  51.144 -SVG 1.0 color keyword name <a class="footnote-reference" href="#id7" id="id2" name="id2">[2]</a> as per the W3C CSS3
  51.145 -Color Module <a class="footnote-reference" href="#id8" id="id3" name="id3">[3]</a>. <tt class="docutils literal"><span class="pre">&quot;transparent&quot;</span></tt> is also accepted
  51.146 -as a color name, and will return <a class="mochiref reference" href="#fn-color.transparentcolor">Color.transparentColor()</a>.</blockquote>
  51.147 -<p>
  51.148 -<a name="fn-color.fromrgb"></a>
  51.149 -<a class="mochidef reference" href="#fn-color.fromrgb">Color.fromRGB(red, green, blue, alpha=1.0)</a>:</p>
  51.150 -<blockquote>
  51.151 -<p>Return a <a class="mochiref reference" href="#fn-color">Color</a> object from the given <tt class="docutils literal"><span class="pre">red</span></tt>, <tt class="docutils literal"><span class="pre">green</span></tt>,
  51.152 -<tt class="docutils literal"><span class="pre">blue</span></tt>, and <tt class="docutils literal"><span class="pre">alpha</span></tt> values. Values should be numbers between <tt class="docutils literal"><span class="pre">0</span></tt>
  51.153 -and <tt class="docutils literal"><span class="pre">1.0</span></tt>.</p>
  51.154 -<p>If <tt class="docutils literal"><span class="pre">alpha</span></tt> is not given, then <tt class="docutils literal"><span class="pre">1.0</span></tt> (completely opaque) will be used.</p>
  51.155 -<dl class="docutils">
  51.156 -<dt>Alternate form:</dt>
  51.157 -<dd><a class="mochiref reference" href="#fn-color.fromrgb">Color.fromRGB({r: red, g: green, b: blue, a: alpha})</a></dd>
  51.158 -</dl>
  51.159 -</blockquote>
  51.160 -<p>
  51.161 -<a name="fn-color.fromrgbstring"></a>
  51.162 -<a class="mochidef reference" href="#fn-color.fromrgbstring">Color.fromRGBString(rgbString)</a>:</p>
  51.163 -<blockquote>
  51.164 -Returns a <a class="mochiref reference" href="#fn-color">Color</a> object from the given decimal rgb color string.
  51.165 -For example, <tt class="docutils literal"><span class="pre">&quot;rgb(255,255,255)&quot;</span></tt> would return a <a class="mochiref reference" href="#fn-color">Color</a> with
  51.166 -RGB values <tt class="docutils literal"><span class="pre">[255/255,</span> <span class="pre">255/255,</span> <span class="pre">255/255]</span></tt> (white).</blockquote>
  51.167 -<p>
  51.168 -<a name="fn-color.fromtext"></a>
  51.169 -<a class="mochidef reference" href="#fn-color.fromtext">Color.fromText(elem)</a>:</p>
  51.170 -<blockquote>
  51.171 -<p>Returns a <a class="mochiref reference" href="#fn-color">Color</a> object based on the text color of the provided
  51.172 -element. Equivalent to:</p>
  51.173 -<pre class="literal-block">
  51.174 -c = Color.fromComputedStyle(elem, &quot;color&quot;) || Color.whiteColor();
  51.175 -</pre>
  51.176 -</blockquote>
  51.177 -<p>
  51.178 -<a name="fn-color.fromstring"></a>
  51.179 -<a class="mochidef reference" href="#fn-color.fromstring">Color.fromString(rgbOrHexString)</a>:</p>
  51.180 -<blockquote>
  51.181 -<p>Returns a <a class="mochiref reference" href="#fn-color">Color</a> object from the given RGB, HSL, hex, or name.
  51.182 -Will return <tt class="docutils literal"><span class="pre">null</span></tt> if the string can not be parsed by any of these
  51.183 -methods.</p>
  51.184 -<p>See <a class="mochiref reference" href="#fn-color.fromhexstring">Color.fromHexString</a>, <a class="mochiref reference" href="#fn-color.fromrgbstring">Color.fromRGBString</a>,
  51.185 -<a class="mochiref reference" href="#fn-color.fromhslstring">Color.fromHSLString</a> and <a class="mochiref reference" href="#fn-color.fromname">Color.fromName</a> more
  51.186 -information.</p>
  51.187 -</blockquote>
  51.188 -<p>
  51.189 -<a name="fn-color.namedcolors"></a>
  51.190 -<a class="mochidef reference" href="#fn-color.namedcolors">Color.namedColors()</a>:</p>
  51.191 -<blockquote>
  51.192 -Returns an object with properties for each SVG 1.0 color keyword
  51.193 -name <a class="footnote-reference" href="#id7" id="id4" name="id4">[2]</a> supported by CSS3 <a class="footnote-reference" href="#id8" id="id5" name="id5">[3]</a>. Property names are the color keyword
  51.194 -name in lowercase, and the value is a string suitable for
  51.195 -<a class="mochiref reference" href="#fn-color.fromstring">Color.fromString()</a>.</blockquote>
  51.196 -<p>
  51.197 -<a name="fn-color.prototype.colorwithalpha"></a>
  51.198 -<a class="mochidef reference" href="#fn-color.prototype.colorwithalpha">Color.prototype.colorWithAlpha(alpha)</a>:</p>
  51.199 -<blockquote>
  51.200 -Return a new <a class="mochiref reference" href="#fn-color">Color</a> based on this color, but with the provided
  51.201 -<tt class="docutils literal"><span class="pre">alpha</span></tt> value.</blockquote>
  51.202 -<p>
  51.203 -<a name="fn-color.prototype.colorwithhue"></a>
  51.204 -<a class="mochidef reference" href="#fn-color.prototype.colorwithhue">Color.prototype.colorWithHue(hue)</a>:</p>
  51.205 -<blockquote>
  51.206 -Return a new <a class="mochiref reference" href="#fn-color">Color</a> based on this color, but with the provided
  51.207 -<tt class="docutils literal"><span class="pre">hue</span></tt> value.</blockquote>
  51.208 -<p>
  51.209 -<a name="fn-color.prototype.colorwithsaturation"></a>
  51.210 -<a class="mochidef reference" href="#fn-color.prototype.colorwithsaturation">Color.prototype.colorWithSaturation(saturation)</a>:</p>
  51.211 -<blockquote>
  51.212 -Return a new <a class="mochiref reference" href="#fn-color">Color</a> based on this color, but with the provided
  51.213 -<tt class="docutils literal"><span class="pre">saturation</span></tt> value (using the HSL color model).</blockquote>
  51.214 -<p>
  51.215 -<a name="fn-color.prototype.colorwithlightness"></a>
  51.216 -<a class="mochidef reference" href="#fn-color.prototype.colorwithlightness">Color.prototype.colorWithLightness(lightness)</a>:</p>
  51.217 -<blockquote>
  51.218 -Return a new <a class="mochiref reference" href="#fn-color">Color</a> based on this color, but with the provided
  51.219 -<tt class="docutils literal"><span class="pre">lightness</span></tt> value.</blockquote>
  51.220 -<p>
  51.221 -<a name="fn-color.prototype.darkercolorwithlevel"></a>
  51.222 -<a class="mochidef reference" href="#fn-color.prototype.darkercolorwithlevel">Color.prototype.darkerColorWithLevel(level)</a>:</p>
  51.223 -<blockquote>
  51.224 -Return a new <a class="mochiref reference" href="#fn-color">Color</a> based on this color, but darker by the given
  51.225 -<tt class="docutils literal"><span class="pre">level</span></tt> (between <tt class="docutils literal"><span class="pre">0</span></tt> and <tt class="docutils literal"><span class="pre">1.0</span></tt>).</blockquote>
  51.226 -<p>
  51.227 -<a name="fn-color.prototype.lightercolorwithlevel"></a>
  51.228 -<a class="mochidef reference" href="#fn-color.prototype.lightercolorwithlevel">Color.prototype.lighterColorWithLevel(level)</a>:</p>
  51.229 -<blockquote>
  51.230 -Return a new <a class="mochiref reference" href="#fn-color">Color</a> based on this color, but lighter by the given
  51.231 -<tt class="docutils literal"><span class="pre">level</span></tt> (between <tt class="docutils literal"><span class="pre">0</span></tt> and <tt class="docutils literal"><span class="pre">1.0</span></tt>).</blockquote>
  51.232 -<p>
  51.233 -<a name="fn-color.prototype.blendedcolor"></a>
  51.234 -<a class="mochidef reference" href="#fn-color.prototype.blendedcolor">Color.prototype.blendedColor(other, fraction=0.5)</a>:</p>
  51.235 -<blockquote>
  51.236 -Return a new <a class="mochiref reference" href="#fn-color">Color</a> whose RGBA component values are a weighted sum
  51.237 -of this color and <tt class="docutils literal"><span class="pre">other</span></tt>. Each component of the returned color
  51.238 -is the <tt class="docutils literal"><span class="pre">fraction</span></tt> of other's value plus <tt class="docutils literal"><span class="pre">1</span> <span class="pre">-</span> <span class="pre">fraction</span></tt> of this
  51.239 -color's.</blockquote>
  51.240 -<p>
  51.241 -<a name="fn-color.prototype.islight"></a>
  51.242 -<a class="mochidef reference" href="#fn-color.prototype.islight">Color.prototype.isLight()</a>:</p>
  51.243 -<blockquote>
  51.244 -<p>Return <tt class="docutils literal"><span class="pre">true</span></tt> if the lightness value of this color is greater than
  51.245 -<tt class="docutils literal"><span class="pre">0.5</span></tt>.</p>
  51.246 -<p>Note that <tt class="docutils literal"><span class="pre">alpha</span></tt> is ignored for this calculation (color components
  51.247 -are not premultiplied).</p>
  51.248 -</blockquote>
  51.249 -<p>
  51.250 -<a name="fn-color.prototype.isdark"></a>
  51.251 -<a class="mochidef reference" href="#fn-color.prototype.isdark">Color.prototype.isDark()</a>:</p>
  51.252 -<blockquote>
  51.253 -<p>Return <tt class="docutils literal"><span class="pre">true</span></tt> if the lightness value of this color is less than or
  51.254 -equal to <tt class="docutils literal"><span class="pre">0.5</span></tt>.</p>
  51.255 -<p>Note that <tt class="docutils literal"><span class="pre">alpha</span></tt> is ignored for this calculation (color components
  51.256 -are not premultiplied).</p>
  51.257 -</blockquote>
  51.258 -<p>
  51.259 -<a name="fn-color.prototype.torgbstring"></a>
  51.260 -<a class="mochidef reference" href="#fn-color.prototype.torgbstring">Color.prototype.toRGBString()</a>:</p>
  51.261 -<blockquote>
  51.262 -<p>Return the decimal <tt class="docutils literal"><span class="pre">&quot;rgb(red,</span> <span class="pre">green,</span> <span class="pre">blue)&quot;</span></tt> string representation of this
  51.263 -color.</p>
  51.264 -<p>If the alpha component is not <tt class="docutils literal"><span class="pre">1.0</span></tt> (fully opaque), the
  51.265 -<tt class="docutils literal"><span class="pre">&quot;rgba(red,</span> <span class="pre">green,</span> <span class="pre">blue,</span> <span class="pre">alpha)&quot;</span></tt> string representation will be used.</p>
  51.266 -<p>For example:</p>
  51.267 -<pre class="literal-block">
  51.268 -assert( Color.whiteColor().toRGBString() == &quot;rgb(255,255,255)&quot; );
  51.269 -</pre>
  51.270 -</blockquote>
  51.271 -<p>
  51.272 -<a name="fn-color.prototype.tohslstring"></a>
  51.273 -<a class="mochidef reference" href="#fn-color.prototype.tohslstring">Color.prototype.toHSLString()</a>:</p>
  51.274 -<blockquote>
  51.275 -<p>Return the decimal <tt class="docutils literal"><span class="pre">&quot;hsl(hue,</span> <span class="pre">saturation,</span> <span class="pre">lightness)&quot;</span></tt>
  51.276 -string representation of this color.</p>
  51.277 -<p>If the alpha component is not <tt class="docutils literal"><span class="pre">1.0</span></tt> (fully opaque), the
  51.278 -<tt class="docutils literal"><span class="pre">&quot;hsla(hue,</span> <span class="pre">saturation,</span> <span class="pre">lightness,</span> <span class="pre">alpha)&quot;</span></tt> string representation
  51.279 -will be used.</p>
  51.280 -<p>For example:</p>
  51.281 -<pre class="literal-block">
  51.282 -assert( Color.whiteColor().toHSLString() == &quot;hsl(0,0,360)&quot; );
  51.283 -</pre>
  51.284 -</blockquote>
  51.285 -<p>
  51.286 -<a name="fn-color.prototype.tohexstring"></a>
  51.287 -<a class="mochidef reference" href="#fn-color.prototype.tohexstring">Color.prototype.toHexString()</a>:</p>
  51.288 -<blockquote>
  51.289 -<p>Return the hexadecimal <tt class="docutils literal"><span class="pre">&quot;#RRGGBB&quot;</span></tt> string representation of this color.</p>
  51.290 -<p>Note that the alpha component is completely ignored for hexadecimal
  51.291 -string representations!</p>
  51.292 -<p>For example:</p>
  51.293 -<pre class="literal-block">
  51.294 -assert( Color.whiteColor().toHexString() == &quot;#FFFFFF&quot; );
  51.295 -</pre>
  51.296 -</blockquote>
  51.297 -<p>
  51.298 -<a name="fn-color.prototype.asrgb"></a>
  51.299 -<a class="mochidef reference" href="#fn-color.prototype.asrgb">Color.prototype.asRGB()</a>:</p>
  51.300 -<blockquote>
  51.301 -Return the RGB (red, green, blue, alpha) components of this color as an
  51.302 -object with <tt class="docutils literal"><span class="pre">r</span></tt>, <tt class="docutils literal"><span class="pre">g</span></tt>, <tt class="docutils literal"><span class="pre">b</span></tt>, and <tt class="docutils literal"><span class="pre">a</span></tt> properties that have
  51.303 -values between <tt class="docutils literal"><span class="pre">0.0</span></tt> and <tt class="docutils literal"><span class="pre">1.0</span></tt>.</blockquote>
  51.304 -<p>
  51.305 -<a name="fn-color.prototype.ashsl"></a>
  51.306 -<a class="mochidef reference" href="#fn-color.prototype.ashsl">Color.prototype.asHSL()</a>:</p>
  51.307 -<blockquote>
  51.308 -Return the HSL (hue, saturation, lightness, alpha) components of this
  51.309 -color as an object with <tt class="docutils literal"><span class="pre">h</span></tt>, <tt class="docutils literal"><span class="pre">s</span></tt>, <tt class="docutils literal"><span class="pre">l</span></tt> and <tt class="docutils literal"><span class="pre">a</span></tt> properties
  51.310 -that have values between <tt class="docutils literal"><span class="pre">0.0</span></tt> and <tt class="docutils literal"><span class="pre">1.0</span></tt>.</blockquote>
  51.311 -<p>
  51.312 -<a name="fn-color.prototype.ashsv"></a>
  51.313 -<a class="mochidef reference" href="#fn-color.prototype.ashsv">Color.prototype.asHSV()</a>:</p>
  51.314 -<blockquote>
  51.315 -Return the HSV (hue, saturation, value, alpha) components of this
  51.316 -color as an object with <tt class="docutils literal"><span class="pre">h</span></tt>, <tt class="docutils literal"><span class="pre">s</span></tt>, <tt class="docutils literal"><span class="pre">v</span></tt> and <tt class="docutils literal"><span class="pre">a</span></tt> properties
  51.317 -that have values between <tt class="docutils literal"><span class="pre">0.0</span></tt> and <tt class="docutils literal"><span class="pre">1.0</span></tt>.</blockquote>
  51.318 -<p>
  51.319 -<a name="fn-color.blackcolor"></a>
  51.320 -<a class="mochidef reference" href="#fn-color.blackcolor">Color.blackColor()</a>:</p>
  51.321 -<blockquote>
  51.322 -Return a <a class="mochiref reference" href="#fn-color">Color</a> object whose RGB values are 0, 0, 0
  51.323 -(#000000).</blockquote>
  51.324 -<p>
  51.325 -<a name="fn-color.bluecolor"></a>
  51.326 -<a class="mochidef reference" href="#fn-color.bluecolor">Color.blueColor()</a>:</p>
  51.327 -<blockquote>
  51.328 -Return a <a class="mochiref reference" href="#fn-color">Color</a> object whose RGB values are 0, 0, 1
  51.329 -(#0000ff).</blockquote>
  51.330 -<p>
  51.331 -<a name="fn-color.browncolor"></a>
  51.332 -<a class="mochidef reference" href="#fn-color.browncolor">Color.brownColor()</a>:</p>
  51.333 -<blockquote>
  51.334 -Return a <a class="mochiref reference" href="#fn-color">Color</a> object whose RGB values are 0.6, 0.4, 0.2
  51.335 -(#996633).</blockquote>
  51.336 -<p>
  51.337 -<a name="fn-color.cyancolor"></a>
  51.338 -<a class="mochidef reference" href="#fn-color.cyancolor">Color.cyanColor()</a>:</p>
  51.339 -<blockquote>
  51.340 -Return a <a class="mochiref reference" href="#fn-color">Color</a> object whose RGB values are 0, 1, 1
  51.341 -(#00ffff).</blockquote>
  51.342 -<p>
  51.343 -<a name="fn-color.darkgraycolor"></a>
  51.344 -<a class="mochidef reference" href="#fn-color.darkgraycolor">Color.darkGrayColor()</a>:</p>
  51.345 -<blockquote>
  51.346 -Return a <a class="mochiref reference" href="#fn-color">Color</a> object whose RGB values are 1/3, 1/3, 1/3
  51.347 -(#555555).</blockquote>
  51.348 -<p>
  51.349 -<a name="fn-color.graycolor"></a>
  51.350 -<a class="mochidef reference" href="#fn-color.graycolor">Color.grayColor()</a>:</p>
  51.351 -<blockquote>
  51.352 -Return a <a class="mochiref reference" href="#fn-color">Color</a> object whose RGB values are 0.5, 0.5, 0.5
  51.353 -(#808080).</blockquote>
  51.354 -<p>
  51.355 -<a name="fn-color.greencolor"></a>
  51.356 -<a class="mochidef reference" href="#fn-color.greencolor">Color.greenColor()</a>:</p>
  51.357 -<blockquote>
  51.358 -Return a <a class="mochiref reference" href="#fn-color">Color</a> object whose RGB values are 0, 1, 0.
  51.359 -(#00ff00).</blockquote>
  51.360 -<p>
  51.361 -<a name="fn-color.lightgraycolor"></a>
  51.362 -<a class="mochidef reference" href="#fn-color.lightgraycolor">Color.lightGrayColor()</a>:</p>
  51.363 -<blockquote>
  51.364 -Return a <a class="mochiref reference" href="#fn-color">Color</a> object whose RGB values are 2/3, 2/3, 2/3
  51.365 -(#aaaaaa).</blockquote>
  51.366 -<p>
  51.367 -<a name="fn-color.magentacolor"></a>
  51.368 -<a class="mochidef reference" href="#fn-color.magentacolor">Color.magentaColor()</a>:</p>
  51.369 -<blockquote>
  51.370 -Return a <a class="mochiref reference" href="#fn-color">Color</a> object whose RGB values are 1, 0, 1
  51.371 -(#ff00ff).</blockquote>
  51.372 -<p>
  51.373 -<a name="fn-color.orangecolor"></a>
  51.374 -<a class="mochidef reference" href="#fn-color.orangecolor">Color.orangeColor()</a>:</p>
  51.375 -<blockquote>
  51.376 -Return a <a class="mochiref reference" href="#fn-color">Color</a> object whose RGB values are 1, 0.5, 0
  51.377 -(#ff8000).</blockquote>
  51.378 -<p>
  51.379 -<a name="fn-color.purplecolor"></a>
  51.380 -<a class="mochidef reference" href="#fn-color.purplecolor">Color.purpleColor()</a>:</p>
  51.381 -<blockquote>
  51.382 -Return a <a class="mochiref reference" href="#fn-color">Color</a> object whose RGB values are 0.5, 0, 0.5
  51.383 -(#800080).</blockquote>
  51.384 -<p>
  51.385 -<a name="fn-color.redcolor"></a>
  51.386 -<a class="mochidef reference" href="#fn-color.redcolor">Color.redColor()</a>:</p>
  51.387 -<blockquote>
  51.388 -Return a <a class="mochiref reference" href="#fn-color">Color</a> object whose RGB values are 1, 0, 0
  51.389 -(#ff0000).</blockquote>
  51.390 -<p>
  51.391 -<a name="fn-color.whitecolor"></a>
  51.392 -<a class="mochidef reference" href="#fn-color.whitecolor">Color.whiteColor()</a>:</p>
  51.393 -<blockquote>
  51.394 -Return a <a class="mochiref reference" href="#fn-color">Color</a> object whose RGB values are 1, 1, 1
  51.395 -(#ffffff).</blockquote>
  51.396 -<p>
  51.397 -<a name="fn-color.yellowcolor"></a>
  51.398 -<a class="mochidef reference" href="#fn-color.yellowcolor">Color.yellowColor()</a>:</p>
  51.399 -<blockquote>
  51.400 -Return a <a class="mochiref reference" href="#fn-color">Color</a> object whose RGB values are 1, 1, 0
  51.401 -(#ffff00).</blockquote>
  51.402 -<p>
  51.403 -<a name="fn-color.transparentcolor"></a>
  51.404 -<a class="mochidef reference" href="#fn-color.transparentcolor">Color.transparentColor()</a>:</p>
  51.405 -<blockquote>
  51.406 -Return a <a class="mochiref reference" href="#fn-color">Color</a> object that is completely transparent
  51.407 -(has alpha component of 0).</blockquote>
  51.408 -</div>
  51.409 -<div class="section">
  51.410 -<h2><a id="functions" name="functions">Functions</a></h2>
  51.411 -<p>
  51.412 -<a name="fn-clampcolorcomponent"></a>
  51.413 -<a class="mochidef reference" href="#fn-clampcolorcomponent">clampColorComponent(num, scale)</a>:</p>
  51.414 -<blockquote>
  51.415 -<p>Returns <tt class="docutils literal"><span class="pre">num</span> <span class="pre">*</span> <span class="pre">scale</span></tt> clamped between <tt class="docutils literal"><span class="pre">0</span></tt> and <tt class="docutils literal"><span class="pre">scale</span></tt>.</p>
  51.416 -<p><a class="mochiref reference" href="#fn-clampcolorcomponent">clampColorComponent</a> is not exported by default when using JSAN.</p>
  51.417 -</blockquote>
  51.418 -<p>
  51.419 -<a name="fn-hsltorgb"></a>
  51.420 -<a class="mochidef reference" href="#fn-hsltorgb">hslToRGB(hue, saturation, lightness, alpha)</a>:</p>
  51.421 -<blockquote>
  51.422 -<p>Computes RGB values from the provided HSL values. The return value is a
  51.423 -mapping with <tt class="docutils literal"><span class="pre">&quot;r&quot;</span></tt>, <tt class="docutils literal"><span class="pre">&quot;g&quot;</span></tt>, <tt class="docutils literal"><span class="pre">&quot;b&quot;</span></tt> and <tt class="docutils literal"><span class="pre">&quot;a&quot;</span></tt> keys.</p>
  51.424 -<dl class="docutils">
  51.425 -<dt>Alternate form:</dt>
  51.426 -<dd><a class="mochiref reference" href="#fn-hsltorgb">hslToRGB({h: hue, s: saturation, l: lightness, a: alpha})</a>.</dd>
  51.427 -</dl>
  51.428 -<p><a class="mochiref reference" href="#fn-hsltorgb">hslToRGB</a> is not exported by default when using JSAN.</p>
  51.429 -</blockquote>
  51.430 -<p>
  51.431 -<a name="fn-hsvtorgb"></a>
  51.432 -<a class="mochidef reference" href="#fn-hsvtorgb">hsvToRGB(hue, saturation, value, alpha)</a>:</p>
  51.433 -<blockquote>
  51.434 -<p>Computes RGB values from the provided HSV values. The return value is a
  51.435 -mapping with <tt class="docutils literal"><span class="pre">&quot;r&quot;</span></tt>, <tt class="docutils literal"><span class="pre">&quot;g&quot;</span></tt>, <tt class="docutils literal"><span class="pre">&quot;b&quot;</span></tt> and <tt class="docutils literal"><span class="pre">&quot;a&quot;</span></tt> keys.</p>
  51.436 -<dl class="docutils">
  51.437 -<dt>Alternate form:</dt>
  51.438 -<dd><a class="mochiref reference" href="#fn-hsvtorgb">hsvToRGB({h: hue, s: saturation, v: value, a: alpha})</a>.</dd>
  51.439 -</dl>
  51.440 -<p><a class="mochiref reference" href="#fn-hsvtorgb">hsvToRGB</a> is not exported by default when using JSAN.</p>
  51.441 -</blockquote>
  51.442 -<p>
  51.443 -<a name="fn-tocolorpart"></a>
  51.444 -<a class="mochidef reference" href="#fn-tocolorpart">toColorPart(num)</a>:</p>
  51.445 -<blockquote>
  51.446 -<p>Convert num to a zero padded hexadecimal digit for use in a hexadecimal
  51.447 -color string. Num should be an integer between <tt class="docutils literal"><span class="pre">0</span></tt> and <tt class="docutils literal"><span class="pre">255</span></tt>.</p>
  51.448 -<p><a class="mochiref reference" href="#fn-tocolorpart">toColorPart</a> is not exported by default when using JSAN.</p>
  51.449 -</blockquote>
  51.450 -<p>
  51.451 -<a name="fn-rgbtohsl"></a>
  51.452 -<a class="mochidef reference" href="#fn-rgbtohsl">rgbToHSL(red, green, blue, alpha)</a>:</p>
  51.453 -<blockquote>
  51.454 -<p>Computes HSL values based on the provided RGB values. The return value is
  51.455 -a mapping with <tt class="docutils literal"><span class="pre">&quot;h&quot;</span></tt>, <tt class="docutils literal"><span class="pre">&quot;s&quot;</span></tt>, <tt class="docutils literal"><span class="pre">&quot;l&quot;</span></tt> and <tt class="docutils literal"><span class="pre">&quot;a&quot;</span></tt> keys.</p>
  51.456 -<dl class="docutils">
  51.457 -<dt>Alternate form:</dt>
  51.458 -<dd><a class="mochiref reference" href="#fn-rgbtohsl">rgbToHSL({r: red, g: green, b: blue, a: alpha})</a>.</dd>
  51.459 -</dl>
  51.460 -<p><a class="mochiref reference" href="#fn-rgbtohsl">rgbToHSL</a> is not exported by default when using JSAN.</p>
  51.461 -</blockquote>
  51.462 -<p>
  51.463 -<a name="fn-rgbtohsv"></a>
  51.464 -<a class="mochidef reference" href="#fn-rgbtohsv">rgbToHSV(red, green, blue, alpha)</a>:</p>
  51.465 -<blockquote>
  51.466 -<p>Computes HSV values based on the provided RGB values. The return value is
  51.467 -a mapping with <tt class="docutils literal"><span class="pre">&quot;h&quot;</span></tt>, <tt class="docutils literal"><span class="pre">&quot;s&quot;</span></tt>, <tt class="docutils literal"><span class="pre">&quot;v&quot;</span></tt> and <tt class="docutils literal"><span class="pre">&quot;a&quot;</span></tt> keys.</p>
  51.468 -<dl class="docutils">
  51.469 -<dt>Alternate form:</dt>
  51.470 -<dd><a class="mochiref reference" href="#fn-rgbtohsv">rgbToHSV({r: red, g: green, b: blue, a: alpha})</a>.</dd>
  51.471 -</dl>
  51.472 -<p><a class="mochiref reference" href="#fn-rgbtohsv">rgbToHSV</a> is not exported by default when using JSAN.</p>
  51.473 -</blockquote>
  51.474 -</div>
  51.475 -</div>
  51.476 -<div class="section">
  51.477 -<h1><a id="see-also" name="see-also">See Also</a></h1>
  51.478 -<table class="docutils footnote" frame="void" id="id6" rules="none">
  51.479 -<colgroup><col class="label" /><col /></colgroup>
  51.480 -<tbody valign="top">
  51.481 -<tr><td class="label"><a class="fn-backref" href="#id1" name="id6">[1]</a></td><td>Application Kit Reference - NSColor: <a class="reference" href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSColor.html">http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSColor.html</a></td></tr>
  51.482 -</tbody>
  51.483 -</table>
  51.484 -<table class="docutils footnote" frame="void" id="id7" rules="none">
  51.485 -<colgroup><col class="label" /><col /></colgroup>
  51.486 -<tbody valign="top">
  51.487 -<tr><td class="label"><a name="id7">[2]</a></td><td><em>(<a class="fn-backref" href="#id2">1</a>, <a class="fn-backref" href="#id4">2</a>)</em> SVG 1.0 color keywords: <a class="reference" href="http://www.w3.org/TR/SVG/types.html#ColorKeywords">http://www.w3.org/TR/SVG/types.html#ColorKeywords</a></td></tr>
  51.488 -</tbody>
  51.489 -</table>
  51.490 -<table class="docutils footnote" frame="void" id="id8" rules="none">
  51.491 -<colgroup><col class="label" /><col /></colgroup>
  51.492 -<tbody valign="top">
  51.493 -<tr><td class="label"><a name="id8">[3]</a></td><td><em>(<a class="fn-backref" href="#id3">1</a>, <a class="fn-backref" href="#id5">2</a>)</em> W3C CSS3 Color Module: <a class="reference" href="http://www.w3.org/TR/css3-color/#svg-color">http://www.w3.org/TR/css3-color/#svg-color</a></td></tr>
  51.494 -</tbody>
  51.495 -</table>
  51.496 -</div>
  51.497 -<div class="section">
  51.498 -<h1><a id="authors" name="authors">Authors</a></h1>
  51.499 -<ul class="simple">
  51.500 -<li>Bob Ippolito &lt;<a class="reference" href="mailto:bob&#64;redivi.com">bob&#64;redivi.com</a>&gt;</li>
  51.501 -</ul>
  51.502 -</div>
  51.503 -<div class="section">
  51.504 -<h1><a id="copyright" name="copyright">Copyright</a></h1>
  51.505 -<p>Copyright 2005 Bob Ippolito &lt;<a class="reference" href="mailto:bob&#64;redivi.com">bob&#64;redivi.com</a>&gt;. This program is dual-licensed
  51.506 -free software; you can redistribute it and/or modify it under the terms of the
  51.507 -<a class="reference" href="http://www.opensource.org/licenses/mit-license.php">MIT License</a> or the <a class="reference" href="http://www.opensource.org/licenses/afl-2.1.php">Academic Free License v2.1</a>.</p>
  51.508 -</div>
  51.509 -</div>
  51.510 -
  51.511 -</body>
  51.512 -</html>
    52.1 --- a/pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/DOM.html	Mon Apr 13 12:51:06 2009 +0200
    52.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.3 @@ -1,798 +0,0 @@
    52.4 -<?xml version="1.0" encoding="utf-8" ?>
    52.5 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    52.6 -
    52.7 -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    52.8 -<head>
    52.9 -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   52.10 -<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
   52.11 -<title>MochiKit.DOM - painless DOM manipulation API</title>
   52.12 -
   52.13 -<link rel="stylesheet" href="../../../include/css/documentation.css" type="text/css" />
   52.14 -<script type="text/javascript" src="../../../packed/lib/MochiKit/MochiKit.js"></script>
   52.15 -<script type="text/javascript" src="../../js/toc.js"></script>
   52.16 -</head>
   52.17 -<body>
   52.18 -<div class="document">
   52.19 -<div class="section">
   52.20 -<h1><a id="name" name="name">Name</a></h1>
   52.21 -<p>MochiKit.DOM - painless DOM manipulation API</p>
   52.22 -</div>
   52.23 -<div class="section">
   52.24 -<h1><a id="synopsis" name="synopsis">Synopsis</a></h1>
   52.25 -<pre class="literal-block">
   52.26 -var rows = [
   52.27 -    [&quot;dataA1&quot;, &quot;dataA2&quot;, &quot;dataA3&quot;],
   52.28 -    [&quot;dataB1&quot;, &quot;dataB2&quot;, &quot;dataB3&quot;]
   52.29 -];
   52.30 -row_display = function (row) {
   52.31 -    return TR(null, map(partial(TD, null), row));
   52.32 -}
   52.33 -var newTable = TABLE({'class': 'prettytable'},
   52.34 -    THEAD(null,
   52.35 -        row_display([&quot;head1&quot;, &quot;head2&quot;, &quot;head3&quot;])),
   52.36 -    TFOOT(null,
   52.37 -        row_display([&quot;foot1&quot;, &quot;foot2&quot;, &quot;foot3&quot;])),
   52.38 -    TBODY(null,
   52.39 -        map(row_display, rows)));
   52.40 -// put that in your document.createElement and smoke it!
   52.41 -swapDOM(oldTable, newTable);
   52.42 -</pre>
   52.43 -</div>
   52.44 -<div class="section">
   52.45 -<h1><a id="description" name="description">Description</a></h1>
   52.46 -<p>As you probably know, the DOM APIs are some of the most painful Java-inspired
   52.47 -APIs you'll run across from a highly dynamic language. Don't worry about that
   52.48 -though, because they provide a reasonable basis to build something that
   52.49 -sucks a lot less.</p>
   52.50 -<p>MochiKit.DOM takes much of its inspiration from Nevow's <a class="footnote-reference" href="#id5" id="id1" name="id1">[1]</a> stan <a class="footnote-reference" href="#id6" id="id2" name="id2">[2]</a>.
   52.51 -This means you choose a tag, give it some attributes, then stuff it full
   52.52 -of <em>whatever objects you want</em>. MochiKit.DOM isn't stupid, it knows that
   52.53 -a string should be a text node, and that you want functions to be called,
   52.54 -and that <tt class="docutils literal"><span class="pre">Array</span></tt>-like objects should be expanded, and stupid <tt class="docutils literal"><span class="pre">null</span></tt> values
   52.55 -should be skipped.</p>
   52.56 -<p>Hell, it will let you return strings from functions, and use iterators from
   52.57 -<a class="mochiref reference" href="Iter.html">MochiKit.Iter</a>. If that's not enough, just teach it new tricks with
   52.58 -<a class="mochiref reference" href="#fn-registerdomconverter">registerDOMConverter</a>. If you have never used an API like this for
   52.59 -creating DOM elements, you've been wasting your damn time. Get with it!</p>
   52.60 -</div>
   52.61 -<div class="section">
   52.62 -<h1><a id="dependencies" name="dependencies">Dependencies</a></h1>
   52.63 -<ul class="simple">
   52.64 -<li><a class="mochiref reference" href="Base.html">MochiKit.Base</a></li>
   52.65 -<li><a class="mochiref reference" href="Iter.html">MochiKit.Iter</a></li>
   52.66 -</ul>
   52.67 -</div>
   52.68 -<div class="section">
   52.69 -<h1><a id="overview" name="overview">Overview</a></h1>
   52.70 -<div class="section">
   52.71 -<h2><a id="dom-coercion-rules" name="dom-coercion-rules">DOM Coercion Rules</a></h2>
   52.72 -<p>In order of precedence, <a class="mochiref reference" href="#fn-createdom">createDOM</a> coerces given arguments to DOM
   52.73 -nodes using the following rules:</p>
   52.74 -<ol class="arabic simple">
   52.75 -<li>Functions are called with a <tt class="docutils literal"><span class="pre">this</span></tt> of the parent
   52.76 -node and their return value is subject to the
   52.77 -following rules (even this one).</li>
   52.78 -<li><tt class="docutils literal"><span class="pre">undefined</span></tt> and <tt class="docutils literal"><span class="pre">null</span></tt> are ignored.</li>
   52.79 -<li>Iterables (see <a class="mochiref reference" href="Iter.html">MochiKit.Iter</a>) are flattened
   52.80 -(as if they were passed in-line as nodes) and each
   52.81 -return value is subject to all of these rules.</li>
   52.82 -<li>Values that look like DOM nodes (objects with a
   52.83 -<tt class="docutils literal"><span class="pre">.nodeType</span> <span class="pre">&gt;</span> <span class="pre">0</span></tt>) are <tt class="docutils literal"><span class="pre">.appendChild</span></tt>'ed to the created
   52.84 -DOM fragment.</li>
   52.85 -<li>Strings are wrapped up with <tt class="docutils literal"><span class="pre">document.createTextNode</span></tt></li>
   52.86 -<li>Objects that are not strings are run through the <tt class="docutils literal"><span class="pre">domConverters</span></tt>
   52.87 -<a class="mochiref reference" href="Base.html#fn-adapterregistry">MochiKit.Base.AdapterRegistry</a>
   52.88 -(see <a class="mochiref reference" href="#fn-registerdomconverter">registerDOMConverter</a>).
   52.89 -The value returned by the adapter is subject to these same rules (e.g.
   52.90 -adapters are allowed to return a string, which will be coerced into a
   52.91 -text node).</li>
   52.92 -<li>If no adapter is available, <tt class="docutils literal"><span class="pre">.toString()</span></tt> is used to create a text node.</li>
   52.93 -</ol>
   52.94 -</div>
   52.95 -<div class="section">
   52.96 -<h2><a id="creating-dom-element-trees" name="creating-dom-element-trees">Creating DOM Element Trees</a></h2>
   52.97 -<p><a class="mochiref reference" href="#fn-createdom">createDOM</a> provides you with an excellent facility for creating DOM trees
   52.98 -that is easy on the wrists. One of the best ways to understand how to use
   52.99 -it is to take a look at an example:</p>
  52.100 -<pre class="literal-block">
  52.101 -var rows = [
  52.102 -    [&quot;dataA1&quot;, &quot;dataA2&quot;, &quot;dataA3&quot;],
  52.103 -    [&quot;dataB1&quot;, &quot;dataB2&quot;, &quot;dataB3&quot;]
  52.104 -];
  52.105 -row_display = function (row) {
  52.106 -    return TR(null, map(partial(TD, null), row));
  52.107 -}
  52.108 -var newTable = TABLE({'class': 'prettytable'},
  52.109 -    THEAD(null,
  52.110 -        row_display([&quot;head1&quot;, &quot;head2&quot;, &quot;head3&quot;])),
  52.111 -    TFOOT(null,
  52.112 -        row_display([&quot;foot1&quot;, &quot;foot2&quot;, &quot;foot3&quot;])),
  52.113 -    TBODY(null,
  52.114 -        map(row_display, rows)));
  52.115 -</pre>
  52.116 -<p>This will create a table with the following visual layout (if it
  52.117 -were inserted into the document DOM):</p>
  52.118 -<blockquote>
  52.119 -<table border="1" class="docutils">
  52.120 -<colgroup>
  52.121 -<col width="33%" />
  52.122 -<col width="33%" />
  52.123 -<col width="33%" />
  52.124 -</colgroup>
  52.125 -<thead valign="bottom">
  52.126 -<tr><th class="head">head1</th>
  52.127 -<th class="head">head2</th>
  52.128 -<th class="head">head3</th>
  52.129 -</tr>
  52.130 -</thead>
  52.131 -<tbody valign="top">
  52.132 -<tr><td>dataA1</td>
  52.133 -<td>dataA2</td>
  52.134 -<td>dataA3</td>
  52.135 -</tr>
  52.136 -<tr><td>dataB1</td>
  52.137 -<td>dataB2</td>
  52.138 -<td>dataB3</td>
  52.139 -</tr>
  52.140 -<tr><td>foot1</td>
  52.141 -<td>foot2</td>
  52.142 -<td>foot3</td>
  52.143 -</tr>
  52.144 -</tbody>
  52.145 -</table>
  52.146 -</blockquote>
  52.147 -<p>Corresponding to the following HTML:</p>
  52.148 -<pre class="literal-block">
  52.149 -&lt;table class=&quot;prettytable&quot;&gt;
  52.150 -    &lt;thead&gt;
  52.151 -        &lt;tr&gt;
  52.152 -            &lt;td&gt;head1&lt;/td&gt;
  52.153 -            &lt;td&gt;head2&lt;/td&gt;
  52.154 -            &lt;td&gt;head3&lt;/td&gt;
  52.155 -        &lt;/tr&gt;
  52.156 -    &lt;/thead&gt;
  52.157 -    &lt;tfoot&gt;
  52.158 -        &lt;tr&gt;
  52.159 -            &lt;td&gt;foot1&lt;/td&gt;
  52.160 -            &lt;td&gt;foot2&lt;/td&gt;
  52.161 -            &lt;td&gt;foot3&lt;/td&gt;
  52.162 -        &lt;/tr&gt;
  52.163 -    &lt;/tfoot&gt;
  52.164 -    &lt;tbody&gt;
  52.165 -        &lt;tr&gt;
  52.166 -            &lt;td&gt;dataA1&lt;/td&gt;
  52.167 -            &lt;td&gt;dataA2&lt;/td&gt;
  52.168 -            &lt;td&gt;dataA3&lt;/td&gt;
  52.169 -        &lt;/tr&gt;
  52.170 -        &lt;tr&gt;
  52.171 -            &lt;td&gt;dataB1&lt;/td&gt;
  52.172 -            &lt;td&gt;dataB2&lt;/td&gt;
  52.173 -            &lt;td&gt;dataB3&lt;/td&gt;
  52.174 -        &lt;/tr&gt;
  52.175 -    &lt;/tbody&gt;
  52.176 -&lt;/table&gt;
  52.177 -</pre>
  52.178 -</div>
  52.179 -<div class="section">
  52.180 -<h2><a id="dom-context" name="dom-context">DOM Context</a></h2>
  52.181 -<p>In order to prevent having to pass a <tt class="docutils literal"><span class="pre">window</span></tt> and/or <tt class="docutils literal"><span class="pre">document</span></tt>
  52.182 -variable to every MochiKit.DOM function (e.g. when working with a
  52.183 -child window), MochiKit.DOM maintains a context variable for each
  52.184 -of them. They are managed with the <a class="mochiref reference" href="#fn-withwindow">withWindow</a> and
  52.185 -<a class="mochiref reference" href="#fn-withdocument">withDocument</a> functions, and can be acquired with
  52.186 -<a class="mochiref reference" href="#fn-currentwindow">currentWindow()</a> and <a class="mochiref reference" href="#fn-currentdocument">currentDocument()</a></p>
  52.187 -<p>For example, if you are creating DOM nodes in a child window, you
  52.188 -could do something like this:</p>
  52.189 -<pre class="literal-block">
  52.190 -withWindow(child, function () {
  52.191 -    var doc = currentDocument();
  52.192 -    appendChildNodes(doc.body, H1(null, &quot;This is in the child!&quot;));
  52.193 -});
  52.194 -</pre>
  52.195 -<p>Note that <a class="mochiref reference" href="#fn-withwindow">withWindow(win, ...)</a> also implies
  52.196 -<a class="mochiref reference" href="#fn-withdocument">withDocument(win.document, ...)</a>.</p>
  52.197 -</div>
  52.198 -<div class="section">
  52.199 -<h2><a id="element-visibility" name="element-visibility">Element Visibility</a></h2>
  52.200 -<p>The <a class="mochiref reference" href="#fn-hideelement">hideElement</a> and <a class="mochiref reference" href="#fn-showelement">showElement</a> functions are
  52.201 -provided as a convenience, but only work for elements that are
  52.202 -<tt class="docutils literal"><span class="pre">display:</span> <span class="pre">block</span></tt>. For a general solution to showing, hiding, and checking
  52.203 -the explicit visibility of elements, we recommend using a solution that
  52.204 -involves a little CSS. Here's an example:</p>
  52.205 -<pre class="literal-block">
  52.206 -&lt;style type=&quot;text/css&quot;&gt;
  52.207 -    .invisible { display: none; }
  52.208 -&lt;/style&gt;
  52.209 -
  52.210 -&lt;script type=&quot;text/javascript&quot;&gt;
  52.211 -    function toggleVisible(elem) {
  52.212 -        toggleElementClass(&quot;invisible&quot;, elem);
  52.213 -    }
  52.214 -
  52.215 -    function makeVisible(elem) {
  52.216 -        removeElementClass(elem, &quot;invisible&quot;);
  52.217 -    }
  52.218 -
  52.219 -    function makeInvisible(elem) {
  52.220 -        addElementClass(elem, &quot;invisible&quot;);
  52.221 -    }
  52.222 -
  52.223 -    function isVisible(elem) {
  52.224 -        // you may also want to check for
  52.225 -        // getElement(elem).style.display == &quot;none&quot;
  52.226 -        return !hasElementClass(elem, &quot;invisible&quot;);
  52.227 -    };
  52.228 -&lt;/script&gt;
  52.229 -</pre>
  52.230 -<p>MochiKit doesn't ship with such a solution, because there is no reliable and
  52.231 -portable method for adding CSS rules on the fly with JavaScript.</p>
  52.232 -</div>
  52.233 -</div>
  52.234 -<div class="section">
  52.235 -<h1><a id="api-reference" name="api-reference">API Reference</a></h1>
  52.236 -<div class="section">
  52.237 -<h2><a id="functions" name="functions">Functions</a></h2>
  52.238 -<p>
  52.239 -<a name="fn-$"></a>
  52.240 -<a class="mochidef reference" href="#fn-$">$(id[, ...])</a>:</p>
  52.241 -<blockquote>
  52.242 -An alias for <a class="mochiref reference" href="#fn-getelement">getElement(id[, ...])</a></blockquote>
  52.243 -<p>
  52.244 -<a name="fn-addelementclass"></a>
  52.245 -<a class="mochidef reference" href="#fn-addelementclass">addElementClass(element, className)</a>:</p>
  52.246 -<blockquote>
  52.247 -Ensure that the given <tt class="docutils literal"><span class="pre">element</span></tt> has <tt class="docutils literal"><span class="pre">className</span></tt> set as part of its
  52.248 -class attribute. This will not disturb other class names.
  52.249 -<tt class="docutils literal"><span class="pre">element</span></tt> is looked up with <a class="mochiref reference" href="#fn-getelement">getElement</a>, so string identifiers
  52.250 -are also acceptable.</blockquote>
  52.251 -<p>
  52.252 -<a name="fn-addloadevent"></a>
  52.253 -<a class="mochidef reference" href="#fn-addloadevent">addLoadEvent(func)</a>:</p>
  52.254 -<blockquote>
  52.255 -<p>Note that <a class="mochiref reference" href="#fn-addloadevent">addLoadEvent</a> can not be used in combination with
  52.256 -<a class="mochiref reference" href="Signal.html">MochiKit.Signal</a> if the <tt class="docutils literal"><span class="pre">onload</span></tt> event is connected.
  52.257 -Once an event is connected with <a class="mochiref reference" href="Signal.html">MochiKit.Signal</a>, no other APIs
  52.258 -may be used for that same event.</p>
  52.259 -<p>This will stack <tt class="docutils literal"><span class="pre">window.onload</span></tt> functions on top of each other.
  52.260 -Each function added will be called after <tt class="docutils literal"><span class="pre">onload</span></tt> in the
  52.261 -order that they were added.</p>
  52.262 -</blockquote>
  52.263 -<p>
  52.264 -<a name="fn-addtocallstack"></a>
  52.265 -<a class="mochidef reference" href="#fn-addtocallstack">addToCallStack(target, path, func[, once])</a>:</p>
  52.266 -<blockquote>
  52.267 -<p>Note that <a class="mochiref reference" href="#fn-addtocallstack">addToCallStack</a> is not compatible with
  52.268 -<a class="mochiref reference" href="Signal.html">MochiKit.Signal</a>. Once an event is connected with
  52.269 -<a class="mochiref reference" href="Signal.html">MochiKit.Signal</a>, no other APIs may be used for that same event.</p>
  52.270 -<p>Set the property <tt class="docutils literal"><span class="pre">path</span></tt> of <tt class="docutils literal"><span class="pre">target</span></tt> to a function that calls the
  52.271 -existing function at that property (if any), then calls <tt class="docutils literal"><span class="pre">func</span></tt>.</p>
  52.272 -<p>If <tt class="docutils literal"><span class="pre">target[path]()</span></tt> returns exactly <tt class="docutils literal"><span class="pre">false</span></tt>, then <tt class="docutils literal"><span class="pre">func</span></tt> will
  52.273 -not be called.</p>
  52.274 -<p>If <tt class="docutils literal"><span class="pre">once</span></tt> is <tt class="docutils literal"><span class="pre">true</span></tt>, then <tt class="docutils literal"><span class="pre">target[path]</span></tt> is set to <tt class="docutils literal"><span class="pre">null</span></tt> after
  52.275 -the function call stack has completed.</p>
  52.276 -<p>If called several times for the same <tt class="docutils literal"><span class="pre">target[path]</span></tt>, it will create
  52.277 -a stack of functions (instead of just a pair).</p>
  52.278 -</blockquote>
  52.279 -<p>
  52.280 -<a name="fn-appendchildnodes"></a>
  52.281 -<a class="mochidef reference" href="#fn-appendchildnodes">appendChildNodes(node[, childNode[, ...]])</a>:</p>
  52.282 -<blockquote>
  52.283 -<p>Append children to a DOM element using the <a class="reference" href="#dom-coercion-rules">DOM Coercion Rules</a>.</p>
  52.284 -<dl class="docutils">
  52.285 -<dt><tt class="docutils literal"><span class="pre">node</span></tt>:</dt>
  52.286 -<dd>A reference to the DOM element to add children to
  52.287 -(if a string is given, <a class="mochiref reference" href="#fn-getelement">getElement(node)</a>
  52.288 -will be used to locate the node)</dd>
  52.289 -<dt><tt class="docutils literal"><span class="pre">childNode</span></tt>...:</dt>
  52.290 -<dd>All additional arguments, if any, will be coerced into DOM
  52.291 -nodes that are appended as children using the
  52.292 -<a class="reference" href="#dom-coercion-rules">DOM Coercion Rules</a>.</dd>
  52.293 -<dt><em>returns</em>:</dt>
  52.294 -<dd>The given DOM element</dd>
  52.295 -</dl>
  52.296 -</blockquote>
  52.297 -<p>
  52.298 -<a name="fn-computedstyle"></a>
  52.299 -<a class="mochidef reference" href="#fn-computedstyle">computedStyle(htmlElement, cssProperty, mozillaEquivalentCSS)</a>:</p>
  52.300 -<blockquote>
  52.301 -Looks up a CSS property for the given element. The element can be
  52.302 -specified as either a string with the element's ID or the element
  52.303 -object itself.</blockquote>
  52.304 -<p>
  52.305 -<a name="fn-createdom"></a>
  52.306 -<a class="mochidef reference" href="#fn-createdom">createDOM(name[, attrs[, node[, ...]]])</a>:</p>
  52.307 -<blockquote>
  52.308 -<p>Create a DOM fragment in a really convenient manner, much like
  52.309 -Nevow`s <a class="footnote-reference" href="#id5" id="id3" name="id3">[1]</a> stan <a class="footnote-reference" href="#id6" id="id4" name="id4">[2]</a>.</p>
  52.310 -<p>Partially applied versions of this function for common tags are
  52.311 -available as aliases:</p>
  52.312 -<ul class="simple">
  52.313 -<li><tt class="docutils literal"><span class="pre">A</span></tt></li>
  52.314 -<li><tt class="docutils literal"><span class="pre">BUTTON</span></tt></li>
  52.315 -<li><tt class="docutils literal"><span class="pre">BR</span></tt></li>
  52.316 -<li><tt class="docutils literal"><span class="pre">CANVAS</span></tt></li>
  52.317 -<li><tt class="docutils literal"><span class="pre">DIV</span></tt></li>
  52.318 -<li><tt class="docutils literal"><span class="pre">FIELDSET</span></tt></li>
  52.319 -<li><tt class="docutils literal"><span class="pre">FORM</span></tt></li>
  52.320 -<li><tt class="docutils literal"><span class="pre">H1</span></tt></li>
  52.321 -<li><tt class="docutils literal"><span class="pre">H2</span></tt></li>
  52.322 -<li><tt class="docutils literal"><span class="pre">H3</span></tt></li>
  52.323 -<li><tt class="docutils literal"><span class="pre">HR</span></tt></li>
  52.324 -<li><tt class="docutils literal"><span class="pre">IMG</span></tt></li>
  52.325 -<li><tt class="docutils literal"><span class="pre">INPUT</span></tt></li>
  52.326 -<li><tt class="docutils literal"><span class="pre">LABEL</span></tt></li>
  52.327 -<li><tt class="docutils literal"><span class="pre">LEGEND</span></tt></li>
  52.328 -<li><tt class="docutils literal"><span class="pre">LI</span></tt></li>
  52.329 -<li><tt class="docutils literal"><span class="pre">OL</span></tt></li>
  52.330 -<li><tt class="docutils literal"><span class="pre">OPTGROUP</span></tt></li>
  52.331 -<li><tt class="docutils literal"><span class="pre">OPTION</span></tt></li>
  52.332 -<li><tt class="docutils literal"><span class="pre">P</span></tt></li>
  52.333 -<li><tt class="docutils literal"><span class="pre">PRE</span></tt></li>
  52.334 -<li><tt class="docutils literal"><span class="pre">SELECT</span></tt></li>
  52.335 -<li><tt class="docutils literal"><span class="pre">SPAN</span></tt></li>
  52.336 -<li><tt class="docutils literal"><span class="pre">STRONG</span></tt></li>
  52.337 -<li><tt class="docutils literal"><span class="pre">TABLE</span></tt></li>
  52.338 -<li><tt class="docutils literal"><span class="pre">TBODY</span></tt></li>
  52.339 -<li><tt class="docutils literal"><span class="pre">TD</span></tt></li>
  52.340 -<li><tt class="docutils literal"><span class="pre">TEXTAREA</span></tt></li>
  52.341 -<li><tt class="docutils literal"><span class="pre">TFOOT</span></tt></li>
  52.342 -<li><tt class="docutils literal"><span class="pre">TH</span></tt></li>
  52.343 -<li><tt class="docutils literal"><span class="pre">THEAD</span></tt></li>
  52.344 -<li><tt class="docutils literal"><span class="pre">TR</span></tt></li>
  52.345 -<li><tt class="docutils literal"><span class="pre">TT</span></tt></li>
  52.346 -<li><tt class="docutils literal"><span class="pre">UL</span></tt></li>
  52.347 -</ul>
  52.348 -<p>See <a class="reference" href="#creating-dom-element-trees">Creating DOM Element Trees</a> for a comprehensive example.</p>
  52.349 -<dl class="docutils">
  52.350 -<dt><tt class="docutils literal"><span class="pre">name</span></tt>:</dt>
  52.351 -<dd>The kind of fragment to create (e.g. 'span'), such as you would
  52.352 -pass to <tt class="docutils literal"><span class="pre">document.createElement</span></tt>.</dd>
  52.353 -<dt><tt class="docutils literal"><span class="pre">attrs</span></tt>:</dt>
  52.354 -<dd><p class="first">An object whose properties will be used as the attributes
  52.355 -(e.g. <tt class="docutils literal"><span class="pre">{'style':</span> <span class="pre">'display:block'}</span></tt>), or <tt class="docutils literal"><span class="pre">null</span></tt> if no
  52.356 -attributes need to be set.</p>
  52.357 -<p>See <a class="mochiref reference" href="#fn-updatenodeattributes">updateNodeAttributes</a> for more information.</p>
  52.358 -<p class="last">For convenience, if <tt class="docutils literal"><span class="pre">attrs</span></tt> is a string, <tt class="docutils literal"><span class="pre">null</span></tt> is used
  52.359 -and the string will be considered the first <tt class="docutils literal"><span class="pre">node</span></tt>.</p>
  52.360 -</dd>
  52.361 -<dt><tt class="docutils literal"><span class="pre">node</span></tt>...:</dt>
  52.362 -<dd>All additional arguments, if any, will be coerced into DOM
  52.363 -nodes that are appended as children using the
  52.364 -<a class="reference" href="#dom-coercion-rules">DOM Coercion Rules</a>.</dd>
  52.365 -<dt><em>returns</em>:</dt>
  52.366 -<dd>A DOM element</dd>
  52.367 -</dl>
  52.368 -</blockquote>
  52.369 -<p>
  52.370 -<a name="fn-createdomfunc"></a>
  52.371 -<a class="mochidef reference" href="#fn-createdomfunc">createDOMFunc(tag[, attrs[, node[, ...]]])</a>:</p>
  52.372 -<blockquote>
  52.373 -<p>Convenience function to create a partially applied createDOM
  52.374 -function. You'd want to use this if you add additional convenience
  52.375 -functions for creating tags, or if you find yourself creating
  52.376 -a lot of tags with a bunch of the same attributes or contents.</p>
  52.377 -<p>See <a class="mochiref reference" href="#fn-createdom">createDOM</a> for more detailed descriptions of the arguments.</p>
  52.378 -<dl class="docutils">
  52.379 -<dt><tt class="docutils literal"><span class="pre">tag</span></tt>:</dt>
  52.380 -<dd>The name of the tag</dd>
  52.381 -<dt><tt class="docutils literal"><span class="pre">attrs</span></tt>:</dt>
  52.382 -<dd>Optionally specify the attributes to apply</dd>
  52.383 -<dt><tt class="docutils literal"><span class="pre">node</span></tt>...:</dt>
  52.384 -<dd>Optionally specify any children nodes it should have</dd>
  52.385 -<dt><em>returns</em>:</dt>
  52.386 -<dd>function that takes additional arguments and calls
  52.387 -<a class="mochiref reference" href="#fn-createdom">createDOM</a></dd>
  52.388 -</dl>
  52.389 -</blockquote>
  52.390 -<p>
  52.391 -<a name="fn-currentdocument"></a>
  52.392 -<a class="mochidef reference" href="#fn-currentdocument">currentDocument()</a>:</p>
  52.393 -<blockquote>
  52.394 -Return the current <tt class="docutils literal"><span class="pre">document</span></tt> <a class="reference" href="#dom-context">DOM Context</a>. This will always
  52.395 -be the same as the global <tt class="docutils literal"><span class="pre">document</span></tt> unless <a class="mochiref reference" href="#fn-withdocument">withDocument</a> or
  52.396 -<a class="mochiref reference" href="#fn-withwindow">withWindow</a> is currently executing.</blockquote>
  52.397 -<p>
  52.398 -<a name="fn-currentwindow"></a>
  52.399 -<a class="mochidef reference" href="#fn-currentwindow">currentWindow()</a>:</p>
  52.400 -<blockquote>
  52.401 -Return the current <tt class="docutils literal"><span class="pre">window</span></tt> <a class="reference" href="#dom-context">DOM Context</a>. This will always
  52.402 -be the same as the global <tt class="docutils literal"><span class="pre">window</span></tt> unless <a class="mochiref reference" href="#fn-withwindow">withWindow</a> is
  52.403 -currently executing.</blockquote>
  52.404 -<p>
  52.405 -<a name="fn-elementdimensions"></a>
  52.406 -<a class="mochidef reference" href="#fn-elementdimensions">elementDimensions(element)</a>:</p>
  52.407 -<blockquote>
  52.408 -Return the absolute pixel width and height of <tt class="docutils literal"><span class="pre">element</span></tt> as an object with
  52.409 -<tt class="docutils literal"><span class="pre">w</span></tt> and <tt class="docutils literal"><span class="pre">h</span></tt> properties, or <tt class="docutils literal"><span class="pre">undefined</span></tt> if <tt class="docutils literal"><span class="pre">element</span></tt> is not in the
  52.410 -document. <tt class="docutils literal"><span class="pre">element</span></tt> may be specified as a string to be looked up with
  52.411 -<a class="mochiref reference" href="#fn-getelement">getElement</a>, a DOM element, or trivially as an object with
  52.412 -<tt class="docutils literal"><span class="pre">w</span></tt> and/or <tt class="docutils literal"><span class="pre">h</span></tt> properties.</blockquote>
  52.413 -<p>
  52.414 -<a name="fn-elementposition"></a>
  52.415 -<a class="mochidef reference" href="#fn-elementposition">elementPosition(element[, relativeTo={x: 0, y: 0}])</a>:</p>
  52.416 -<blockquote>
  52.417 -<p>Return the absolute pixel position of <tt class="docutils literal"><span class="pre">element</span></tt> in the document as an
  52.418 -object with <tt class="docutils literal"><span class="pre">x</span></tt> and <tt class="docutils literal"><span class="pre">y</span></tt> properties, or <tt class="docutils literal"><span class="pre">undefined</span></tt> if <tt class="docutils literal"><span class="pre">element</span></tt>
  52.419 -is not in the document. <tt class="docutils literal"><span class="pre">element</span></tt> may be specified as a string to
  52.420 -be looked up with <a class="mochiref reference" href="#fn-getelement">getElement</a>, a DOM element, or trivially
  52.421 -as an object with <tt class="docutils literal"><span class="pre">x</span></tt> and/or <tt class="docutils literal"><span class="pre">y</span></tt> properties.</p>
  52.422 -<p>If <tt class="docutils literal"><span class="pre">relativeTo</span></tt> is given, then its coordinates are subtracted from
  52.423 -the absolute position of <tt class="docutils literal"><span class="pre">element</span></tt>, e.g.:</p>
  52.424 -<pre class="literal-block">
  52.425 -var elemPos = elementPosition(elem);
  52.426 -var anotherElemPos = elementPosition(anotherElem);
  52.427 -var relPos = elementPosition(elem, anotherElem);
  52.428 -assert( relPos.x == (elemPos.x - anotherElemPos.x) );
  52.429 -assert( relPos.y == (elemPos.y - anotherElemPos.y) );
  52.430 -</pre>
  52.431 -<p><tt class="docutils literal"><span class="pre">relativeTo</span></tt> may be specified as a string to be looked up with
  52.432 -<a class="mochiref reference" href="#fn-getelement">getElement</a>, a DOM element, or trivially as an object
  52.433 -with <tt class="docutils literal"><span class="pre">x</span></tt> and/or <tt class="docutils literal"><span class="pre">y</span></tt> properties.</p>
  52.434 -</blockquote>
  52.435 -<p>
  52.436 -<a name="fn-emithtml"></a>
  52.437 -<a class="mochidef reference" href="#fn-emithtml">emitHTML(dom[, lst])</a>:</p>
  52.438 -<blockquote>
  52.439 -<p>Convert a DOM tree to an <tt class="docutils literal"><span class="pre">Array</span></tt> of HTML string fragments</p>
  52.440 -<p>You probably want to use <a class="mochiref reference" href="#fn-tohtml">toHTML</a> instead.</p>
  52.441 -</blockquote>
  52.442 -<p>
  52.443 -<a name="fn-escapehtml"></a>
  52.444 -<a class="mochidef reference" href="#fn-escapehtml">escapeHTML(s)</a>:</p>
  52.445 -<blockquote>
  52.446 -Make a string safe for HTML, converting the usual suspects (lt,
  52.447 -gt, quot, apos, amp)</blockquote>
  52.448 -<p>
  52.449 -<a name="fn-focusonload"></a>
  52.450 -<a class="mochidef reference" href="#fn-focusonload">focusOnLoad(element)</a>:</p>
  52.451 -<blockquote>
  52.452 -Add an onload event to focus the given element</blockquote>
  52.453 -<p>
  52.454 -<a name="fn-formcontents"></a>
  52.455 -<a class="mochidef reference" href="#fn-formcontents">formContents(elem)</a>:</p>
  52.456 -<blockquote>
  52.457 -Search the DOM tree, starting at <tt class="docutils literal"><span class="pre">elem</span></tt>, for any elements with a
  52.458 -<tt class="docutils literal"><span class="pre">name</span></tt> and <tt class="docutils literal"><span class="pre">value</span></tt> attribute. Return a 2-element <tt class="docutils literal"><span class="pre">Array</span></tt> of
  52.459 -<tt class="docutils literal"><span class="pre">names</span></tt> and <tt class="docutils literal"><span class="pre">values</span></tt> suitable for use with
  52.460 -<a class="mochiref reference" href="Base.html#fn-querystring">MochiKit.Base.queryString</a>.</blockquote>
  52.461 -<p>
  52.462 -<a name="fn-getelement"></a>
  52.463 -<a class="mochidef reference" href="#fn-getelement">getElement(id[, ...])</a>:</p>
  52.464 -<blockquote>
  52.465 -<p>A small quick little function to encapsulate the <tt class="docutils literal"><span class="pre">getElementById</span></tt>
  52.466 -method. It includes a check to ensure we can use that method.</p>
  52.467 -<p>If the id isn't a string, it will be returned as-is.</p>
  52.468 -<p>Also available as <a class="mochiref reference" href="#fn-$">$(...)</a> for convenience and compatibility with
  52.469 -other JavaScript frameworks.</p>
  52.470 -<p>If multiple arguments are given, an <tt class="docutils literal"><span class="pre">Array</span></tt> will be returned.</p>
  52.471 -</blockquote>
  52.472 -<p>
  52.473 -<a name="fn-getelementsbytagandclassname"></a>
  52.474 -<a class="mochidef reference" href="#fn-getelementsbytagandclassname">getElementsByTagAndClassName(tagName, className, parent=document)</a>:</p>
  52.475 -<blockquote>
  52.476 -<p>Returns an array of elements in <tt class="docutils literal"><span class="pre">parent</span></tt> that match the tag name
  52.477 -and class name provided. If <tt class="docutils literal"><span class="pre">parent</span></tt> is a string, it will be looked
  52.478 -up with <a class="mochiref reference" href="#fn-getelement">getElement</a>.</p>
  52.479 -<p>If <tt class="docutils literal"><span class="pre">tagName</span></tt> is <tt class="docutils literal"><span class="pre">null</span></tt> or <tt class="docutils literal"><span class="pre">&quot;*&quot;</span></tt>, all elements will be searched
  52.480 -for the matching class.</p>
  52.481 -<p>If <tt class="docutils literal"><span class="pre">className</span></tt> is <tt class="docutils literal"><span class="pre">null</span></tt>, all elements matching the provided tag are
  52.482 -returned.</p>
  52.483 -</blockquote>
  52.484 -<p>
  52.485 -<a name="fn-getnodeattribute"></a>
  52.486 -<a class="mochidef reference" href="#fn-getnodeattribute">getNodeAttribute(node, attr)</a>:</p>
  52.487 -<blockquote>
  52.488 -<p>Get the value of the given attribute for a DOM element without
  52.489 -ever raising an exception (will return <tt class="docutils literal"><span class="pre">null</span></tt> on exception).</p>
  52.490 -<dl class="docutils">
  52.491 -<dt><tt class="docutils literal"><span class="pre">node</span></tt>:</dt>
  52.492 -<dd>A reference to the DOM element to update (if a string is given,
  52.493 -<a class="mochiref reference" href="#fn-getelement">getElement(node)</a> will be used to locate the node)</dd>
  52.494 -<dt><tt class="docutils literal"><span class="pre">attr</span></tt>:</dt>
  52.495 -<dd><p class="first">The name of the attribute</p>
  52.496 -<p class="last">Note that it will do the right thing for IE, so don't do
  52.497 -the <tt class="docutils literal"><span class="pre">class</span></tt> -&gt; <tt class="docutils literal"><span class="pre">className</span></tt> hack yourself.</p>
  52.498 -</dd>
  52.499 -<dt><em>returns</em>:</dt>
  52.500 -<dd>The attribute's value, or <tt class="docutils literal"><span class="pre">null</span></tt></dd>
  52.501 -</dl>
  52.502 -</blockquote>
  52.503 -<p>
  52.504 -<a name="fn-getviewportdimensions"></a>
  52.505 -<a class="mochidef reference" href="#fn-getviewportdimensions">getViewportDimensions()</a>:</p>
  52.506 -<blockquote>
  52.507 -Return the pixel width and height of the viewport as an object with <tt class="docutils literal"><span class="pre">w</span></tt>
  52.508 -and <tt class="docutils literal"><span class="pre">h</span></tt> properties. <tt class="docutils literal"><span class="pre">element</span></tt> is looked up with
  52.509 -<a class="mochiref reference" href="#fn-getelement">getElement</a>, so string identifiers are also acceptable.</blockquote>
  52.510 -<p>
  52.511 -<a name="fn-haselementclass"></a>
  52.512 -<a class="mochidef reference" href="#fn-haselementclass">hasElementClass(element, className[, ...])</a>:</p>
  52.513 -<blockquote>
  52.514 -Return <tt class="docutils literal"><span class="pre">true</span></tt> if <tt class="docutils literal"><span class="pre">className</span></tt> is found on the <tt class="docutils literal"><span class="pre">element</span></tt>.
  52.515 -<tt class="docutils literal"><span class="pre">element</span></tt> is looked up with <a class="mochiref reference" href="#fn-getelement">getElement</a>, so string identifiers
  52.516 -are also acceptable.</blockquote>
  52.517 -<p>
  52.518 -<a name="fn-hideelement"></a>
  52.519 -<a class="mochidef reference" href="#fn-hideelement">hideElement(element, ...)</a>:</p>
  52.520 -<blockquote>
  52.521 -<p>Partial form of <a class="mochiref reference" href="#fn-setdisplayforelement">setDisplayForElement</a>, specifically:</p>
  52.522 -<pre class="literal-block">
  52.523 -partial(setDisplayForElement, &quot;none&quot;)
  52.524 -</pre>
  52.525 -<p>For information about the caveats of using a <tt class="docutils literal"><span class="pre">style.display</span></tt> based
  52.526 -show/hide mechanism, and a CSS based alternative, see
  52.527 -<a class="reference" href="#element-visibility">Element Visibility</a>.</p>
  52.528 -</blockquote>
  52.529 -<p>
  52.530 -<a name="fn-registerdomconverter"></a>
  52.531 -<a class="mochidef reference" href="#fn-registerdomconverter">registerDOMConverter(name, check, wrap[, override])</a>:</p>
  52.532 -<blockquote>
  52.533 -Register an adapter to convert objects that match <tt class="docutils literal"><span class="pre">check(obj,</span> <span class="pre">ctx)</span></tt>
  52.534 -to a DOM element, or something that can be converted to a DOM
  52.535 -element (i.e. number, bool, string, function, iterable).</blockquote>
  52.536 -<p>
  52.537 -<a name="fn-removeelement"></a>
  52.538 -<a class="mochidef reference" href="#fn-removeelement">removeElement(node)</a>:</p>
  52.539 -<blockquote>
  52.540 -<p>Remove and return <tt class="docutils literal"><span class="pre">node</span></tt> from a DOM tree. This is technically
  52.541 -just a convenience for <a class="mochiref reference" href="#fn-swapdom">swapDOM(node, null)</a>.</p>
  52.542 -<dl class="docutils">
  52.543 -<dt><tt class="docutils literal"><span class="pre">node</span></tt>:</dt>
  52.544 -<dd>the DOM element (or string id of one) to be removed</dd>
  52.545 -<dt><em>returns</em></dt>
  52.546 -<dd>The removed element</dd>
  52.547 -</dl>
  52.548 -</blockquote>
  52.549 -<p>
  52.550 -<a name="fn-removeelementclass"></a>
  52.551 -<a class="mochidef reference" href="#fn-removeelementclass">removeElementClass(element, className)</a>:</p>
  52.552 -<blockquote>
  52.553 -Ensure that the given <tt class="docutils literal"><span class="pre">element</span></tt> does not have <tt class="docutils literal"><span class="pre">className</span></tt> set as part
  52.554 -of its class attribute. This will not disturb other class names.
  52.555 -<tt class="docutils literal"><span class="pre">element</span></tt> is looked up with <a class="mochiref reference" href="#fn-getelement">getElement</a>, so string identifiers
  52.556 -are also acceptable.</blockquote>
  52.557 -<p>
  52.558 -<a name="fn-replacechildnodes"></a>
  52.559 -<a class="mochidef reference" href="#fn-replacechildnodes">replaceChildNodes(node[, childNode[, ...]])</a>:</p>
  52.560 -<blockquote>
  52.561 -<p>Remove all children from the given DOM element, then append any given
  52.562 -childNodes to it (by calling <a class="mochiref reference" href="#fn-appendchildnodes">appendChildNodes</a>).</p>
  52.563 -<dl class="docutils">
  52.564 -<dt><tt class="docutils literal"><span class="pre">node</span></tt>:</dt>
  52.565 -<dd>A reference to the DOM element to add children to
  52.566 -(if a string is given, <a class="mochiref reference" href="#fn-getelement">getElement(node)</a>
  52.567 -will be used to locate the node)</dd>
  52.568 -<dt><tt class="docutils literal"><span class="pre">childNode</span></tt>...:</dt>
  52.569 -<dd>All additional arguments, if any, will be coerced into DOM
  52.570 -nodes that are appended as children using the
  52.571 -<a class="reference" href="#dom-coercion-rules">DOM Coercion Rules</a>.</dd>
  52.572 -<dt><em>returns</em>:</dt>
  52.573 -<dd>The given DOM element</dd>
  52.574 -</dl>
  52.575 -</blockquote>
  52.576 -<p>
  52.577 -<a name="fn-scrapetext"></a>
  52.578 -<a class="mochidef reference" href="#fn-scrapetext">scrapeText(node[, asArray=false])</a>:</p>
  52.579 -<blockquote>
  52.580 -<p>Walk a DOM tree in-order and scrape all of the text out of it as a
  52.581 -<tt class="docutils literal"><span class="pre">string</span></tt>.</p>
  52.582 -<p>If <tt class="docutils literal"><span class="pre">asArray</span></tt> is <tt class="docutils literal"><span class="pre">true</span></tt>, then an <tt class="docutils literal"><span class="pre">Array</span></tt> will be returned with
  52.583 -each individual text node. These two are equivalent:</p>
  52.584 -<pre class="literal-block">
  52.585 -assert( scrapeText(node) == scrapeText(node, true).join(&quot;&quot;) );
  52.586 -</pre>
  52.587 -</blockquote>
  52.588 -<p>
  52.589 -<a name="fn-setdisplayforelement"></a>
  52.590 -<a class="mochidef reference" href="#fn-setdisplayforelement">setDisplayForElement(display, element[, ...])</a>:</p>
  52.591 -<blockquote>
  52.592 -<p>Change the <tt class="docutils literal"><span class="pre">style.display</span></tt> for the given element(s). Usually
  52.593 -used as the partial forms:</p>
  52.594 -<ul class="simple">
  52.595 -<li><a class="mochiref reference" href="#fn-showelement">showElement(element, ...)</a></li>
  52.596 -<li><a class="mochiref reference" href="#fn-hideelement">hideElement(element, ...)</a></li>
  52.597 -</ul>
  52.598 -<p>Elements are looked up with <a class="mochiref reference" href="#fn-getelement">getElement</a>, so string identifiers
  52.599 -are acceptable.</p>
  52.600 -<p>For information about the caveats of using a <tt class="docutils literal"><span class="pre">style.display</span></tt> based
  52.601 -show/hide mechanism, and a CSS based alternative, see
  52.602 -<a class="reference" href="#element-visibility">Element Visibility</a>.</p>
  52.603 -</blockquote>
  52.604 -<p>
  52.605 -<a name="fn-setelementclass"></a>
  52.606 -<a class="mochidef reference" href="#fn-setelementclass">setElementClass(element, className)</a>:</p>
  52.607 -<blockquote>
  52.608 -Set the entire class attribute of <tt class="docutils literal"><span class="pre">element</span></tt> to <tt class="docutils literal"><span class="pre">className</span></tt>.
  52.609 -<tt class="docutils literal"><span class="pre">element</span></tt> is looked up with <a class="mochiref reference" href="#fn-getelement">getElement</a>, so string identifiers
  52.610 -are also acceptable.</blockquote>
  52.611 -<p>
  52.612 -<a name="fn-setelementdimensions"></a>
  52.613 -<a class="mochidef reference" href="#fn-setelementdimensions">setElementDimensions(element, dimensions[, units='px'])</a>:</p>
  52.614 -<blockquote>
  52.615 -<p>Sets the dimensions of <tt class="docutils literal"><span class="pre">element</span></tt> in the document from an
  52.616 -object with <tt class="docutils literal"><span class="pre">w</span></tt> and <tt class="docutils literal"><span class="pre">h</span></tt> properties.</p>
  52.617 -<dl class="docutils">
  52.618 -<dt><tt class="docutils literal"><span class="pre">node</span></tt>:</dt>
  52.619 -<dd>A reference to the DOM element to update (if a string is given,
  52.620 -<a class="mochiref reference" href="#fn-getelement">getElement(node)</a> will be used to locate the node)</dd>
  52.621 -<dt><tt class="docutils literal"><span class="pre">dimensions</span></tt>:</dt>
  52.622 -<dd>An object with <tt class="docutils literal"><span class="pre">w</span></tt> and <tt class="docutils literal"><span class="pre">h</span></tt> properties</dd>
  52.623 -<dt><tt class="docutils literal"><span class="pre">units</span></tt>:</dt>
  52.624 -<dd>Optionally set the units to use, default is <tt class="docutils literal"><span class="pre">px</span></tt></dd>
  52.625 -</dl>
  52.626 -</blockquote>
  52.627 -<p>
  52.628 -<a name="fn-setelementposition"></a>
  52.629 -<a class="mochidef reference" href="#fn-setelementposition">setElementPosition(element, position[, units='px'])</a>:</p>
  52.630 -<blockquote>
  52.631 -<p>Sets the absolute position of <tt class="docutils literal"><span class="pre">element</span></tt> in the document from an
  52.632 -object with <tt class="docutils literal"><span class="pre">x</span></tt> and <tt class="docutils literal"><span class="pre">y</span></tt> properties.</p>
  52.633 -<dl class="docutils">
  52.634 -<dt><tt class="docutils literal"><span class="pre">node</span></tt>:</dt>
  52.635 -<dd>A reference to the DOM element to update (if a string is given,
  52.636 -<a class="mochiref reference" href="#fn-getelement">getElement(node)</a> will be used to locate the node)</dd>
  52.637 -<dt><tt class="docutils literal"><span class="pre">position</span></tt>:</dt>
  52.638 -<dd>An object with <tt class="docutils literal"><span class="pre">x</span></tt> and <tt class="docutils literal"><span class="pre">y</span></tt> properties</dd>
  52.639 -<dt><tt class="docutils literal"><span class="pre">units</span></tt>:</dt>
  52.640 -<dd>Optionally set the units to use, default is <tt class="docutils literal"><span class="pre">px</span></tt></dd>
  52.641 -</dl>
  52.642 -</blockquote>
  52.643 -<p>
  52.644 -<a name="fn-setnodeattribute"></a>
  52.645 -<a class="mochidef reference" href="#fn-setnodeattribute">setNodeAttribute(node, attr, value)</a>:</p>
  52.646 -<blockquote>
  52.647 -<p>Set the value of the given attribute for a DOM element without
  52.648 -ever raising an exception (will return null on exception). If
  52.649 -setting more than one attribute, you should use
  52.650 -<a class="mochiref reference" href="#fn-updatenodeattributes">updateNodeAttributes</a>.</p>
  52.651 -<dl class="docutils">
  52.652 -<dt><tt class="docutils literal"><span class="pre">node</span></tt>:</dt>
  52.653 -<dd>A reference to the DOM element to update (if a string is given,
  52.654 -<a class="mochiref reference" href="#fn-getelement">getElement(node)</a> will be used to locate the node)</dd>
  52.655 -<dt><tt class="docutils literal"><span class="pre">attr</span></tt>:</dt>
  52.656 -<dd><p class="first">The name of the attribute</p>
  52.657 -<p class="last">Note that it will do the right thing for IE, so don't do
  52.658 -the <tt class="docutils literal"><span class="pre">class</span></tt> -&gt; <tt class="docutils literal"><span class="pre">className</span></tt> hack yourself.</p>
  52.659 -</dd>
  52.660 -<dt><tt class="docutils literal"><span class="pre">value</span></tt>:</dt>
  52.661 -<dd>The value of the attribute, may be an object to be merged
  52.662 -(e.g. for setting style).</dd>
  52.663 -<dt><em>returns</em>:</dt>
  52.664 -<dd>The given DOM element or <tt class="docutils literal"><span class="pre">null</span></tt> on failure</dd>
  52.665 -</dl>
  52.666 -</blockquote>
  52.667 -<p>
  52.668 -<a name="fn-setopacity"></a>
  52.669 -<a class="mochidef reference" href="#fn-setopacity">setOpacity(element, opacity)</a>:</p>
  52.670 -<blockquote>
  52.671 -Sets <tt class="docutils literal"><span class="pre">opacity</span></tt> for <tt class="docutils literal"><span class="pre">element</span></tt>. Valid <tt class="docutils literal"><span class="pre">opacity</span></tt> values range from 0
  52.672 -(invisible) to 1 (opaque). <tt class="docutils literal"><span class="pre">element</span></tt> is looked up with
  52.673 -<a class="mochiref reference" href="#fn-getelement">getElement</a>, so string identifiers are also acceptable.</blockquote>
  52.674 -<p>
  52.675 -<a name="fn-showelement"></a>
  52.676 -<a class="mochidef reference" href="#fn-showelement">showElement(element, ...)</a>:</p>
  52.677 -<blockquote>
  52.678 -<p>Partial form of <a class="mochiref reference" href="#fn-setdisplayforelement">setDisplayForElement</a>, specifically:</p>
  52.679 -<pre class="literal-block">
  52.680 -partial(setDisplayForElement, &quot;block&quot;)
  52.681 -</pre>
  52.682 -<p>For information about the caveats of using a <tt class="docutils literal"><span class="pre">style.display</span></tt> based
  52.683 -show/hide mechanism, and a CSS based alternative, see
  52.684 -<a class="reference" href="#element-visibility">Element Visibility</a>.</p>
  52.685 -</blockquote>
  52.686 -<p>
  52.687 -<a name="fn-swapdom"></a>
  52.688 -<a class="mochidef reference" href="#fn-swapdom">swapDOM(dest, src)</a>:</p>
  52.689 -<blockquote>
  52.690 -<p>Replace <tt class="docutils literal"><span class="pre">dest</span></tt> in a DOM tree with <tt class="docutils literal"><span class="pre">src</span></tt>, returning <tt class="docutils literal"><span class="pre">src</span></tt>.</p>
  52.691 -<dl class="docutils">
  52.692 -<dt><tt class="docutils literal"><span class="pre">dest</span></tt>:</dt>
  52.693 -<dd>a DOM element (or string id of one) to be replaced</dd>
  52.694 -<dt><tt class="docutils literal"><span class="pre">src</span></tt>:</dt>
  52.695 -<dd>the DOM element (or string id of one) to replace it with, or
  52.696 -<tt class="docutils literal"><span class="pre">null</span></tt> if <tt class="docutils literal"><span class="pre">dest</span></tt> is to be removed (replaced with nothing).</dd>
  52.697 -<dt><em>returns</em>:</dt>
  52.698 -<dd>a DOM element (<tt class="docutils literal"><span class="pre">src</span></tt>)</dd>
  52.699 -</dl>
  52.700 -</blockquote>
  52.701 -<p>
  52.702 -<a name="fn-swapelementclass"></a>
  52.703 -<a class="mochidef reference" href="#fn-swapelementclass">swapElementClass(element, fromClass, toClass)</a>:</p>
  52.704 -<blockquote>
  52.705 -If <tt class="docutils literal"><span class="pre">fromClass</span></tt> is set on <tt class="docutils literal"><span class="pre">element</span></tt>, replace it with <tt class="docutils literal"><span class="pre">toClass</span></tt>.
  52.706 -This will not disturb other classes on that element.
  52.707 -<tt class="docutils literal"><span class="pre">element</span></tt> is looked up with <a class="mochiref reference" href="#fn-getelement">getElement</a>, so string identifiers
  52.708 -are also acceptable.</blockquote>
  52.709 -<p>
  52.710 -<a name="fn-toggleelementclass"></a>
  52.711 -<a class="mochidef reference" href="#fn-toggleelementclass">toggleElementClass(className[, element[, ...]])</a>:</p>
  52.712 -<blockquote>
  52.713 -Toggle the presence of a given <tt class="docutils literal"><span class="pre">className</span></tt> in the class attribute
  52.714 -of all given elements. All elements will be looked up with
  52.715 -<a class="mochiref reference" href="#fn-getelement">getElement</a>, so string identifiers are acceptable.</blockquote>
  52.716 -<p>
  52.717 -<a name="fn-tohtml"></a>
  52.718 -<a class="mochidef reference" href="#fn-tohtml">toHTML(dom)</a>:</p>
  52.719 -<blockquote>
  52.720 -Convert a DOM tree to a HTML string using <a class="mochiref reference" href="#fn-emithtml">emitHTML</a></blockquote>
  52.721 -<p>
  52.722 -<a name="fn-updatenodeattributes"></a>
  52.723 -<a class="mochidef reference" href="#fn-updatenodeattributes">updateNodeAttributes(node, attrs)</a>:</p>
  52.724 -<blockquote>
  52.725 -<p>Update the attributes of a DOM element from a given object.</p>
  52.726 -<dl class="docutils">
  52.727 -<dt><tt class="docutils literal"><span class="pre">node</span></tt>:</dt>
  52.728 -<dd>A reference to the DOM element to update (if a string is given,
  52.729 -<a class="mochiref reference" href="#fn-getelement">getElement(node)</a> will be used to locate the node)</dd>
  52.730 -<dt><tt class="docutils literal"><span class="pre">attrs</span></tt>:</dt>
  52.731 -<dd><p class="first">An object whose properties will be used to set the attributes
  52.732 -(e.g. <tt class="docutils literal"><span class="pre">{'class':</span> <span class="pre">'invisible'}</span></tt>), or <tt class="docutils literal"><span class="pre">null</span></tt> if no
  52.733 -attributes need to be set. If an object is given for the
  52.734 -attribute value (e.g. <tt class="docutils literal"><span class="pre">{'style':</span> <span class="pre">{'display':</span> <span class="pre">'block'}}</span></tt>)
  52.735 -then <a class="mochiref reference" href="Base.html#fn-updatetree">MochiKit.Base.updatetree</a> will be used to set that
  52.736 -attribute.</p>
  52.737 -<p class="last">Note that it will do the right thing for IE, so don't do
  52.738 -the <tt class="docutils literal"><span class="pre">class</span></tt> -&gt; <tt class="docutils literal"><span class="pre">className</span></tt> hack yourself, and it deals with
  52.739 -setting &quot;on...&quot; event handlers correctly.</p>
  52.740 -</dd>
  52.741 -<dt><em>returns</em>:</dt>
  52.742 -<dd>The given DOM element</dd>
  52.743 -</dl>
  52.744 -</blockquote>
  52.745 -<p>
  52.746 -<a name="fn-withwindow"></a>
  52.747 -<a class="mochidef reference" href="#fn-withwindow">withWindow(win, func)</a>:</p>
  52.748 -<blockquote>
  52.749 -<p>Call <tt class="docutils literal"><span class="pre">func</span></tt> with the <tt class="docutils literal"><span class="pre">window</span></tt> <a class="reference" href="#dom-context">DOM Context</a> set to <tt class="docutils literal"><span class="pre">win</span></tt> and
  52.750 -the <tt class="docutils literal"><span class="pre">document</span></tt> <a class="reference" href="#dom-context">DOM Context</a> set to <tt class="docutils literal"><span class="pre">win.document</span></tt>. When
  52.751 -<tt class="docutils literal"><span class="pre">func()</span></tt> returns or throws an error, the <a class="reference" href="#dom-context">DOM Context</a>  will be
  52.752 -restored to its previous state.</p>
  52.753 -<p>The return value of <tt class="docutils literal"><span class="pre">func()</span></tt> is returned by this function.</p>
  52.754 -</blockquote>
  52.755 -<p>
  52.756 -<a name="fn-withdocument"></a>
  52.757 -<a class="mochidef reference" href="#fn-withdocument">withDocument(doc, func)</a>:</p>
  52.758 -<blockquote>
  52.759 -<p>Call <tt class="docutils literal"><span class="pre">func</span></tt> with the <tt class="docutils literal"><span class="pre">doc</span></tt> <a class="reference" href="#dom-context">DOM Context</a> set to <tt class="docutils literal"><span class="pre">doc</span></tt>.
  52.760 -When <tt class="docutils literal"><span class="pre">func()</span></tt> returns or throws an error, the <a class="reference" href="#dom-context">DOM Context</a>
  52.761 -will be restored to its previous state.</p>
  52.762 -<p>The return value of <tt class="docutils literal"><span class="pre">func()</span></tt> is returned by this function.</p>
  52.763 -</blockquote>
  52.764 -</div>
  52.765 -</div>
  52.766 -<div class="section">
  52.767 -<h1><a id="see-also" name="see-also">See Also</a></h1>
  52.768 -<table class="docutils footnote" frame="void" id="id5" rules="none">
  52.769 -<colgroup><col class="label" /><col /></colgroup>
  52.770 -<tbody valign="top">
  52.771 -<tr><td class="label"><a name="id5">[1]</a></td><td><em>(<a class="fn-backref" href="#id1">1</a>, <a class="fn-backref" href="#id3">2</a>)</em> Nevow, a web application construction kit for Python: <a class="reference" href="http://nevow.com/">http://nevow.com/</a></td></tr>
  52.772 -</tbody>
  52.773 -</table>
  52.774 -<table class="docutils footnote" frame="void" id="id6" rules="none">
  52.775 -<colgroup><col class="label" /><col /></colgroup>
  52.776 -<tbody valign="top">
  52.777 -<tr><td class="label"><a name="id6">[2]</a></td><td><em>(<a class="fn-backref" href="#id2">1</a>, <a class="fn-backref" href="#id4">2</a>)</em> nevow.stan is a domain specific language for Python
  52.778 -(read as &quot;crazy getitem/call overloading abuse&quot;) that Donovan and I
  52.779 -schemed up at PyCon 2003 at this super ninja Python/C++ programmer's
  52.780 -(David Abrahams) hotel room. Donovan later inflicted this upon the
  52.781 -masses in Nevow. Check out the Divmod project page for some
  52.782 -examples: <a class="reference" href="http://nevow.com/Nevow2004Tutorial.html">http://nevow.com/Nevow2004Tutorial.html</a></td></tr>
  52.783 -</tbody>
  52.784 -</table>
  52.785 -</div>
  52.786 -<div class="section">
  52.787 -<h1><a id="authors" name="authors">Authors</a></h1>
  52.788 -<ul class="simple">
  52.789 -<li>Bob Ippolito &lt;<a class="reference" href="mailto:bob&#64;redivi.com">bob&#64;redivi.com</a>&gt;</li>
  52.790 -</ul>
  52.791 -</div>
  52.792 -<div class="section">
  52.793 -<h1><a id="copyright" name="copyright">Copyright</a></h1>
  52.794 -<p>Copyright 2005 Bob Ippolito &lt;<a class="reference" href="mailto:bob&#64;redivi.com">bob&#64;redivi.com</a>&gt;. This program is dual-licensed
  52.795 -free software; you can redistribute it and/or modify it under the terms of the
  52.796 -<a class="reference" href="http://www.opensource.org/licenses/mit-license.php">MIT License</a> or the <a class="reference" href="http://www.opensource.org/licenses/afl-2.1.php">Academic Free License v2.1</a>.</p>
  52.797 -</div>
  52.798 -</div>
  52.799 -
  52.800 -</body>
  52.801 -</html>
    53.1 --- a/pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/DateTime.html	Mon Apr 13 12:51:06 2009 +0200
    53.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.3 @@ -1,125 +0,0 @@
    53.4 -<?xml version="1.0" encoding="utf-8" ?>
    53.5 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    53.6 -
    53.7 -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    53.8 -<head>
    53.9 -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   53.10 -<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
   53.11 -<title>MochiKit.DateTime - &quot;what time is it anyway?&quot;</title>
   53.12 -
   53.13 -<link rel="stylesheet" href="../../../include/css/documentation.css" type="text/css" />
   53.14 -<script type="text/javascript" src="../../../packed/lib/MochiKit/MochiKit.js"></script>
   53.15 -<script type="text/javascript" src="../../js/toc.js"></script>
   53.16 -</head>
   53.17 -<body>
   53.18 -<div class="document">
   53.19 -<div class="section">
   53.20 -<h1><a id="name" name="name">Name</a></h1>
   53.21 -<p>MochiKit.DateTime - &quot;what time is it anyway?&quot;</p>
   53.22 -</div>
   53.23 -<div class="section">
   53.24 -<h1><a id="synopsis" name="synopsis">Synopsis</a></h1>
   53.25 -<pre class="literal-block">
   53.26 -stringDate = toISOTimestamp(new Date());
   53.27 -dateObject = isoTimestamp(stringDate);
   53.28 -</pre>
   53.29 -</div>
   53.30 -<div class="section">
   53.31 -<h1><a id="description" name="description">Description</a></h1>
   53.32 -<p>Remote servers don't give you JavaScript Date objects, and they certainly
   53.33 -don't want them from you, so you need to deal with string representations
   53.34 -of dates and timestamps. MochiKit.Date does that.</p>
   53.35 -</div>
   53.36 -<div class="section">
   53.37 -<h1><a id="dependencies" name="dependencies">Dependencies</a></h1>
   53.38 -<p>None.</p>
   53.39 -</div>
   53.40 -<div class="section">
   53.41 -<h1><a id="api-reference" name="api-reference">API Reference</a></h1>
   53.42 -<div class="section">
   53.43 -<h2><a id="functions" name="functions">Functions</a></h2>
   53.44 -<p>
   53.45 -<a name="fn-isodate"></a>
   53.46 -<a class="mochidef reference" href="#fn-isodate">isoDate(str)</a>:</p>
   53.47 -<blockquote>
   53.48 -Convert an ISO 8601 date (YYYY-MM-DD) to a <tt class="docutils literal"><span class="pre">Date</span></tt> object.</blockquote>
   53.49 -<p>
   53.50 -<a name="fn-isotimestamp"></a>
   53.51 -<a class="mochidef reference" href="#fn-isotimestamp">isoTimestamp(str)</a>:</p>
   53.52 -<blockquote>
   53.53 -<p>Convert any ISO 8601 <a class="footnote-reference" href="#id3" id="id1" name="id1">[1]</a> timestamp (or something reasonably close to it)
   53.54 -to a <tt class="docutils literal"><span class="pre">Date</span></tt> object. Will accept the &quot;de facto&quot; form:</p>
   53.55 -<blockquote>
   53.56 -YYYY-MM-DD hh:mm:ss</blockquote>
   53.57 -<p>or (the proper form):</p>
   53.58 -<blockquote>
   53.59 -YYYY-MM-DDThh:mm:ssZ</blockquote>
   53.60 -<p>If a time zone designator (&quot;Z&quot; or &quot;[+-]HH:MM&quot;) is not present, then the
   53.61 -local timezone is used.</p>
   53.62 -</blockquote>
   53.63 -<p>
   53.64 -<a name="fn-toisotime"></a>
   53.65 -<a class="mochidef reference" href="#fn-toisotime">toISOTime(date)</a>:</p>
   53.66 -<blockquote>
   53.67 -Convert a <tt class="docutils literal"><span class="pre">Date</span></tt> object to a string in the form of hh:mm:ss</blockquote>
   53.68 -<p>
   53.69 -<a name="fn-toisotimestamp"></a>
   53.70 -<a class="mochidef reference" href="#fn-toisotimestamp">toISOTimestamp(date, realISO=false)</a>:</p>
   53.71 -<blockquote>
   53.72 -<p>Convert a <tt class="docutils literal"><span class="pre">Date</span></tt> object to something that's ALMOST but not quite an
   53.73 -ISO 8601 [1]_timestamp. If it was a proper ISO timestamp it would be:</p>
   53.74 -<blockquote>
   53.75 -YYYY-MM-DDThh:mm:ssZ</blockquote>
   53.76 -<p>However, we see junk in SQL and other places that looks like this:</p>
   53.77 -<blockquote>
   53.78 -YYYY-MM-DD hh:mm:ss</blockquote>
   53.79 -<p>So, this function returns the latter form, despite its name, unless
   53.80 -you pass <tt class="docutils literal"><span class="pre">true</span></tt> for <tt class="docutils literal"><span class="pre">realISO</span></tt>.</p>
   53.81 -</blockquote>
   53.82 -<p>
   53.83 -<a name="fn-toisodate"></a>
   53.84 -<a class="mochidef reference" href="#fn-toisodate">toISODate(date)</a>:</p>
   53.85 -<blockquote>
   53.86 -Convert a <tt class="docutils literal"><span class="pre">Date</span></tt> object to an ISO 8601 <a class="footnote-reference" href="#id3" id="id2" name="id2">[1]</a> date string (YYYY-MM-DD)</blockquote>
   53.87 -<p>
   53.88 -<a name="fn-americandate"></a>
   53.89 -<a class="mochidef reference" href="#fn-americandate">americanDate(str)</a>:</p>
   53.90 -<blockquote>
   53.91 -Converts a MM/DD/YYYY date to a <tt class="docutils literal"><span class="pre">Date</span></tt> object</blockquote>
   53.92 -<p>
   53.93 -<a name="fn-topaddedamericandate"></a>
   53.94 -<a class="mochidef reference" href="#fn-topaddedamericandate">toPaddedAmericanDate(date)</a>:</p>
   53.95 -<blockquote>
   53.96 -Converts a <tt class="docutils literal"><span class="pre">Date</span></tt> object to an MM/DD/YYYY date, e.g. 01/01/2001</blockquote>
   53.97 -<p>
   53.98 -<a name="fn-toamericandate"></a>
   53.99 -<a class="mochidef reference" href="#fn-toamericandate">toAmericanDate(date)</a>:</p>
  53.100 -<blockquote>
  53.101 -Converts a <tt class="docutils literal"><span class="pre">Date</span></tt> object to an M/D/YYYY date, e.g. 1/1/2001</blockquote>
  53.102 -</div>
  53.103 -</div>
  53.104 -<div class="section">
  53.105 -<h1><a id="see-also" name="see-also">See Also</a></h1>
  53.106 -<table class="docutils footnote" frame="void" id="id3" rules="none">
  53.107 -<colgroup><col class="label" /><col /></colgroup>
  53.108 -<tbody valign="top">
  53.109 -<tr><td class="label"><a name="id3">[1]</a></td><td><em>(<a class="fn-backref" href="#id1">1</a>, <a class="fn-backref" href="#id2">2</a>)</em> W3C profile of ISO 8601: <a class="reference" href="http://www.w3.org/TR/NOTE-datetime">http://www.w3.org/TR/NOTE-datetime</a></td></tr>
  53.110 -</tbody>
  53.111 -</table>
  53.112 -</div>
  53.113 -<div class="section">
  53.114 -<h1><a id="authors" name="authors">Authors</a></h1>
  53.115 -<ul class="simple">
  53.116 -<li>Bob Ippolito &lt;<a class="reference" href="mailto:bob&#64;redivi.com">bob&#64;redivi.com</a>&gt;</li>
  53.117 -</ul>
  53.118 -</div>
  53.119 -<div class="section">
  53.120 -<h1><a id="copyright" name="copyright">Copyright</a></h1>
  53.121 -<p>Copyright 2005 Bob Ippolito &lt;<a class="reference" href="mailto:bob&#64;redivi.com">bob&#64;redivi.com</a>&gt;. This program is dual-licensed
  53.122 -free software; you can redistribute it and/or modify it under the terms of the
  53.123 -<a class="reference" href="http://www.opensource.org/licenses/mit-license.php">MIT License</a> or the <a class="reference" href="http://www.opensource.org/licenses/afl-2.1.php">Academic Free License v2.1</a>.</p>
  53.124 -</div>
  53.125 -</div>
  53.126 -
  53.127 -</body>
  53.128 -</html>
    54.1 --- a/pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/Format.html	Mon Apr 13 12:51:06 2009 +0200
    54.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.3 @@ -1,241 +0,0 @@
    54.4 -<?xml version="1.0" encoding="utf-8" ?>
    54.5 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    54.6 -
    54.7 -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    54.8 -<head>
    54.9 -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   54.10 -<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
   54.11 -<title>MochiKit.Format - string formatting goes here</title>
   54.12 -
   54.13 -<link rel="stylesheet" href="../../../include/css/documentation.css" type="text/css" />
   54.14 -<script type="text/javascript" src="../../../packed/lib/MochiKit/MochiKit.js"></script>
   54.15 -<script type="text/javascript" src="../../js/toc.js"></script>
   54.16 -</head>
   54.17 -<body>
   54.18 -<div class="document">
   54.19 -<div class="section">
   54.20 -<h1><a id="name" name="name">Name</a></h1>
   54.21 -<p>MochiKit.Format - string formatting goes here</p>
   54.22 -</div>
   54.23 -<div class="section">
   54.24 -<h1><a id="synopsis" name="synopsis">Synopsis</a></h1>
   54.25 -<pre class="literal-block">
   54.26 -assert( truncToFixed(0.12345, 4) == &quot;0.1234&quot; );
   54.27 -assert( roundToFixed(0.12345, 4) == &quot;0.1235&quot; );
   54.28 -assert( twoDigitAverage(1, 0) == &quot;0&quot; );
   54.29 -assert( twoDigitFloat(1.2345) == &quot;1.23&quot; );
   54.30 -assert( twoDigitFloat(1) == &quot;1&quot; );
   54.31 -assert( percentFormat(1.234567) == &quot;123.46%&quot; );
   54.32 -assert( numberFormatter(&quot;###,###%&quot;)(125) == &quot;12,500%&quot; );
   54.33 -assert( numberFormatter(&quot;##.000&quot;)(1.25) == &quot;1.250&quot; );
   54.34 -</pre>
   54.35 -</div>
   54.36 -<div class="section">
   54.37 -<h1><a id="description" name="description">Description</a></h1>
   54.38 -<p>Formatting strings and stringifying numbers is boring, so a couple useful
   54.39 -functions in that domain live here.</p>
   54.40 -</div>
   54.41 -<div class="section">
   54.42 -<h1><a id="dependencies" name="dependencies">Dependencies</a></h1>
   54.43 -<p>None.</p>
   54.44 -</div>
   54.45 -<div class="section">
   54.46 -<h1><a id="overview" name="overview">Overview</a></h1>
   54.47 -<div class="section">
   54.48 -<h2><a id="formatting-numbers" name="formatting-numbers">Formatting Numbers</a></h2>
   54.49 -<p>MochiKit provides an extensible number formatting facility, modeled loosely
   54.50 -after the Number Format Pattern Syntax <a class="footnote-reference" href="#id2" id="id1" name="id1">[1]</a> from Java.
   54.51 -<a class="mochiref reference" href="#fn-numberformatter">numberFormatter(pattern[, placeholder=&quot;&quot;[, locale=&quot;default&quot;])</a>
   54.52 -returns a function that converts Number to string using the given information.
   54.53 -<tt class="docutils literal"><span class="pre">pattern</span></tt> is a string consisting of the following symbols:</p>
   54.54 -<table border="1" class="docutils">
   54.55 -<colgroup>
   54.56 -<col width="15%" />
   54.57 -<col width="85%" />
   54.58 -</colgroup>
   54.59 -<thead valign="bottom">
   54.60 -<tr><th class="head">Symbol</th>
   54.61 -<th class="head">Meaning</th>
   54.62 -</tr>
   54.63 -</thead>
   54.64 -<tbody valign="top">
   54.65 -<tr><td><tt class="docutils literal"><span class="pre">-</span></tt></td>
   54.66 -<td>If given, used as the position of the minus sign
   54.67 -for negative numbers. If not given, the position
   54.68 -to the left of the first number placeholder is used.</td>
   54.69 -</tr>
   54.70 -<tr><td><tt class="docutils literal"><span class="pre">#</span></tt></td>
   54.71 -<td>The placeholder for a number that does not imply zero
   54.72 -padding.</td>
   54.73 -</tr>
   54.74 -<tr><td><tt class="docutils literal"><span class="pre">0</span></tt></td>
   54.75 -<td>The placeholder for a number that implies zero padding.
   54.76 -If it is used to the right of a decimal separator, it
   54.77 -implies trailing zeros, otherwise leading zeros.</td>
   54.78 -</tr>
   54.79 -<tr><td><tt class="docutils literal"><span class="pre">,</span></tt></td>
   54.80 -<td>The placeholder for a &quot;thousands separator&quot;. May be used
   54.81 -at most once, and it must be to the left of a decimal
   54.82 -separator. Will be replaced by <tt class="docutils literal"><span class="pre">locale.separator</span></tt> in the
   54.83 -result (the default is also <tt class="docutils literal"><span class="pre">,</span></tt>).</td>
   54.84 -</tr>
   54.85 -<tr><td><tt class="docutils literal"><span class="pre">.</span></tt></td>
   54.86 -<td>The decimal separator. The quantity of <tt class="docutils literal"><span class="pre">#</span></tt> or <tt class="docutils literal"><span class="pre">0</span></tt>
   54.87 -after the decimal separator will determine the precision of
   54.88 -the result. If no decimal separator is present, the
   54.89 -fractional precision is <tt class="docutils literal"><span class="pre">0</span></tt> -- meaning that it will be
   54.90 -rounded to the nearest integer.</td>
   54.91 -</tr>
   54.92 -<tr><td><tt class="docutils literal"><span class="pre">%</span></tt></td>
   54.93 -<td>If present, the number will be multiplied by <tt class="docutils literal"><span class="pre">100</span></tt> and
   54.94 -the <tt class="docutils literal"><span class="pre">%</span></tt> will be replaced by <tt class="docutils literal"><span class="pre">locale.percent</span></tt>.</td>
   54.95 -</tr>
   54.96 -</tbody>
   54.97 -</table>
   54.98 -</div>
   54.99 -</div>
  54.100 -<div class="section">
  54.101 -<h1><a id="api-reference" name="api-reference">API Reference</a></h1>
  54.102 -<div class="section">
  54.103 -<h2><a id="functions" name="functions">Functions</a></h2>
  54.104 -<p>
  54.105 -<a name="fn-formatlocale"></a>
  54.106 -<a class="mochidef reference" href="#fn-formatlocale">formatLocale(locale=&quot;default&quot;)</a>:</p>
  54.107 -<blockquote>
  54.108 -Return a locale object for the given locale. <tt class="docutils literal"><span class="pre">locale</span></tt> may be either a
  54.109 -string, which is looked up in the <tt class="docutils literal"><span class="pre">MochiKit.Format.LOCALE</span></tt> object, or
  54.110 -a locale object. If no locale is given, <tt class="docutils literal"><span class="pre">LOCALE.default</span></tt> is used
  54.111 -(equivalent to <tt class="docutils literal"><span class="pre">LOCALE.en_US</span></tt>).</blockquote>
  54.112 -<p>
  54.113 -<a name="fn-lstrip"></a>
  54.114 -<a class="mochidef reference" href="#fn-lstrip">lstrip(str, chars=&quot;\s&quot;)</a>:</p>
  54.115 -<blockquote>
  54.116 -<p>Returns a string based on <tt class="docutils literal"><span class="pre">str</span></tt> with leading whitespace stripped.</p>
  54.117 -<p>If <tt class="docutils literal"><span class="pre">chars</span></tt> is given, then that expression will be used instead of
  54.118 -whitespace. <tt class="docutils literal"><span class="pre">chars</span></tt> should be a string suitable for use in a <tt class="docutils literal"><span class="pre">RegExp</span></tt>
  54.119 -<tt class="docutils literal"><span class="pre">[character</span> <span class="pre">set]</span></tt>.</p>
  54.120 -</blockquote>
  54.121 -<p>
  54.122 -<a name="fn-numberformatter"></a>
  54.123 -<a class="mochidef reference" href="#fn-numberformatter">numberFormatter(pattern, placeholder=&quot;&quot;, locale=&quot;default&quot;)</a>:</p>
  54.124 -<blockquote>
  54.125 -<p>Return a function <tt class="docutils literal"><span class="pre">formatNumber(aNumber)</span></tt> that formats numbers
  54.126 -as a string according to the given pattern, placeholder and locale.</p>
  54.127 -<p><tt class="docutils literal"><span class="pre">pattern</span></tt> is a string that describes how the numbers should be formatted,
  54.128 -for more information see <a class="reference" href="#formatting-numbers">Formatting Numbers</a>.</p>
  54.129 -<p><tt class="docutils literal"><span class="pre">locale</span></tt> is a string of a known locale (en_US, de_DE, fr_FR, default) or
  54.130 -an object with the following fields:</p>
  54.131 -<table border="1" class="docutils">
  54.132 -<colgroup>
  54.133 -<col width="16%" />
  54.134 -<col width="84%" />
  54.135 -</colgroup>
  54.136 -<tbody valign="top">
  54.137 -<tr><td>separator</td>
  54.138 -<td>The &quot;thousands&quot; separator for this locale (en_US is &quot;,&quot;)</td>
  54.139 -</tr>
  54.140 -<tr><td>decimal</td>
  54.141 -<td>The decimal separator for this locale (en_US is &quot;.&quot;)</td>
  54.142 -</tr>
  54.143 -<tr><td>percent</td>
  54.144 -<td>The percent symbol for this locale (en_US is &quot;%&quot;)</td>
  54.145 -</tr>
  54.146 -</tbody>
  54.147 -</table>
  54.148 -</blockquote>
  54.149 -<p>
  54.150 -<a name="fn-percentformat"></a>
  54.151 -<a class="mochidef reference" href="#fn-percentformat">percentFormat(someFloat)</a>:</p>
  54.152 -<blockquote>
  54.153 -<p>Roughly equivalent to: <tt class="docutils literal"><span class="pre">sprintf(&quot;%.2f%%&quot;,</span> <span class="pre">someFloat</span> <span class="pre">*</span> <span class="pre">100)</span></tt></p>
  54.154 -<p>In new code, you probably want to use:
  54.155 -<a class="mochiref reference" href="#fn-numberformatter">numberFormatter(&quot;#.##%&quot;)(someFloat)</a> instead.</p>
  54.156 -</blockquote>
  54.157 -<p>
  54.158 -<a name="fn-roundtofixed"></a>
  54.159 -<a class="mochidef reference" href="#fn-roundtofixed">roundToFixed(aNumber, precision)</a>:</p>
  54.160 -<blockquote>
  54.161 -<p>Return a string representation of <tt class="docutils literal"><span class="pre">aNumber</span></tt>, rounded to <tt class="docutils literal"><span class="pre">precision</span></tt>
  54.162 -digits with trailing zeros. This is similar to
  54.163 -<tt class="docutils literal"><span class="pre">Number.toFixed(aNumber,</span> <span class="pre">precision)</span></tt>, but this has implementation
  54.164 -consistent rounding behavior (some versions of Safari round 0.5 down!)
  54.165 -and also includes preceding <tt class="docutils literal"><span class="pre">0</span></tt> for numbers less than <tt class="docutils literal"><span class="pre">1</span></tt> (Safari,
  54.166 -again).</p>
  54.167 -<p>For example, <a class="mochiref reference" href="#fn-roundtofixed">roundToFixed(0.1357, 2)</a> returns <tt class="docutils literal"><span class="pre">0.14</span></tt> on every
  54.168 -supported platform, where some return <tt class="docutils literal"><span class="pre">.13</span></tt> for <tt class="docutils literal"><span class="pre">(0.1357).toFixed(2)</span></tt>.</p>
  54.169 -</blockquote>
  54.170 -<p>
  54.171 -<a name="fn-rstrip"></a>
  54.172 -<a class="mochidef reference" href="#fn-rstrip">rstrip(str, chars=&quot;\s&quot;)</a>:</p>
  54.173 -<blockquote>
  54.174 -<p>Returns a string based on <tt class="docutils literal"><span class="pre">str</span></tt> with trailing whitespace stripped.</p>
  54.175 -<p>If <tt class="docutils literal"><span class="pre">chars</span></tt> is given, then that expression will be used instead of
  54.176 -whitespace. <tt class="docutils literal"><span class="pre">chars</span></tt> should be a string suitable for use in a <tt class="docutils literal"><span class="pre">RegExp</span></tt>
  54.177 -<tt class="docutils literal"><span class="pre">[character</span> <span class="pre">set]</span></tt>.</p>
  54.178 -</blockquote>
  54.179 -<p>
  54.180 -<a name="fn-strip"></a>
  54.181 -<a class="mochidef reference" href="#fn-strip">strip(str, chars=&quot;\s&quot;)</a>:</p>
  54.182 -<blockquote>
  54.183 -<p>Returns a string based on <tt class="docutils literal"><span class="pre">str</span></tt> with leading and trailing whitespace
  54.184 -stripped (equivalent to <a class="mochiref reference" href="#fn-lstrip">lstrip(rstrip(str, chars), chars)</a>).</p>
  54.185 -<p>If <tt class="docutils literal"><span class="pre">chars</span></tt> is given, then that expression will be used instead of
  54.186 -whitespace. <tt class="docutils literal"><span class="pre">chars</span></tt> should be a string suitable for use in a <tt class="docutils literal"><span class="pre">RegExp</span></tt>
  54.187 -<tt class="docutils literal"><span class="pre">[character</span> <span class="pre">set]</span></tt>.</p>
  54.188 -</blockquote>
  54.189 -<p>
  54.190 -<a name="fn-trunctofixed"></a>
  54.191 -<a class="mochidef reference" href="#fn-trunctofixed">truncToFixed(aNumber, precision)</a>:</p>
  54.192 -<blockquote>
  54.193 -<p>Return a string representation of <tt class="docutils literal"><span class="pre">aNumber</span></tt>, truncated to <tt class="docutils literal"><span class="pre">precision</span></tt>
  54.194 -digits with trailing zeros. This is similar to
  54.195 -<tt class="docutils literal"><span class="pre">aNumber.toFixed(precision)</span></tt>, but this truncates rather than rounds and
  54.196 -has implementation consistent behavior for numbers less than 1.
  54.197 -Specifically, <a class="mochiref reference" href="#fn-trunctofixed">truncToFixed(aNumber, precision)</a> will always have a
  54.198 -preceding <tt class="docutils literal"><span class="pre">0</span></tt> for numbers less than <tt class="docutils literal"><span class="pre">1</span></tt>.</p>
  54.199 -<p>For example, <a class="mochiref reference" href="#fn-tofixed">toFixed(0.1357, 2)</a> returns <tt class="docutils literal"><span class="pre">0.13</span></tt>.</p>
  54.200 -</blockquote>
  54.201 -<p>
  54.202 -<a name="fn-twodigitaverage"></a>
  54.203 -<a class="mochidef reference" href="#fn-twodigitaverage">twoDigitAverage(numerator, denominator)</a>:</p>
  54.204 -<blockquote>
  54.205 -<p>Calculate an average from a numerator and a denominator and return
  54.206 -it as a string with two digits of precision (e.g. &quot;1.23&quot;).</p>
  54.207 -<p>If the denominator is 0, &quot;0&quot; will be returned instead of <tt class="docutils literal"><span class="pre">NaN</span></tt>.</p>
  54.208 -</blockquote>
  54.209 -<p>
  54.210 -<a name="fn-twodigitfloat"></a>
  54.211 -<a class="mochidef reference" href="#fn-twodigitfloat">twoDigitFloat(someFloat)</a>:</p>
  54.212 -<blockquote>
  54.213 -<p>Roughly equivalent to: <tt class="docutils literal"><span class="pre">sprintf(&quot;%.2f&quot;,</span> <span class="pre">someFloat)</span></tt></p>
  54.214 -<p>In new code, you probably want to use
  54.215 -<a class="mochiref reference" href="#fn-numberformatter">numberFormatter(&quot;#.##&quot;)(someFloat)</a> instead.</p>
  54.216 -</blockquote>
  54.217 -</div>
  54.218 -</div>
  54.219 -<div class="section">
  54.220 -<h1><a id="see-also" name="see-also">See Also</a></h1>
  54.221 -<table class="docutils footnote" frame="void" id="id2" rules="none">
  54.222 -<colgroup><col class="label" /><col /></colgroup>
  54.223 -<tbody valign="top">
  54.224 -<tr><td class="label"><a class="fn-backref" href="#id1" name="id2">[1]</a></td><td>Java Number Format Pattern Syntax:
  54.225 -<a class="reference" href="http://java.sun.com/docs/books/tutorial/i18n/format/numberpattern.html">http://java.sun.com/docs/books/tutorial/i18n/format/numberpattern.html</a></td></tr>
  54.226 -</tbody>
  54.227 -</table>
  54.228 -</div>
  54.229 -<div class="section">
  54.230 -<h1><a id="authors" name="authors">Authors</a></h1>
  54.231 -<ul class="simple">
  54.232 -<li>Bob Ippolito &lt;<a class="reference" href="mailto:bob&#64;redivi.com">bob&#64;redivi.com</a>&gt;</li>
  54.233 -</ul>
  54.234 -</div>
  54.235 -<div class="section">
  54.236 -<h1><a id="copyright" name="copyright">Copyright</a></h1>
  54.237 -<p>Copyright 2005 Bob Ippolito &lt;<a class="reference" href="mailto:bob&#64;redivi.com">bob&#64;redivi.com</a>&gt;. This program is dual-licensed
  54.238 -free software; you can redistribute it and/or modify it under the terms of the
  54.239 -<a class="reference" href="http://www.opensource.org/licenses/mit-license.php">MIT License</a> or the <a class="reference" href="http://www.opensource.org/licenses/afl-2.1.php">Academic Free License v2.1</a>.</p>
  54.240 -</div>
  54.241 -</div>
  54.242 -
  54.243 -</body>
  54.244 -</html>
    55.1 --- a/pub/Foswiki/SmartEditAddOn/mochikit/doc/html/MochiKit/Iter.html	Mon Apr 13 12:51:06 2009 +0200
    55.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.3 @@ -1,372 +0,0 @@
    55.4 -<?xml version="1.0" encoding="utf-8" ?>
    55.5 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    55.6 -
    55.7 -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    55.8 -<head>
    55.9 -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   55.10 -<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
   55.11 -<title>MochiKit.Iter - itertools for JavaScript; iteration made HARD, and then easy</title>
   55.12 -
   55.13 -<link rel="stylesheet" href="../../../include/css/documentation.css" type="text/css" />
   55.14 -<script type="text/javascript" src="../../../packed/lib/MochiKit/MochiKit.js"></script>
   55.15 -<script type="text/javascript" src="../../js/toc.js"></script>
   55.16 -</head>
   55.17 -<body>
   55.18 -<div class="document">
   55.19 -<div class="section">
   55.20 -<h1><a id="name" name="name">Name</a></h1>
   55.21 -<p>MochiKit.Iter - itertools for JavaScript; iteration made HARD, and then easy</p>
   55.22 -</div>
   55.23 -<div class="section">
   55.24 -<h1><a id="synopsis" name="synopsis">Synopsis</a></h1>
   55.25 -<pre class="literal-block">
   55.26 -theSum = sum(takewhile(
   55.27 -        partial(operator.gt, 10),
   55.28 -        imap(
   55.29 -            partial(operator.mul, 2),
   55.30 -            count()
   55.31 -        )
   55.32 -    )
   55.33 -));
   55.34 -
   55.35 -assert( theSum == (0 + 0 + 2 + 4 + 6 + 8) );
   55.36 -</pre>
   55.37 -</div>
   55.38 -<div class="section">
   55.39 -<h1><a id="description" name="description">Description</a></h1>
   55.40 -<p>All of the functional programming missing from <a class="mochiref reference" href="Base.html">MochiKit.Base</a> lives
   55.41 -here. The functionality in this module is largely inspired by Python's iteration
   55.42 -protocol <a class="footnote-reference" href="#id4" id="id1" name="id1">[1]</a>, and the itertools module <a class="footnote-reference" href="#id5" id="id2" name="id2">[2]</a>.</p>
   55.43 -<p>MochiKit.Iter defines a standard way to iterate over anything, that you can
   55.44 -extend with <a class="mochiref reference" href="#fn-registeriterator">registerIterator</a>, or by implementing the <tt class="docutils literal"><span class="pre">.iter()</span></tt>
   55.45 -protocol. Iterators are lazy, so it can potentially be cheaper to build a
   55.46 -filter chain of iterators than to build lots of intermediate arrays.
   55.47 -Especially when the data set is very large, but the result is not.</p>
   55.48 -</div>
   55.49 -<div class="section">
   55.50 -<h1><a id="dependencies" name="dependencies">Dependencies</a></h1>
   55.51 -<ul class="simple">
   55.52 -<li><a class="mochiref reference" href="Base.html">MochiKit.Base</a></li>
   55.53 -</ul>
   55.54 -</div>
   55.55 -<div class="section">
   55.56 -<h1><a id="overview" name="overview">Overview</a></h1>
   55.57 -<div class="section">
   55.58 -<h2><a id="iteration-for-javascript" name="iteration-for-javascript">Iteration for JavaScript</a></h2>
   55.59 -<p>The best overview right now is in my Iteration for JavaScript <a class="footnote-reference" href="#id6" id="id3" name="id3">[3]</a> blog entry.
   55.60 -This information will migrate here eventually.</p>
   55.61 -</div>
   55.62 -</div>
   55.63 -<div class="section">
   55.64 -<h1><a id="api-reference" name="api-reference">API Reference</a></h1>
   55.65 -<div class="section">
   55.66 -<h2><a id="errors" name="errors">Errors</a></h2>
   55.67 -<p>
   55.68 -<a name="fn-stopiteration"></a>
   55.69 -<a class="mochidef reference" href="#fn-stopiteration">StopIteration</a>:</p>
   55.70 -<blockquote>
   55.71 -The singleton <a class="mochiref reference" href="Base.html#fn-namederror">MochiKit.Base.NamedError</a> that signifies the end
   55.72 -of an iterator</blockquote>
   55.73 -</div>
   55.74 -<div class="section">
   55.75 -<h2><a id="functions" name="functions">Functions</a></h2>
   55.76 -<p>
   55.77 -<a name="fn-applymap"></a>
   55.78 -<a class="mochidef reference" href="#fn-applymap">applymap(fun, seq[, self])</a>:</p>
   55.79 -<blockquote>
   55.80 -<dl class="docutils">
   55.81 -<dt><tt class="docutils literal"><span class="pre">applymap(fun,</span> <span class="pre">seq)</span></tt> --&gt;</dt>
   55.82 -<dd>fun.apply(self, seq0), fun.apply(self, seq1), ...</dd>
   55.83 -</dl>
   55.84 -</blockquote>
   55.85 -<p>
   55.86 -<a name="fn-chain"></a>
   55.87 -<a class="mochidef reference" href="#fn-chain">chain(p, q[, ...])</a>:</p>
   55.88 -<blockquote>
   55.89 -<tt class="docutils literal"><span class="pre">chain(p,</span> <span class="pre">q,</span> <span class="pre">...)</span></tt> --&gt; p0, p1, ... plast, q0, q1, ...</blockquote>
   55.90 -<p>
   55.91 -<a name="fn-count"></a>
   55.92 -<a class="mochidef reference" href="#fn-count">count(n=0)</a>:</p>
   55.93 -<blockquote>
   55.94 -<tt class="docutils literal"><span class="pre">count(n=0)</span></tt> --&gt; n, n + 1, n + 2, ...</blockquote>
   55.95 -<p>
   55.96 -<a name="fn-cycle"></a>
   55.97 -<a class="mochidef reference" href="#fn-cycle">cycle(p)</a>:</p>
   55.98 -<blockquote>
   55.99 -<tt class="docutils literal"><span class="pre">cycle(p)</span></tt> --&gt; p0, p1, ... plast, p0, p1, ...</blockquote>
  55.100 -<p>