selenium-webdriver
Version:
The official WebDriver JavaScript bindings from the Selenium project
227 lines (194 loc) • 60.2 kB
HTML
<!DOCTYPE html><meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>goog</title><link href="dossier.css" rel="stylesheet" type="text/css"><div id="main-wrapper"><input type="checkbox" id="sidenav-toggle" /><main><header><h1>Namespace goog</h1><a class="source" href="source/lib/goog/base.js.src.html#l41">code »</a></header><section><p>Base namespace for the Closure library. Checks to see goog is
already defined in the current scope before assigning to prevent
clobbering if base.js is loaded more than once.</section><section><h2>Classes</h2><div class="type-summary"><table><tbody><tr><td><dl><dt><a href="class_goog_Uri.html">goog.Uri</a><dd>This class contains setters and getters for the parts of the URI.</dl></table></div></section><div id="visibility-controls"><b>Show:</b><label for="show-public"><span><input type="checkbox" id="show-public" checked/></span>Public</label><label for="show-protected"><span><input type="checkbox" id="show-protected"/></span>Protected</label><label for="show-private"><span><input type="checkbox" id="show-private"/></span>Private</label></div><section id="static-functions"><h2>Global Functions</h2><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l475">code »</a><span class="member"><a name="goog.abstractMethod">goog.abstractMethod</a> <span class="args">( )</span></span></div><p>When defining a class Foo with an abstract method bar(), you can do:
Foo.prototype.bar = goog.abstractMethod
Now if a subclass of Foo fails to override bar(), an error
will be thrown when bar() is invoked.
Note: This does not take the name of the function to override as
an argument because that would make it more difficult to obfuscate
our JavaScript code.</summary><div class="info"><table><tbody><tr><th>Throws<tr><td><dl><dt><code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Error">Error</a></code><dd>when invoked to indicate the method should be
overridden.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l306">code »</a><span class="member"><a name="goog.addDependency">goog.addDependency</a> <span class="args">( relPath, provides, requires )</span></span></div><p>Adds a dependency from a file to the files it requires.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>relPath: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The path to the js file.<dt>provides: <code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></code><dd>An array of strings with the names of the objects
this file provides.<dt>requires: <code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></code><dd>An array of strings with the names of the objects
this file requires.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l486">code »</a><span class="member"><a name="goog.addSingletonGetter">goog.addSingletonGetter</a> <span class="args">( ctor )</span></span></div><p>Adds a <code >getInstance</code> static method that always return the same instance
object.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>ctor: <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code><dd>The constructor for the class to add the static
method to.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1555">code »</a><span class="member"><a name="goog.base">goog.base</a> <span class="args">( me, opt_methodName, var_args )</span> ⇒ <code class="type">*</code></span></div><p>Call up to the superclass.
If this is called from a constructor, then this calls the superclass
contructor with arguments 1-N.
If this is called from a prototype method, then you must pass
the name of the method as the second argument to this function. If
you do not, you will get a runtime error. This calls the superclass'
method with arguments 2-N.
This function only works if you use goog.inherits to express
inheritance relationships between your classes.
This function is a compiler primitive. At compile-time, the
compiler will do macro expansion to remove a lot of
the extra overhead that this function introduces. The compiler
will also enforce a lot of the assumptions that this function
makes, and treat it as a compiler error if you break them.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>me: <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>Should always be "this".<dt>opt_methodName: <code class="type">*=</code><dd>The method name if calling a super method.<dt>var_args: <code class="type">...*</code><dd>The rest of the arguments.</dl><tr><th>Returns<tr><td><dl>The return value of the superclass method.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1139">code »</a><code class="type"><T></code> <span class="member"><a name="goog.bind">goog.bind</a> <span class="args">( fn, selfObj, var_args )</span> ⇒ <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code></span></div><p>Partially applies this function to a particular 'this object' and zero or
more arguments. The result is a new function with some arguments of the first
function pre-filled and the value of |this| 'pre-specified'.<br><br>
Remaining arguments specified at call-time are appended to the pre-
specified ones.<br><br>
Also see: <code class="type"><a class="unresolved-link">#partial</a></code>.<br><br>
Usage:
<pre>var barMethBound = bind(myFunction, myObj, 'arg1', 'arg2');
barMethBound('arg3', 'arg4');</pre></summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>fn: <code class="type">?function(this: T, ...)</code><dd>A function to partially apply.<dt>selfObj: <code class="type">T</code><dd>Specifies the object which |this| should
point to when the function is run.<dt>var_args: <code class="type">...*</code><dd>Additional arguments that are partially
applied to the function.</dl><tr><th>Returns<tr><td><dl>A partially-applied form of the function bind() was
invoked as a method of.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1093">code »</a><span class="member"><a name="goog.bindJs_">goog.bindJs_</a> <span class="args">( fn, selfObj, var_args )</span> ⇒ <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code></span></div><p>A pure-JS implementation of goog.bind.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>fn: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code><dd>A function to partially apply.<dt>selfObj: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>)</code><dd>Specifies the object which |this| should
point to when the function is run.<dt>var_args: <code class="type">...*</code><dd>Additional arguments that are partially
applied to the function.</dl><tr><th>Returns<tr><td><dl>A partially-applied form of the function bind() was
invoked as a method of.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1077">code »</a><span class="member"><a name="goog.bindNative_">goog.bindNative_</a> <span class="args">( fn, selfObj, var_args )</span> ⇒ <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code></span></div><p>A native implementation of goog.bind.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>fn: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code><dd>A function to partially apply.<dt>selfObj: <code class="type">(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Undefined">undefined</a>)</code><dd>Specifies the object which |this| should
point to when the function is run.<dt>var_args: <code class="type">...*</code><dd>Additional arguments that are partially
applied to the function.</dl><tr><th>Returns<tr><td><dl>A partially-applied form of the function bind() was
invoked as a method of.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1046">code »</a><span class="member deprecation-notice"><a name="goog.cloneObject">goog.cloneObject</a> <span class="args">( obj )</span> ⇒ <code class="type">*</code></span></div><div class="deprecation-notice">Deprecated: <span class="deprecation-reason">goog.cloneObject is unsafe. Prefer the goog.object methods.</span></div><p>Clones a value. The input may be an Object, Array, or basic type. Objects and
arrays will be cloned recursively.
WARNINGS:
<code>goog.cloneObject</code> does not detect reference loops. Objects that
refer to themselves will cause infinite recursion.
<code>goog.cloneObject</code> is unaware of unique identifiers, and copies
UIDs created by <code>getUid</code> into cloned results.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type">*</code><dd>The value to clone.</dl><tr><th>Returns<tr><td><dl>A clone of the input value.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l120">code »</a><span class="member"><a name="goog.define">goog.define</a> <span class="args">( name, defaultValue )</span></span></div><p>Defines a named value. In uncompiled mode, the value is retreived from
CLOSURE_DEFINES if the object is defined and has the property specified,
and otherwise used the defined defaultValue. When compiled, the default
can be overridden using compiler command-line options.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>name: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The distinguished name to provide.<dt>defaultValue</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l81">code »</a><span class="member"><a name="goog.exportPath_">goog.exportPath_</a> <span class="args">( name, opt_object, opt_objectToExportTo )</span></span></div><p>Builds an object structure for the provided namespace path,
ensuring that names that already exist are not overwritten. For
example:
"a.b.c" -> a = {};a.b={};a.b.c={};
Used by goog.provide and goog.exportSymbol.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>name: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>name of the object that this file defines.<dt>opt_object: <code class="type">*=</code><dd>the object to expose at the end of the path.<dt>opt_objectToExportTo: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd>The object to add the path to; default
is |goog.global|.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1484">code »</a><span class="member"><a name="goog.exportProperty">goog.exportProperty</a> <span class="args">( object, publicName, symbol )</span></span></div><p>Exports a property unobfuscated into the object's namespace.
ex. goog.exportProperty(Foo, 'staticFunction', Foo.staticFunction);
ex. goog.exportProperty(Foo.prototype, 'myMethod', Foo.prototype.myMethod);</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>object: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>Object whose static property is being exported.<dt>publicName: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>Unobfuscated name to export.<dt>symbol: <code class="type">*</code><dd>Object the name should point to.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1471">code »</a><span class="member"><a name="goog.exportSymbol">goog.exportSymbol</a> <span class="args">( publicPath, object, opt_objectToExportTo )</span></span></div><p>Exposes an unobfuscated global namespace path for the given object.
Note that fields of the exported object *will* be obfuscated,
unless they are exported in turn via this function or
goog.exportProperty
<p>Also handy for making public items that are defined in anonymous
closures.
ex. goog.exportSymbol('public.path.Foo', Foo);
ex. goog.exportSymbol('public.path.Foo.staticFunction',
Foo.staticFunction);
public.path.Foo.staticFunction();
ex. goog.exportSymbol('public.path.Foo.prototype.myMethod',
Foo.prototype.myMethod);
new public.path.Foo().myMethod();</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>publicPath: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>Unobfuscated name to export.<dt>object: <code class="type">*</code><dd>Object the name should point to.<dt>opt_objectToExportTo: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd>The object to add the path to; default
is |goog.global|.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l560">code »</a><span class="member"><a name="goog.findBasePath_">goog.findBasePath_</a> <span class="args">( )</span></span></div><p>Tries to detect the base path of the base.js script that bootstraps Closure</summary></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1317">code »</a><span class="member"><a name="goog.getCssName">goog.getCssName</a> <span class="args">( className, opt_modifier )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Handles strings that are intended to be used as CSS class names.
This function works in tandem with @see goog.setCssNameMapping.
Without any mapping set, the arguments are simple joined with a
hyphen and passed through unaltered.
When there is a mapping, there are two possible styles in which
these mappings are used. In the BY_PART style, each part (i.e. in
between hyphens) of the passed in css name is rewritten according
to the map. In the BY_WHOLE style, the full css name is looked up in
the map directly. If a rewrite is not specified by the map, the
compiler will output a warning.
When the mapping is passed to the compiler, it will replace calls
to goog.getCssName with the strings from the mapping, e.g.
var x = goog.getCssName('foo');
var y = goog.getCssName(this.baseClass, 'active');
becomes:
var x= 'foo';
var y = this.baseClass + '-active';
If one argument is passed it will be processed, if two are passed
only the modifier will be processed, as it is assumed the first
argument was generated as a result of calling goog.getCssName.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>className: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The class name.<dt>opt_modifier: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>=</code><dd>A modifier to be appended to the class name.</dl><tr><th>Returns<tr><td><dl>The class name or the concatenation of the class name and
the modifier.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1020">code »</a><span class="member deprecation-notice"><a name="goog.getHashCode">goog.getHashCode</a> <span class="args">( obj )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><div class="deprecation-notice">Deprecated: <span class="deprecation-reason">Use goog.getUid instead.</span></div><p>Adds a hash code field to an object. The hash code is unique for the
given object.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>The object to get the hash code for.</dl><tr><th>Returns<tr><td><dl>The hash code for the object.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1417">code »</a><span class="member"><a name="goog.getMsg">goog.getMsg</a> <span class="args">( str, opt_values )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Gets a localized message.
This function is a compiler primitive. If you give the compiler a localized
message bundle, it will replace the string at compile-time with a localized
version, and expand goog.getMsg call to a concatenated string.
Messages must be initialized in the form:
<code>
var MSG_NAME = goog.getMsg('Hello {$placeholder}', {'placeholder': 'world'});
</code></summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>str: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>Translatable string, places holders in the form {$foo}.<dt>opt_values: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd>Map of place holder name to value.</dl><tr><th>Returns<tr><td><dl>message with placeholders filled.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1442">code »</a><span class="member"><a name="goog.getMsgWithFallback">goog.getMsgWithFallback</a> <span class="args">( a, b )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Gets a localized message. If the message does not have a translation, gives a
fallback message.
This is useful when introducing a new message that has not yet been
translated into all languages.
This function is a compiler primtive. Must be used in the form:
<code>var x = goog.getMsgWithFallback(MSG_A, MSG_B);</code>
where MSG_A and MSG_B were initialized with goog.getMsg.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>a: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The preferred message.<dt>b: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The fallback message.</dl><tr><th>Returns<tr><td><dl>The best translated message.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l268">code »</a><span class="member"><a name="goog.getObjectByName">goog.getObjectByName</a> <span class="args">( name, opt_obj )</span></span></div><p>Returns an object based on its fully qualified external name. If you are
using a compilation pass that renames property names beware that using this
function will not find renamed properties.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>name: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>The fully qualified name.<dt>opt_obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd>The object within which to look; default is
|goog.global|.</dl><tr><th>Returns<tr><td><dl>The value (object or primitive) or, if not found, null.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l706">code »</a><span class="member"><a name="goog.getPathFromDeps_">goog.getPathFromDeps_</a> <span class="args">( rule )</span> ⇒ <code class="type">?<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Looks at the dependency rules and tries to determine the script file that
fulfills a particular rule.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>rule: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>In the form goog.namespace.Class or project.script.</dl><tr><th>Returns<tr><td><dl>Url corresponding to the rule, or null.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l963">code »</a><span class="member"><a name="goog.getUid">goog.getUid</a> <span class="args">( obj )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Gets a unique ID for an object. This mutates the object so that further
calls with the same object as a parameter returns the same value. The unique
ID is guaranteed to be unique across the current session amongst objects that
are passed into <code >getUid</code>. There is no guarantee that the ID is unique
or consistent across sessions. It is unsafe to generate unique ID for
function prototypes.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>The object to get the unique ID for.</dl><tr><th>Returns<tr><td><dl>The unique ID for the object.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1221">code »</a><span class="member"><a name="goog.globalEval">goog.globalEval</a> <span class="args">( script )</span></span></div><p>Evals javascript in the global scope. In IE this uses execScript, other
browsers use goog.global.eval. If goog.global.eval does not evaluate in the
global scope (for example, in Safari), appends a script tag instead.
Throws an exception if neither execScript or eval is defined.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>script: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>JavaScript string.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l290">code »</a><span class="member deprecation-notice"><a name="goog.globalize">goog.globalize</a> <span class="args">( obj, opt_global )</span></span></div><div class="deprecation-notice">Deprecated: <span class="deprecation-reason">Properties may be explicitly exported to the global scope, but
this should no longer be done in bulk.</span></div><p>Globalizes a whole namespace, such as goog or goog.lang.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>The namespace to globalize.<dt>opt_global: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>=</code><dd>The object to add the properties to.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l454">code »</a><span class="member deprecation-notice"><a name="goog.identityFunction">goog.identityFunction</a> <span class="args">( opt_returnValue, var_args )</span></span></div><div class="deprecation-notice">Deprecated: <span class="deprecation-reason">Use goog.functions.identity instead.</span></div><p>The identity function. Returns its first argument.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_returnValue: <code class="type">*=</code><dd>The single value that will be returned.<dt>var_args: <code class="type">...*</code><dd>Optional trailing arguments. These are ignored.</dl><tr><th>Returns<tr><td><dl>The first argument. We can't know the type -- just pass it along
without type.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l589">code »</a><span class="member"><a name="goog.importScript_">goog.importScript_</a> <span class="args">( src )</span></span></div><p>Imports a script if, and only if, that script hasn't already been imported.
(Must be called at execution time)</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>src: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>Script source.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l549">code »</a><span class="member"><a name="goog.inHtmlDocument_">goog.inHtmlDocument_</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Tries to detect whether is in the context of an HTML document.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>True if it looks like HTML document.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1519">code »</a><span class="member"><a name="goog.inherits">goog.inherits</a> <span class="args">( childCtor, parentCtor )</span></span></div><p>Inherit the prototype methods from one constructor into another.
Usage:
<pre>
function ParentClass(a, b) { }
ParentClass.prototype.foo = function(a) { }
function ChildClass(a, b, c) {
goog.base(this, a, b);
}
goog.inherits(ChildClass, ParentClass);
var child = new ChildClass('a', 'b', 'see');
child.foo(); // works
</pre>
In addition, a superclass' implementation of a method can be invoked
as follows:
<pre>
ChildClass.prototype.foo = function(a) {
ChildClass.superClass_.foo.call(this, a);
// other code
};
</pre></summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>childCtor: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code><dd>Child class.<dt>parentCtor: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code><dd>Parent class.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l869">code »</a><span class="member"><a name="goog.isArray">goog.isArray</a> <span class="args">( val )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns true if the specified value is an array</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>val: <code class="type">*</code><dd>Variable to test.</dl><tr><th>Returns<tr><td><dl>Whether variable is an array.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l881">code »</a><span class="member"><a name="goog.isArrayLike">goog.isArrayLike</a> <span class="args">( val )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns true if the object looks like an array. To qualify as array like
the value needs to be either a NodeList or an object with a Number length
property.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>val: <code class="type">*</code><dd>Variable to test.</dl><tr><th>Returns<tr><td><dl>Whether variable is an array.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l913">code »</a><span class="member"><a name="goog.isBoolean">goog.isBoolean</a> <span class="args">( val )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns true if the specified value is a boolean</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>val: <code class="type">*</code><dd>Variable to test.</dl><tr><th>Returns<tr><td><dl>Whether variable is boolean.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l893">code »</a><span class="member"><a name="goog.isDateLike">goog.isDateLike</a> <span class="args">( val )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns true if the object looks like a Date. To qualify as Date-like
the value needs to be an object and have a getFullYear() function.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>val: <code class="type">*</code><dd>Variable to test.</dl><tr><th>Returns<tr><td><dl>Whether variable is a like a Date.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l838">code »</a><span class="member"><a name="goog.isDef">goog.isDef</a> <span class="args">( val )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns true if the specified value is not |undefined|.
WARNING: Do not use this to test if an object has a property. Use the in
operator instead. Additionally, this function assumes that the global
undefined variable has not been redefined.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>val: <code class="type">*</code><dd>Variable to test.</dl><tr><th>Returns<tr><td><dl>Whether variable is defined.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l858">code »</a><span class="member"><a name="goog.isDefAndNotNull">goog.isDefAndNotNull</a> <span class="args">( val )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns true if the specified value is defined and not null</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>val: <code class="type">*</code><dd>Variable to test.</dl><tr><th>Returns<tr><td><dl>Whether variable is defined and not null.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l933">code »</a><span class="member"><a name="goog.isFunction">goog.isFunction</a> <span class="args">( val )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns true if the specified value is a function</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>val: <code class="type">*</code><dd>Variable to test.</dl><tr><th>Returns<tr><td><dl>Whether variable is a function.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l848">code »</a><span class="member"><a name="goog.isNull">goog.isNull</a> <span class="args">( val )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns true if the specified value is |null|</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>val: <code class="type">*</code><dd>Variable to test.</dl><tr><th>Returns<tr><td><dl>Whether variable is null.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l923">code »</a><span class="member"><a name="goog.isNumber">goog.isNumber</a> <span class="args">( val )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns true if the specified value is a number</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>val: <code class="type">*</code><dd>Variable to test.</dl><tr><th>Returns<tr><td><dl>Whether variable is a number.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l944">code »</a><span class="member"><a name="goog.isObject">goog.isObject</a> <span class="args">( val )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns true if the specified value is an object. This includes arrays
and functions.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>val: <code class="type">*</code><dd>Variable to test.</dl><tr><th>Returns<tr><td><dl>Whether variable is an object.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l242">code »</a><span class="member"><a name="goog.isProvided_">goog.isProvided_</a> <span class="args">( name )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Check if the given name has been goog.provided. This will return false for
names that are available only as implicit namespaces.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>name: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>name of the object to look for.</dl><tr><th>Returns<tr><td><dl>Whether the name has been provided.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l903">code »</a><span class="member"><a name="goog.isString">goog.isString</a> <span class="args">( val )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns true if the specified value is a string</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>val: <code class="type">*</code><dd>Variable to test.</dl><tr><th>Returns<tr><td><dl>Whether variable is a string.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1190">code »</a><span class="member"><a name="goog.mixin">goog.mixin</a> <span class="args">( target, source )</span></span></div><p>Copies all the members of a source object to a target object. This method
does not work on all browsers for all objects that contain keys such as
toString or hasOwnProperty. Use goog.object.extend for this purpose.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>target: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>Target.<dt>source: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>Source.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1207">code »</a><span class="member"><a name="goog.now">goog.now</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>An integer value representing the number of milliseconds
between midnight, January 1, 1970 and the current time.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l442">code »</a><span class="member"><a name="goog.nullFunction">goog.nullFunction</a> <span class="args">( )</span> ⇒ <code class="type">void</code></span></div><p>Null function used for default values of callbacks, etc.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>Nothing.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1172">code »</a><span class="member"><a name="goog.partial">goog.partial</a> <span class="args">( fn, var_args )</span> ⇒ <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code></span></div><p>Like bind(), except that a 'this object' is not required. Useful when the
target function is already bound.
Usage:
var g = partial(f, arg1, arg2);
g(arg3, arg4);</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>fn: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></code><dd>A function to partially apply.<dt>var_args: <code class="type">...*</code><dd>Additional arguments that are partially
applied to fn.</dl><tr><th>Returns<tr><td><dl>A partially-applied form of the function bind() was
invoked as a method of.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l188">code »</a><span class="member"><a name="goog.provide">goog.provide</a> <span class="args">( name )</span></span></div><p>Creates object stubs for a namespace. The presence of one or more
goog.provide() calls indicate that the file defines the given
objects/namespaces. Build tools also scan for provide/require statements
to discern dependencies, build dependency files (see deps.js), etc.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>name: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>Namespace provided by this file in the form
"goog.package.part".</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1028">code »</a><span class="member deprecation-notice"><a name="goog.removeHashCode">goog.removeHashCode</a> <span class="args">( obj )</span></span></div><div class="deprecation-notice">Deprecated: <span class="deprecation-reason">Use goog.removeUid instead.</span></div><p>Removes the hash code field from an object.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>The object to remove the field from.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l980">code »</a><span class="member"><a name="goog.removeUid">goog.removeUid</a> <span class="args">( obj )</span></span></div><p>Removes the unique ID from an object. This is useful if the object was
previously mutated using <code >goog.getUid</code> in which case the mutation is
undone.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>obj: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>The object to remove the unique ID field from.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l370">code »</a><span class="member"><a name="goog.require">goog.require</a> <span class="args">( name )</span></span></div><p>Implements a system for the dynamic resolution of dependencies
that works in parallel with the BUILD system. Note that all calls
to goog.require will be stripped by the JSCompiler when the
--closure_pass option is used.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>name: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><dd>Namespace to include (as was given in goog.provide())
in the form "goog.package.part".</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1606">code »</a><span class="member"><a name="goog.scope">goog.scope</a> <span class="args">( fn )</span></span></div><p>Allow for aliasing within scope functions. This function exists for
uncompiled code - in compiled code the calls will be inlined and the
aliases applied. In uncompiled code the function is simply run since the
aliases as written are valid JavaScript.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>fn: <code class="type">function()</code><dd>Function to call. This function can contain aliases
to namespaces (e.g. "var dom = goog.dom") or classes
(e.g. "var Timer = goog.Timer").</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l1373">code »</a><span class="member"><a name="goog.setCssNameMapping">goog.setCssNameMapping</a> <span class="args">( mapping, opt_style )</span></span></div><p>Sets the map to check when returning a value from goog.getCssName(). Example:
<pre>
goog.setCssNameMapping({
"goog": "a",
"disabled": "b",
});
var x = goog.getCssName('goog');
// The following evaluates to: "a a-b".
goog.getCssName('goog') + ' ' + goog.getCssName(x, 'disabled')
</pre>
When declared as a map of string literals to string literals, the JSCompiler
will replace all calls to goog.getCssName() using the supplied map if the
--closure_pass flag is set.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>mapping: <code class="type">!<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><dd>A map of strings to strings where keys are possible
arguments to goog.getCssName() and values are the corresponding values
that should be returned.<dt>opt_style: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>=</code><dd>The style of css name mapping. There are two valid
options: 'BY_PART', and 'BY_WHOLE'.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l224">code »</a><span class="member"><a name="goog.setTestOnly">goog.setTestOnly</a> <span class="args">( opt_message )</span></span></div><p>Marks that the current file should only be used for testing, and never for
live code in production.
In the case of unit tests, the message may optionally be an exact
namespace for the test (e.g. 'goog.stringTest'). The linter will then
ignore the extra provide (if not explicitly defined in the code).</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_message: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>=</code><dd>Optional message to add to the error that's
raised when used in production code.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l735">code »</a><span class="member"><a name="goog.typeOf">goog.typeOf</a> <span class="args">( value )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>This is a "fixed" version of the typeof operator. It differs from the typeof
operator in such a way that null returns 'null' and arrays return 'array'.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>value: <code class="type">*</code><dd>The value to get the type of.</dl><tr><th>Returns<tr><td><dl>The name of the type.</dl></table></div></details></div></div><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/base.js.src.html#l606">code »</a><span class="member"><a name="goog.writeScriptTag_">goog.writeScriptTag_</a> <span class="args">( src )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">b