<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Prototype JavaScript framework - Prototype</title>
  <id>tag:www.prototypejs.org,2008:mephisto/api/prototype</id>
  <generator uri="http://mephistoblog.com" version="0.7.3">Mephisto Noh-Varr</generator>
  <link href="http://www.prototypejs.org/feed/api/prototype/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://www.prototypejs.org/api/prototype" rel="alternate" type="text/html"/>
  <updated>2007-01-16T15:27:12Z</updated>
  <entry xml:base="http://www.prototypejs.org/">
    <author>
      <name>Tobie</name>
    </author>
    <id>tag:www.prototypejs.org,2007-01-16:13073</id>
    <published>2007-01-16T03:42:00Z</published>
    <updated>2007-01-16T15:27:12Z</updated>
    <category term="Prototype"/>
    <link href="http://www.prototypejs.org/api/prototype/emptyfunction" rel="alternate" type="text/html"/>
    <title>emptyFunction</title>
<summary type="html">&lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;emptyFunction([argument...])&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The &lt;code&gt;emptyFunction&lt;/code&gt; does nothing&#8230; and returns nothing!&lt;/p&gt;</summary><content type="html">
            &lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;emptyFunction([argument...])&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The &lt;code&gt;emptyFunction&lt;/code&gt; does nothing&#8230; and returns nothing!&lt;/p&gt;
&lt;p&gt;It is used thoughout the framework to provide a fallback function in order to cut down on conditionals. Typically you&#8217;ll find it as a default value for optional callback functions.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.prototypejs.org/">
    <author>
      <name>Tobie</name>
    </author>
    <id>tag:www.prototypejs.org,2007-01-16:13072</id>
    <published>2007-01-16T03:25:00Z</published>
    <updated>2007-01-16T03:42:02Z</updated>
    <category term="Prototype"/>
    <link href="http://www.prototypejs.org/api/prototype/K" rel="alternate" type="text/html"/>
    <title>K</title>
<summary type="html">&lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;K(argument) -&gt; argument&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;code&gt;K&lt;/code&gt; is Prototype&#8217;s very own &lt;a href=&quot;http://en.wikipedia.org/wiki/Identity_function&quot;&gt;identity function&lt;/a&gt;, i.e. it returns its &lt;code&gt;argument&lt;/code&gt; untouched.&lt;/p&gt;</summary><content type="html">
            &lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;K(argument) -&gt; argument&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;code&gt;K&lt;/code&gt; is Prototype&#8217;s very own &lt;a href=&quot;http://en.wikipedia.org/wiki/Identity_function&quot;&gt;identity function&lt;/a&gt;, i.e. it returns its &lt;code&gt;argument&lt;/code&gt; untouched.&lt;/p&gt;
&lt;p&gt;This is used throughout the framework, most notably in the &lt;a href=&quot;/api/enumerable&quot;&gt;Enumerable&lt;/a&gt; module as a default value for iterators.&lt;/p&gt;

&lt;h3&gt;Examples&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;
Prototype.K('hello world!');
// -&gt; 'hello world!'

Prototype.K(1.5);
// -&gt; 1.5

Prototype.K(Prototype.K);
// -&gt; Prototype.K
&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.prototypejs.org/">
    <author>
      <name>Justin</name>
    </author>
    <id>tag:www.prototypejs.org,2007-01-06:12982</id>
    <published>2007-01-06T19:02:00Z</published>
    <updated>2007-03-20T11:08:01Z</updated>
    <category term="Prototype"/>
    <link href="http://www.prototypejs.org/api/prototype" rel="alternate" type="text/html"/>
    <title>Prototype</title>
<content type="html">
            &lt;p&gt;The &lt;code&gt;Prototype&lt;/code&gt; namespace provides fundamental information about the Prototype library you&#8217;re using, as well as a central repository for default iterators or functions.&lt;/p&gt;

&lt;p&gt;We say &#8220;namespace,&#8221; because the &lt;code&gt;Prototype&lt;/code&gt; object is not intended for instantiation, nor for mixing in other objects.  It&#8217;s really just&#8230; a namespace.&lt;/p&gt;

&lt;h3&gt;Your version of Prototype&lt;/h3&gt;

&lt;p&gt;Your scripts can check against a particular version of Prototype by examining &lt;code&gt;Prototype.Version&lt;/code&gt;, which is a version string (e.g. &#8220;1.5.0&#8221;).  The famous &lt;a href=&quot;http://script.aculo.us&quot;&gt;script.aculo.us&lt;/a&gt; library does this at load time to ensure it&#8217;s being used with a reasonably recent version of Prototype, for instance.&lt;/p&gt;

&lt;h3&gt;Browser features&lt;/h3&gt;

&lt;p&gt;Prototype also provides a (nascent) repository of browser feature information, which it then uses here and there in its source code.  The idea is, first, to make Prototype&#8217;s source code more readable; and second, to centralize whatever scripting trickery might be necessary to detect the browser feature, in order to ease maintenance.&lt;/p&gt;

&lt;p&gt;The only currently available feature detection is browser support for &lt;a href=&quot;http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html&quot;&gt;DOM Level 3 XPath&lt;/a&gt;, accessible as a &lt;code&gt;boolean&lt;/code&gt; at &lt;code&gt;Prototype.BrowserFeatures.XPath&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;Default iterators and functions&lt;/h3&gt;

&lt;p&gt;Numerous methods in Prototype objects (most notably the &lt;a href=&quot;/api/enumerable&quot;&gt;&lt;code&gt;Enumerable&lt;/code&gt;&lt;/a&gt; module) let the user pass in a custom iterator, but make it optional by defaulting to an &#8220;identity function&#8221; (an iterator that just returns its argument, untouched).  This is the &lt;code&gt;Prototype.K&lt;/code&gt; function, which you&#8217;ll see referred to in many places.&lt;/p&gt;

&lt;p&gt;Many methods also take it easy by protecting themselves against missing methods here and there, reverting to empty functions when a supposedly available method is missing.  Such a function simply ignores its potential arguments, and does nothing whatsoever (which is, oddly enough, blazing fast).  The quintessential empty function sits, unsurprisingly, at &lt;code&gt;Prototype.emptyFunction&lt;/code&gt; (note the lowercase first letter).&lt;/p&gt;
          </content>  </entry>
</feed>
