webgui/www/extras/yui/docs/yahoo/overview-summary-YAHOO.js.html
JT Smith 4f68a0933c added YUI and YUI-ext
fixed the resizable text area with IE problem
fixed the ad space with IE problem
merged the 7.2.0 and 7.1.4 change logs
2006-11-07 23:15:57 +00:00

241 lines
6.5 KiB
HTML

<html>
<head>
<!--<title>YUI API - YAHOO.js</title>-->
<!--<title>YUI API - YAHOO.js </title>-->
<title>API: %%COMPONENT%% %%FILE%% (YUI Library)</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
<h1>Yahoo! UI Library</h1>
<h3><a href="./index.html">Yahoo Global Namespace</a></h3>
<div class="breadcrumbs">
<a href="./index.html">Yahoo Global Namespace</a>
&gt;
<strong>YAHOO.js</strong>
</div>
</div>
<div id="body">
<div class="nav">
<div class="module resources">
<ul class="content">
<li><a href="overview-tree.html">Tree View</a></li>
<li><a href="index-all.html">Element Index</a></li>
</ul>
</div>
<div class="module">
<h4><a href="./allclasses-noframe.html">Classes</a></h4>
<ul class="content">
<li>
<a href="subclass.html">
subclass</a>
</li>
<li>
<a href="superclass.html">
superclass</a>
</li>
<li>
<a href="YAHOO.html">
YAHOO</a>
</li>
</ul>
</div>
<div class="module">
<h4><a href="./overview-summary.html">Files</a></h4>
<ul class="content">
<li>
<a href="overview-summary-YAHOO.js.html">
YAHOO.js</a>
</li>
</ul>
</div>
</div>
<div class="main">
<h2>YAHOO.js</h2>
<div class="quick-links">
<strong>Quick Links:</strong>&nbsp;
<a href="#classSummary">Class Summary</a> |
<a href="#source">Source Code</a>
</div>
<div class="section class summaries">
<h3><a name="classSummary">Class Summary</a> <span class="top">[<a href="#top">top</a>]</span></h3>
<div class="content">
<table border="1" cellpadding="3" cellspacing="0">
<tr>
<td class="name">
<a href="YAHOO.html">YAHOO</a>
</td>
<td class="overview">&nbsp;</td>
</tr>
</table>
</div>
</div>
<div class="section source">
<h3><a name="source">Souce Code</a> <span class="top">[<a href="#top">top</a>]</span></h3>
<pre class="sourceview"><span class="comment">/**
* The Yahoo global namespace
* <span class="attrib">@constructor</span>
*/</span>
<span class="comment">//window.YAHOO = window.YAHOO || {};</span>
<span class="reserved">function</span> YAHOO() {}
<span class="comment">/**
* Returns the namespace specified and creates it if it doesn't exist
*
* YAHOO.namespace("property.package");
* YAHOO.namespace("YAHOO.property.package");
*
* Either of the above would create YAHOO.property, then
* YAHOO.property.package
*
* Be careful when naming packages. Reserved words may work in some browsers
* and not others. For instance, the following will fail in Safari:
*
* YAHOO.namespace("really.long.nested.namespace");
*
* This fails because "long" is a future reserved word in ECMAScript
*
* <span class="attrib">@param</span> {String} ns The name of the namespace
* <span class="attrib">@return</span> {Object} A reference to the namespace object
*/</span>
YAHOO.namespace = <span class="reserved">function</span>(ns) {
<span class="reserved">if</span> (!ns || !ns.length) {
<span class="reserved">return</span> null;
}
var levels = ns.split(<span class="literal">"."</span>);
var nsobj = YAHOO;
<span class="comment">
// YAHOO is implied, so it is ignored if it is included</span>
<span class="reserved">for</span> (var i=(levels[0] == <span class="literal">"YAHOO"</span>) ? 1 : 0; i&lt;levels.length; ++i) {
nsobj[levels[i]] = nsobj[levels[i]] || {};
nsobj = nsobj[levels[i]];
}
<span class="reserved">return</span> nsobj;
};
<span class="comment">/**
* Uses YAHOO.widget.Logger to output a log message, if the widget is available.
*
* <span class="attrib">@param</span> {string} sMsg The message to log.
* <span class="attrib">@param</span> {string} sCategory The log category for the message. Default
* categories are "info", "warn", "error", time".
* Custom categories can be used as well. (opt)
* <span class="attrib">@param</span> {string} sSource The source of the the message (opt)
* <span class="attrib">@return</span> {boolean} True if the log operation was successful.
*/</span>
YAHOO.log = <span class="reserved">function</span>(sMsg, sCategory, sSource) {
var l = YAHOO.widget.Logger;
<span class="reserved">if</span>(l &amp;&amp; l.log) {
<span class="reserved">return</span> l.log(sMsg, sCategory, sSource);
} <span class="reserved">else</span> {
<span class="reserved">return</span> false;
}
};
<span class="comment">/**
* Utility to set up the prototype, constructor and superclass properties to
* support an inheritance strategy that can chain constructors and methods.
*
* <span class="attrib">@param</span> {function} subclass the object to modify
* <span class="attrib">@param</span> {function} superclass the object to inherit
*/</span>
YAHOO.extend = <span class="reserved">function</span>(subclass, superclass) {
var f = <span class="reserved">function</span>() {};
f.<span class="reserved">prototype</span> = superclass.<span class="reserved">prototype</span>;
subclass.<span class="reserved">prototype</span> = new f();
subclass.<span class="reserved">prototype</span>.constructor = subclass;
subclass.superclass = superclass.<span class="reserved">prototype</span>;
<span class="reserved">if</span> (superclass.<span class="reserved">prototype</span>.constructor == Object.<span class="reserved">prototype</span>.constructor) {
superclass.<span class="reserved">prototype</span>.constructor = superclass;
}
};
YAHOO.namespace(<span class="literal">"util"</span>);
YAHOO.namespace(<span class="literal">"widget"</span>);
YAHOO.namespace(<span class="literal">"example"</span>);
</pre>
</div>
</div>
</div>
<div id="footer">
<hr />
Copyright &copy; 2004 - 2006 Yahoo! Inc. All rights reserved.
</div>
</body>
</html>