OracleJavaScript API Reference for Oracle ADF Faces

 

SUMMARY: FIELD | CONSTR | METHOD    DETAIL: FIELD | CONSTR | METHOD

org.ecmascript.object
Class Global

org.ecmascript.object.Object
   |
   +--org.ecmascript.object.Global

public abstract class Global
extends Object
The native browser JavaScript object that allows you to reference its fields and methods without a Global. prefix.
Note that this object is implemented and supported by the web browser and results of its use may vary.



Field Summary

public static Number
Infinity
A number representing positive infinity.
public static Number
NaN
An identifier for values that are not numbers.
public static Object
undefined
An identifier for variables that have been declared but not defined.


Fields inherited from org.ecmascript.object.Object

constructor, prototype


Method Summary

public static String
decodeURI(String encodedURI)
Decodes a URI that was encoded by encodeURI or other mechanism with the same result.
public static String
decodeURIComponent(String encodedURIComponent)
Decodes a URI component that was encoded by encodeURIComponent or other mechanism with the same result.
public static String
encodeURI(String nonEncodedURI)
Encodes a URI where each instance of certain characters is replaced by one, two, or three escape sequences that represent a UTF-8 encoding of the character.
public static String
encodeURIComponent(String nonEncodedURIComponent)
Encodes a URI component where each instance of certain characters is replaced by one, two, or three escape sequences that represent a UTF-8 encoding of the character.
public static String
escape(String nonEscapedValue)
Deprecated: Use encodeURIComponent(String) instead
public static Object
eval(Number codeToEvaluate)
Evaluates a string representation of JavaScript code.
public static Boolean
isFinite(Number number)
Determines whether the specified number is finite.
public static Boolean
isNaN(String value)
Determines whether the specified value can be parsed into a number.
public static Number
parseFloat(String value)
Parses the given value and returns a floating point number.
public static Number
parseInt(String value, Number radix)
Parses the given value and returns an integer number.
public static String
unescape(String escapedValue)
Deprecated: Use decodeURIComponent(String) instead


Field Detail


Infinity

public static Number Infinity

A number representing positive infinity.
See also:
Number.POSITIVE_INFINITY

NaN

public static Number NaN

An identifier for values that are not numbers. For example, NaN would result from someone trying to parse a String that cannot be converted into a Number.

Notice the subtlety with Number.NaN, NaN, and isNaN():
  • NaN == Number.NaN has a result of false.
  • NaN === Number.NaN has a result of false.
  • NaN == NaN has a result of false.
  • NaN === NaN has a result of false.
  • Number.NaN == Number.NaN has a result of false.
  • Number.NaN === Number.NaN has a result of false.
  • isNaN(NaN) has a result of true.
  • isNaN(Number.NaN) has a result of true.
See also:
isNaN(String)
Number.NaN

undefined

public static Object undefined

An identifier for variables that have been declared but not defined.

Notice the subtlety between undefined and null:
  • var test;
    var result = (test == undefined);

    result has a result of true.
  • var test = undefined;
    var result = (test == undefined);

    result has a result of true.
  • var test = null;
    var result = (test == undefined);

    result has a result of true.
  • var test;
    var result = (test === undefined);

    result has a result of true.
  • var test = undefined;
    var result = (test === undefined);

    result has a result of true.
  • var test = null;
    var result = (test === undefined);

    result has a result of false.

Method Detail


decodeURI

public static String decodeURI(String encodedURI)

Decodes a URI that was encoded by encodeURI or other mechanism with the same result. Each escape sequence and UTF-8 encoding is replaced with the character represented by it. If an escape sequence is encountered that would not have been escaped by encodeURI, that escape sequence will not be replaced.

Parameters:
encodedURI  -  the encoded URI to decode
Return:
String - the decoded URI
See also:
encodeURI(String)

decodeURIComponent

public static String decodeURIComponent(String encodedURIComponent)

Decodes a URI component that was encoded by encodeURIComponent or other mechanism with the same result. Each escape sequence and UTF-8 encoding is replaced with the character represented by it. If an escape sequence is encountered that would not have been escaped by encodeURI, that escape sequence will not be replaced.

Parameters:
encodedURIComponent  -  the encoded URI component to decode
Return:
String - the decoded URI component
See also:
encodeURIComponent(String)

encodeURI

public static String encodeURI(String nonEncodedURI)

Encodes a URI where each instance of certain characters is replaced by one, two, or three escape sequences that represent a UTF-8 encoding of the character.

Parameters:
nonEncodedURI  -  the non-encoded URI to encode
Return:
String - the encoded URI
See also:
decodeURI(String)

encodeURIComponent

public static String encodeURIComponent(String nonEncodedURIComponent)

Encodes a URI component where each instance of certain characters is replaced by one, two, or three escape sequences that represent a UTF-8 encoding of the character.

Parameters:
nonEncodedURIComponent  -  the non-encoded URI component to decode
Return:
String - the encoded URI component
See also:
decodeURIComponent(String)

escape

public static String escape(String nonEscapedValue)

Retrieves a URI-encoded version of a string.

Deprecated: Use encodeURIComponent(String) instead
Parameters:
nonEscapedValue  -  the string to URI-encode
Return:
String - the URI-encoded string
See also:
encodeURIComponent(String)

eval

public static Object eval(Number codeToEvaluate)

Evaluates a string representation of JavaScript code.

Parameters:
codeToEvaluate  -  the code to evaluate
Return:
Object - the resulting object of the evaluated code
Throws:
SyntaxError if parsing of the code fails
EvalError if the code cannot be evaluated or throws an exception

isFinite

public static Boolean isFinite(Number number)

Determines whether the specified number is finite.

Parameters:
number  -  the number to test
Return:
Boolean - true if the number is finite, false if the number is NaN, positive infinity, or negative infinity
See also:
NaN
Number.NaN
Number.NEGATIVE_INFINITY
Number.POSITIVE_INFINITY

isNaN

public static Boolean isNaN(String value)

Determines whether the specified value can be parsed into a number.

This is an important method because no matter what x is, true would never result from any of the following:
  • x == NaN
  • x === NaN

Parameters:
value  -  the string or number to test
Return:
Boolean - true if the value cannot be parsed into a number or represents NaN or Number.NaN, false if the value can be parsed into a number
See also:
NaN
Number.NaN

parseFloat

public static Number parseFloat(String value)

Parses the given value and returns a floating point number.

It is important to note that only a leading portion of the value may be considered; any characters that cannot be interpreted as part of the notation of a decimal literal are ignored and no indication is given that any such characters were ignored. For example, 3.14 would be returned from any of the following:
  • parseFloat("3.14")
  • parseFloat("314e-2")
  • parseFloat("0.0314E+2")
  • parseFloat("3.14hello world")
but parseFloat("foo1") would return NaN.

Parameters:
value  -  the value to parse into a floating point number
Return:
Number - the resulting floating point number or NaN if the value could not be parsed
See also:
NaN
isNaN(String)

parseInt

public static Number parseInt(String value,
                              Number radix)

Parses the given value and returns an integer number.

It is important to note that only a leading portion of the value may be considered; any characters that cannot be interpreted as part of the notation of an integer literal are ignored and no indication is given that any such characters were ignored. For example, 11 would be returned from any of the following:
  • parseInt("11")
  • parseInt("1011", 2)
  • parseInt("13", 8)
  • parseInt("013")
  • parseInt("11", 10)
  • parseInt("11.9999999", 10)
  • parseInt("B", 16)
  • parseInt("Bhello world123", 16)
but parseInt("foo1") and parseInt("321", 2) would return NaN.

Parameters:
value  -  the value to parse into a floating point number
radix  -  optional base radix of the given value, e.g. 2 for binary, 8 for octal, 10 for decimal, and 16 for hexadecimal; by default the radix is 16 if the specified value begins with "0x", 8 if the specified value begins with "0" (deprecated), or 10 otherwise
Return:
Number - the resulting integer number or NaN if the value could not be parsed as a number of the specified base radix
See also:
NaN
isNaN(String)

unescape

public static String unescape(String escapedValue)

Retrieves a URI-decoded version of a string.

Deprecated: Use decodeURIComponent(String) instead
Parameters:
escapedValue  -  the string to URI-decode
Return:
String - the URI-decoded string
See also:
decodeURIComponent(String)

SUMMARY: FIELD | CONSTR | METHOD    DETAIL: FIELD | CONSTR | METHOD

 

Generated on 2010.12.10 19:37 UTC
Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.