Namespace jQuery.sapModule: jquery.sap.global


Root Namespace for the jQuery plug-in provided by SAP SE.
Namespaces & Classes
historyEnables the back and forward buttons in browser to navigate back or forth through the browser history stack.
KeyCodesEnumeration of key codes.
logA Logging API for JavaScript.
measureNamespace for the jQuery performance measurement plug-in provided by SAP SE.
PseudoEventsEnumeration of all so called "pseudo events", a useful classification of standard browser events as implied by SAP product standards.
storageReturns a Storage object for a given HTML5 storage (type) and, as a convenience, provides static functions to access the default (session) storage.
VersionRepresents a version consisting of major, minor, patch version and suffix, e.g.
Field Summary
jQuery.sap.ControlEventsList of DOM events that a UIArea automatically takes care of.
jQuery.sap.nowReturns a high resolution timestamp for measurements.
Method Summary
jQuery.sap.addUrlWhitelist(protocol, host, port, path)Adds a whitelist entry for URL validation.
jQuery.sap.arraySymbolDiff(aOld, aNew, fnSymbol?)Calculate delta of old list and new list.
jQuery.sap.assert(bResult, vMessage)A simple assertion mechanism that logs a message when a given condition is not met.
jQuery.sap.bindAnyEvent(fnCallback)Binds all events for listening with the given callback function.
jQuery.sap.byId(sId, oContext)Shortcut for jQuery("#" + id) with additionally the id being escaped properly.
jQuery.sap.camelCase(sString)Transforms a hyphen separated string to a camel case string.
jQuery.sap.charToUpperCase(sString, iPos)Converts one character of the string to upper case, at a given position.
jQuery.sap.checkMouseEnterOrLeave(oEvent, oDomRef)Checks a given mouseover or mouseout event whether it is equivalent to a mouseenter or mousleave event regarding the given DOM reference.
jQuery.sap.clearDelayedCall(sDelayedCallId)Stops the delayed call.
jQuery.sap.clearIntervalCall(sIntervalCallId)Stops the interval call.
jQuery.sap.clearUrlWhitelist()Clears the whitelist for URL validation
jQuery.sap.containsOrEquals(oDomRefContainer, oDomRefChild)Returns whether oDomRefChild is contained in or equal to oDomRefContainer.
jQuery.sap.declare(sModuleName, bCreateNamespace?)Declares a module as existing.
jQuery.sap.delayedCall(iDelay, oObject, method, aParameters?)Calls a method after a given delay and returns an id for this timer
jQuery.sap.denormalizeScrollBeginRTL(iNormalizedScrollBegin, oDomRef)For the given scroll position measured from the "beginning" of a container (the right edge in RTL mode) this method returns the scrollLeft value as understood by the current browser in RTL mode.
jQuery.sap.denormalizeScrollLeftRTL(iNormalizedScrollLeft, oDomRef)For the given scrollLeft value this method returns the scrollLeft value as understood by the current browser in RTL mode.
jQuery.sap.disableTouchToMouseHandling()Disable touch to mouse handling
jQuery.sap.domById(sId, oWindow?)Shortcut for document.getElementById(), including a bug fix for older IE versions.
jQuery.sap.encodeCSS(sString)Encode the string for inclusion into CSS string literals or identifiers
jQuery.sap.encodeHTML(sString)Encode the string for inclusion into HTML content/attribute
jQuery.sap.encodeJS(sString)Encode the string for inclusion into a JS string literal
jQuery.sap.encodeURL(sString)Encode the string for inclusion into an URL parameter
jQuery.sap.encodeURLParameters(mParams)Encode a map of parameters into a combined URL parameter string
jQuery.sap.encodeXML(sString)Encode the string for inclusion into XML content/attribute
jQuery.sap.endsWith(sString, sEndString)Checks whether a given sString ends with sEndString respecting the case of the strings.
jQuery.sap.endsWithIgnoreCase(sString, sEndString)Checks whether a given sString ends with sEndString ignoring the case of the strings.
jQuery.sap.equal(a, b, maxDepth?, contains?)Compares the two given values for equality, especially takes care not to compare arrays and objects by reference, but compares their content.
jQuery.sap.escapeRegExp(sString)Escapes all characters that would have a special meaning in a regular expression.
jQuery.sap.focus(oDomRef)Calls focus() on the given DOM element, but catches and ignores any errors that occur when doing so.
jQuery.sap.formatMessage(sPattern, aValues?)Creates a string from a pattern by replacing placeholders with concrete values.
jQuery.sap.getAllDeclaredModules()Returns the names of all declared modules.
jQuery.sap.getModulePath(sModuleName, sSuffix)Constructs an URL to load the module with the given name and file type (suffix).
jQuery.sap.getObject(sName, iNoCreates?, oContext?)Returns a JavaScript object which is identified by a sequence of names.
jQuery.sap.getResourcePath(sResourceName)Determines the URL for a resource given its unified resource name.
jQuery.sap.getter(oValue)Returns a new function that returns the given oValue (using its closure).
jQuery.sap.getUriParameters(sUri)Creates and returns a new instance of jQuery.sap.util.UriParameters.
jQuery.sap.getUrlWhitelist()Gets the whitelist for URL validation.
jQuery.sap.globalEval()Executes an 'eval' for its arguments in the global context (without closure variables).
jQuery.sap.hyphen(sString)Transforms a camel case string into a hyphen separated string.
jQuery.sap.includeScript(vUrl, vId?, fnLoadCallback?, fnErrorCallback?)Includes the script (via <script>-tag) into the head for the specified sUrl and optional sId.
jQuery.sap.includeStyleSheet(vUrl, vId?, fnLoadCallback?, fnErrorCallback?)Includes the specified stylesheet via a <link>-tag in the head of the current document.
jQuery.sap.initMobile(options?)Does some basic modifications to the HTML page that make it more suitable for mobile apps.
jQuery.sap.intervalCall(iInterval, oObject, method, aParameters?)Calls a method after a given interval and returns an id for this interval.
jQuery.sap.isDeclared(sModuleName, bIncludePreloaded?)Check whether a given module has been loaded / declared already.
jQuery.sap.ownerWindow(oDomRef)Returns the window reference for a DomRef
jQuery.sap.padLeft(sString, sPadChar, iLength)Pads a string on the left side until is has at least the given length.
jQuery.sap.padRight(sString, sPadChar, iLength)Pads a string on the right side until is has at least the given length.
jQuery.sap.parseXML(sXMLText)Parses the specified XML formatted string text using native parsing function of the browser and returns a valid XML document.
jQuery.sap.properties(mParams?)Creates and returns a new instance of jQuery.sap.util.Properties.
jQuery.sap.registerModulePath(sModuleName, vUrlPrefix)Registers an URL prefix for a module name prefix.
jQuery.sap.registerResourcePath(sResourceNamePrefix, vUrlPrefix)Registers an URL prefix for a resource name prefix.
jQuery.sap.removeUrlWhitelist(iIndex)Removes a whitelist entry for URL validation.
jQuery.sap.require(vModuleName)Ensures that the given module is loaded and executed before execution of the current script continues.
jQuery.sap.resources(mParams?)Creates and returns a new instance of jQuery.sap.util.ResourceBundle using the given URL and locale to determine what to load.
jQuery.sap.scrollbarSize(sClasses?, bForce?)Returns the size (width of the vertical / height of the horizontal) native browser scrollbars.
jQuery.sap.serializeXML(oXMLDocument)Serializes the specified XML document into a string representation.
jQuery.sap.setIcons(oIcons)Sets the bookmark icon for desktop browsers and the icon to be displayed on the home screen of iOS devices after the user does "add to home screen".
jQuery.sap.setMobileWebAppCapable(bValue)Sets the "apple-mobile-web-app-capable" and "mobile-web-app-capable" meta information which defines whether the application is loaded in full screen mode (browser address bar and toolbar are hidden) after the user does "add to home screen" on mobile devices.
jQuery.sap.setObject(sName, vValue, oContext?)Sets an object property to a given value, where the property is identified by a sequence of names (path).
jQuery.sap.sjax(oOrigSettings)Convenience wrapper around jQuery.ajax() that avoids the need for callback functions when synchronous calls are made.
jQuery.sap.startsWith(sString, sStartString)Checks whether a given sString starts with sStartString respecting the case of the strings.
jQuery.sap.startsWithIgnoreCase(sString, sStartString)Checks whether a given sString starts with sStartString ignoring the case of both strings.
jQuery.sap.syncGet(sUrl, data, sDataType?)Convenience wrapper for jQuery.sap.sjax that enforeces the Http method GET and defaults the data type of the result to 'text'.
jQuery.sap.syncGetJSON(sUrl, data, fallback?)Convenience wrapper for jQuery.sap.sjax that enforces the Http method GET and the data type 'json'.
jQuery.sap.syncGetText(sUrl, data, fallback?)Convenience wrapper for jQuery.sap.sjax that enforces the Http method GET and the data type 'text'.
jQuery.sap.syncPost(sUrl, data, sDataType?)Convenience wrapper for jQuery.sap.sjax that enforces the Http method POST and defaults the data type of the result to 'text'.
jQuery.sap.syncStyleClass(sStyleClass, vSource, vDestination)Search ancestors of the given source DOM element for the specified CSS class name.
jQuery.sap.uid()Creates and returns a pseudo-unique id.
jQuery.sap.unbindAnyEvent(fnCallback)Unbinds all events for listening with the given callback function.
jQuery.sap.unique(a)Sorts the given array in-place and removes any duplicates (identified by "===").
jQuery.sap.validateUrl(sUrl)Validates an URL.
jQuery.sap.arrayDiff(aOld, aNew, fnCompare?, bUniqueEntries?)Calculate delta of old list and new list.
jQuery.sap.escapeHTML(sString)Encode the string for inclusion into HTML content/attribute.
jQuery.sap.escapeJS(sString)Encode the string for inclusion into a JS string literal.
jQuery.sap.factory(oPrototype)Returns a new constructor function that creates objects with the given prototype.
jQuery.sap.newObject(oPrototype)Returns a new object which has the given oPrototype as its prototype.
Field Detail
jQuery.sap.ControlEvents Module: jquery.sap.events

List of DOM events that a UIArea automatically takes care of.

A control/element doesn't have to bind listeners for these events. It instead can implement an onevent(oEvent) method for any of the following events that it wants to be notified about:

click, dblclick, contextmenu, focusin, focusout, keydown, keypress, keyup, mousedown, mouseout, mouseover, mouseup, select, selectstart, dragstart, dragenter, dragover, dragleave, dragend, drop, paste, cut, input, touchstart, touchend, touchmove, touchcancel, tap, swipe, swipeleft, swiperight, scrollstart, scrollstop

The mouse events and touch events are supported simultaneously on both desktop and mobile browsers. Do NOT create both onmouse* and ontouch* functions to avoid one event being handled twice on the same control.

jQuery.sap.now
Returns a high resolution timestamp for measurements. The timestamp is based on 01/01/1970 00:00:00 as float with microsecond precision or with millisecond precision, if high resolution timestamps are not available. The fractional part of the timestamp represents fractions of a millisecond. Converting to a Date is possible using new Date(jQuery.sap.now())
Method Detail
jQuery.sap.addUrlWhitelist(protocol, host, port, path)Module: jquery.sap.encoder
Adds a whitelist entry for URL validation.
Parameters:
stringprotocolThe protocol of the URL
stringhostThe host of the URL
stringportThe port of the URL
stringpaththe path of the URL
jQuery.sap.arraySymbolDiff(aOld, aNew, fnSymbol?): {type:string,index:int}[]Module: jquery.sap.script

Calculate delta of old list and new list.

This function implements the algorithm described in "A Technique for Isolating Differences Between Files" (Commun. ACM, April 1978, Volume 21, Number 4, Pages 264-268).

Items in the arrays are not compared directly. Instead, a substitute symbol is determined for each item by applying the provided function fnSymbol to it. Items with strictly equal symbols are assumed to represent the same logical item:

  fnSymbol(a) === fnSymbol(b)   <=>   a 'is logically the same as' b
As an additional constraint, casting the symbols to string should not modify the comparison result. If this second constraint is not met, this method might report more diffs than necessary.

If no symbol function is provided, a default implementation is used which applies JSON.stringify to non-string items and reduces the strings to a hash code. It is not guaranteed that this default implementation fulfills the above constraint in all cases, but it is a compromise between implementation effort, generality and performance. If items are known to be non-stringifiable (e.g. because they may contain cyclic references) or when hash collisions are likely, an own fnSymbol function must be provided.

The result of the diff is a sequence of update operations, each consisting of a type (either "insert" or "delete") and an index. By applying the operations one after the other to the old array, it can be transformed to an array whose items are equal to the new array.

Sample implementation of the update


 function update(aOldArray, aNewArray) {

   // calculate the diff
   var aDiff = jQuery.sap.arraySymbolDiff(aOldArray, aNewArray, __provide_your_symbol_function_here__);

   // apply update operations
   aDiff.forEach( function(op) {

     // invariant: aOldArray and aNewArray now are equal up to (excluding) op.index

     switch ( op.type ) {
     case 'insert':
       // new array contains a new (or otherwise unmapped) item, add it here
       aOldArray.splice(op.index, 0, aNewArray[op.index]);
       break;
     case 'delete':
       // an item is no longer part of the array (or has been moved to another position), remove it
       aOldArray.splice(op.index, 1);
       break;
     default:
       throw new Error('unexpected diff operation type');
     }

   });
 }

Parameters:
ArrayaOldOld Array
ArrayaNewNew Array
functionfnSymbol?Function to calculate substitute symbols for array items
Returns:
{type:string,index:int}[]List of update operations
jQuery.sap.assert(bResult, vMessage)

A simple assertion mechanism that logs a message when a given condition is not met.

Note: Calls to this method might be removed when the JavaScript code is optimized during build. Therefore, callers should not rely on any side effects of this method.

Parameters:
booleanbResultResult of the checked assertion
string|functionvMessageMessage that will be logged when the result is false. In case this is a function, the return value of the function will be displayed. This can be used to execute complex code only if the assertion fails.
jQuery.sap.bindAnyEvent(fnCallback)Module: jquery.sap.events
Binds all events for listening with the given callback function.
Parameters:
functionfnCallbackCallback function
jQuery.sap.byId(sId, oContext): ObjectModule: jquery.sap.dom

Shortcut for jQuery("#" + id) with additionally the id being escaped properly. I.e.: returns the jQuery object for the DOM element with the given id

Use this method instead of jQuery(...) if you know the argument is exactly one id and the id is not known in advance because it is in a variable (as opposed to a string constant with known content).

Parameters:
stringsIdThe id to search for and construct the jQuery object
ElementoContextthe context DOM Element
Returns:
ObjectThe jQuery object for the DOM element identified by the given sId
Since:
0.9.1
jQuery.sap.camelCase(sString): stringModule: jquery.sap.strings
Transforms a hyphen separated string to a camel case string.
Parameters:
stringsStringHyphen separated string
Returns:
stringThe transformed string
Since:
1.7.0
jQuery.sap.charToUpperCase(sString, iPos): stringModule: jquery.sap.strings

Converts one character of the string to upper case, at a given position.

If no position is given or when it is negative or beyond the last character of sString, then the first character will be converted to upper case. The first character position is 0.

Parameters:
stringsStringString for which one character should be converted
intiPosPosition of the character that should be converted
Returns:
stringString with the converted character
jQuery.sap.checkMouseEnterOrLeave(oEvent, oDomRef)Module: jquery.sap.events
Checks a given mouseover or mouseout event whether it is equivalent to a mouseenter or mousleave event regarding the given DOM reference.
Parameters:
jQuery.EventoEvent
ElementoDomRef
jQuery.sap.clearDelayedCall(sDelayedCallId)Module: jquery.sap.script

Stops the delayed call.

The function given when calling delayedCall is not called anymore.

Parameters:
stringsDelayedCallIdThe id returned, when calling delayedCall
jQuery.sap.clearIntervalCall(sIntervalCallId)Module: jquery.sap.script

Stops the interval call.

The function given when calling intervalCall is not called anymore.

Parameters:
stringsIntervalCallIdThe id returned, when calling intervalCall
jQuery.sap.clearUrlWhitelist()Module: jquery.sap.encoder
Clears the whitelist for URL validation
jQuery.sap.containsOrEquals(oDomRefContainer, oDomRefChild): booleanModule: jquery.sap.dom

Returns whether oDomRefChild is contained in or equal to oDomRefContainer.

This is a browser-independent version of the .contains method of Internet Explorer. For compatibility reasons it returns true if oDomRefContainer and oDomRefChild are equal.

This method intentionally does not operate on the jQuery object, as the original jQuery.contains() method also does not do so.

Parameters:
ElementoDomRefContainerThe container element
ElementoDomRefChildThe child element (must not be a text node, must be an element)
Returns:
booleanWhether oDomRefChild is contained in or equal to oDomRefContainer
Since:
0.9.0
jQuery.sap.declare(sModuleName, bCreateNamespace?)

Declares a module as existing.

By default, this function assumes that the module will create a JavaScript object with the same name as the module. As a convenience it ensures that the parent namespace for that object exists (by calling jQuery.sap.getObject). If such an object creation is not desired, bCreateNamespace must be set to false.

Parameters:
string|objectsModuleNamename of the module to be declared or in case of an object {modName: "...", type: "..."} where modName is the name of the module and the type could be a specific dot separated extension e.g. {modName: "sap.ui.core.Dev", type: "view"} loads sap/ui/core/Dev.view.js and registers as sap.ui.core.Dev.view
booleanbCreateNamespace?, Default: truewhether to create the parent namespace
jQuery.sap.delayedCall(iDelay, oObject, method, aParameters?): stringModule: jquery.sap.script
Calls a method after a given delay and returns an id for this timer
Parameters:
intiDelayDelay time in milliseconds
objectoObjectObject from which the method should be called
string|objectmethodfunction pointer or name of the method
arrayaParameters?Method parameters
Returns:
stringId which can be used to cancel the timer with clearDelayedCall
jQuery.sap.denormalizeScrollBeginRTL(iNormalizedScrollBegin, oDomRef): intModule: jquery.sap.dom

For the given scroll position measured from the "beginning" of a container (the right edge in RTL mode) this method returns the scrollLeft value as understood by the current browser in RTL mode. This value is specific to the given DOM element, as the computation may involve its dimensions.

So when oDomRef should be scrolled 2px from the beginning, the number "2" must be given as iNormalizedScrollBegin and the result of this method (which may be a large or even negative number, depending on the browser) can then be set as oDomRef.scrollLeft to achieve the desired (cross-browser-consistent) scrolling position. Low values make the right part of the content visible, high values the left part.

This method does no scrolling on its own, it only calculates the value to set (so it can also be used for animations).

Only use this method in RTL mode, as the behavior in LTR mode is undefined and may change!

Parameters:
intiNormalizedScrollBeginThe distance from the rightmost position to which the element should be scrolled
ElementoDomRefThe DOM Element to which scrollLeft will be applied
Returns:
intThe scroll position that must be set for the DOM element
Since:
1.26.1
jQuery.sap.denormalizeScrollLeftRTL(iNormalizedScrollLeft, oDomRef): intModule: jquery.sap.dom

For the given scrollLeft value this method returns the scrollLeft value as understood by the current browser in RTL mode. This value is specific to the given DOM element, as the computation may involve its dimensions.

So when oDomRef should be scrolled 2px from the leftmost position, the number "2" must be given as iNormalizedScrollLeft and the result of this method (which may be a large or even negative number, depending on the browser) can then be set as oDomRef.scrollLeft to achieve the desired (cross-browser-consistent) scrolling position.

This method does no scrolling on its own, it only calculates the value to set (so it can also be used for animations).

Parameters:
intiNormalizedScrollLeftThe distance from the leftmost position to which the element should be scrolled
ElementoDomRefThe DOM Element to which scrollLeft will be applied
Returns:
intThe scroll position that must be set for the DOM element
Since:
0.20.0
jQuery.sap.disableTouchToMouseHandling()Module: jquery.sap.events
Disable touch to mouse handling
jQuery.sap.domById(sId, oWindow?): ElementModule: jquery.sap.dom
Shortcut for document.getElementById(), including a bug fix for older IE versions.
Parameters:
stringsIdThe id of the DOM element to return
WindowoWindow?, Default: windowThe window (optional)
Returns:
ElementThe DOMNode identified by the given sId
Since:
0.9.0
jQuery.sap.encodeCSS(sString)Module: jquery.sap.encoder
Encode the string for inclusion into CSS string literals or identifiers
Parameters:
stringsStringThe string to be escaped
jQuery.sap.encodeHTML(sString)Module: jquery.sap.encoder
Encode the string for inclusion into HTML content/attribute
Parameters:
stringsStringThe string to be escaped
jQuery.sap.encodeJS(sString)Module: jquery.sap.encoder
Encode the string for inclusion into a JS string literal
Parameters:
stringsStringThe string to be escaped
jQuery.sap.encodeURL(sString)Module: jquery.sap.encoder
Encode the string for inclusion into an URL parameter
Parameters:
stringsStringThe string to be escaped
jQuery.sap.encodeURLParameters(mParams)Module: jquery.sap.encoder
Encode a map of parameters into a combined URL parameter string
Parameters:
objectmParamsThe map of parameters to encode
jQuery.sap.encodeXML(sString)Module: jquery.sap.encoder
Encode the string for inclusion into XML content/attribute
Parameters:
stringsStringThe string to be escaped
jQuery.sap.endsWith(sString, sEndString): booleanModule: jquery.sap.strings
Checks whether a given sString ends with sEndString respecting the case of the strings.
Parameters:
stringsStringString to be checked
stringsEndStringThe end string to be searched
Returns:
booleanWhether sString ends with sEndString
See:
jQuery.sap.endsWithIgnoreCase
jQuery.sap.endsWithIgnoreCase(sString, sEndString): booleanModule: jquery.sap.strings
Checks whether a given sString ends with sEndString ignoring the case of the strings.
Parameters:
stringsStringString to be checked
stringsEndStringThe end string to be searched
Returns:
booleanWhether sString ends with sEndString
See:
jQuery.sap.endsWith
jQuery.sap.equal(a, b, maxDepth?, contains?): booleanModule: jquery.sap.script
Compares the two given values for equality, especially takes care not to compare arrays and objects by reference, but compares their content. Note: function does not work with comparing XML objects
Parameters:
anyaA value of any type
anybA value of any type
intmaxDepth?, Default: 10Maximum recursion depth
booleancontains?Whether all existing properties in a are equal as in b
Returns:
booleanWhether a and b are equal
jQuery.sap.escapeRegExp(sString): stringModule: jquery.sap.strings

Escapes all characters that would have a special meaning in a regular expression.

This method can be used when a string with arbitrary content has to be integrated into a regular expression and when the whole string should match literally.

Example:

  var text = "E=m*c^2"; // text to search
  var search = "m*c";   // text to search for

  text.match( new RegExp(                         search  ) ); // [ "c" ]
  text.match( new RegExp( jQuery.sap.escapeRegExp(search) ) ); // [ "m*c" ]

Parameters:
stringsStringString to escape
Returns:
stringThe escaped string
Since:
1.9.3
jQuery.sap.focus(oDomRef): booleanModule: jquery.sap.dom
Calls focus() on the given DOM element, but catches and ignores any errors that occur when doing so. (i.e. IE8 throws an error when the DOM element is invisible or disabled)
Parameters:
ElementoDomRefThe DOM element to focus (or null - in this case the method does nothing)
Returns:
booleanWhether the focus() command was executed without an error
Since:
1.1.2
jQuery.sap.formatMessage(sPattern, aValues?): stringModule: jquery.sap.strings

Creates a string from a pattern by replacing placeholders with concrete values.

The syntax of the pattern is inspired by (but not fully equivalent to) the java.util.MessageFormat.

Placeholders have the form { integer }, where any occurrence of {0} is replaced by the value with index 0 in aValues, {1} by the value with index 1 in aValues etc.

To avoid interpretation of curly braces as placeholders, any non-placeholder fragment of the pattern can be enclosed in single quotes. The surrounding single quotes will be omitted from the result. Single quotes that are not meant to escape a fragment and that should appear in the result, need to be doubled. In the result, only a single single quote will occur.

Example Pattern Strings:

  jQuery.sap.formatMessage("Say {0}",     ["Hello"]) -> "Say Hello"    // normal use case
  jQuery.sap.formatMessage("Say '{0}'",   ["Hello"]) -> "Say {0}"      // escaped placeholder
  jQuery.sap.formatMessage("Say ''{0}''", ["Hello"]) -> "Say 'Hello'"  // doubled single quote
  jQuery.sap.formatMessage("Say '{0}'''", ["Hello"]) -> "Say {0}'"     // doubled single quote in quoted fragment

In contrast to java.util.MessageFormat, format types or format styles are not supported. Everything after the argument index and up to the first closing curly brace is ignored. Nested placeholders (as supported by java.lang.MessageFormat for the format type choice) are not ignored but reported as a parse error.

This method throws an Error when the pattern syntax is not fulfilled (e.g. unbalanced curly braces, nested placeholders or a non-numerical argument index).

This method can also be used as a formatter within a binding. The first part of a composite binding will be used as pattern, the following parts as aValues. If there is only one value and this value is an array it will be handled like the default described above.

Parameters:
stringsPatternA pattern string in the described syntax
any[]aValues?, Default: []The values to be used instead of the placeholders.
Returns:
stringThe formatted result string
Since:
1.12.5
jQuery.sap.getAllDeclaredModules(): string[]
Returns the names of all declared modules.
Returns:
string[]the names of all declared modules
See:
jQuery.sap.isDeclared
jQuery.sap.getModulePath(sModuleName, sSuffix): string

Constructs an URL to load the module with the given name and file type (suffix).

Searches the longest prefix of the given module name for which a registration exists (see jQuery.sap.registerModulePath) and replaces that prefix by the registered URL prefix.

The remainder of the module name is appended to the URL, replacing any dot with a slash.

Finally, the given suffix (typically a file name extension) is added (unconverted).

The returned name (without the suffix) doesn't end with a slash.

Parameters:
stringsModuleNamemodule name to detemrine the path for
stringsSuffixsuffix to be added to the resulting path
Returns:
stringcalculated path (URL) to the given module
jQuery.sap.getObject(sName, iNoCreates?, oContext?): function

Returns a JavaScript object which is identified by a sequence of names.

A call to getObject("a.b.C") has essentially the same effect as accessing window.a.b.C but with the difference that missing intermediate objects (a or b in the example above) don't lead to an exception.

When the addressed object exists, it is simply returned. If it doesn't exists, the behavior depends on the value of the second, optional parameter iNoCreates (assuming 'n' to be the number of names in the name sequence):

  • NaN: if iNoCreates is not a number and the addressed object doesn't exist, then getObject() returns undefined.
  • 0 < iNoCreates < n: any non-existing intermediate object is created, except the lastiNoCreates ones.

Example:

  getObject()            -- returns the context object (either param or window)
  getObject("a.b.C")     -- will only try to get a.b.C and return undefined if not found.
  getObject("a.b.C", 0)  -- will create a, b, and C in that order if they don't exists
  getObject("a.b.c", 1)  -- will create a and b, but not C.

When a oContext is given, the search starts in that object. Otherwise it starts in the window object that this plugin has been created in.

Note: Although this method internally uses object["key"] to address object properties, it does not support all possible characters in a name. Especially the dot ('.') is not supported in the individual name segments, as it is always interpreted as a name separator.

Parameters:
stringsNamea dot separated sequence of names that identify the required object
intiNoCreates?, Default: NaNnumber of objects (from the right) that should not be created
objectoContext?, Default: windowthe context to execute the search in
Returns:
functionThe value of the named object
jQuery.sap.getResourcePath(sResourceName): string

Determines the URL for a resource given its unified resource name.

Searches the longest prefix of the given resource name for which a registration exists (see jQuery.sap.registerResourcePath) and replaces that prefix by the registered URL prefix.

The remainder of the resource name is appended to the URL.

Unified Resource Names
Several UI5 APIs use Unified Resource Names (URNs) as naming scheme for resources that they deal with (e.h. Javascript, CSS, JSON, XML, ...). URNs are similar to the path component of an URL:

  • they consist of a non-empty sequence of name segments
  • segments are separated by a forward slash '/'
  • name segments consist of URL path segment characters only. It is recommended to use only ASCII letters (upper or lower case), digits and the special characters '$', '_', '-', '.')
  • the empty name segment is not supported
  • names consisting of dots only, are reserved and must not be used for resources
  • names are case sensitive although the underlying server might be case-insensitive
  • the behavior with regard to URL encoded characters is not specified, %ddd notation should be avoided
  • the meaning of a leading slash is undefined, but might be defined in future. It therefore should be avoided

UI5 APIs that only deal with Javascript resources, use a slight variation of this scheme, where the extension '.js' is always omitted (see sap.ui.define, sap.ui.require).

Relationship to old Module Name Syntax

Older UI5 APIs that deal with resources (like jQuery.sap.registerModulePath, jQuery.sap.require and jQuery.sap.declare) used a dot-separated naming scheme (called 'module names') which was motivated by object names in the global namespace in Javascript.

The new URN scheme better matches the names of the corresponding resources (files) as stored in a server and the dot ('.') is no longer a forbidden character in a resource name. This finally allows to handle resources with different types (extensions) with the same API, not only JS files.

Last but not least does the URN scheme better match the naming conventions used by AMD loaders (like requireJS).

Parameters:
stringsResourceNameunified resource name of the resource
Returns:
stringURL to load the resource from
Experimental API:
Since 1.27.0
jQuery.sap.getter(oValue): function

Returns a new function that returns the given oValue (using its closure).

Avoids the need for a dedicated member for the value.

As closures don't come for free, this function should only be used when polluting the enclosing object is an absolute "must-not" (as it is the case in public base classes).

Parameters:
objectoValueThe value that the getter should return
Returns:
functionThe new getter function
jQuery.sap.getUriParameters(sUri): jQuery.sap.util.UriParametersModule: jquery.sap.script

Creates and returns a new instance of jQuery.sap.util.UriParameters.

Example for reading a single URI parameter (or the value of the first occurrence of the URI parameter):

	var sValue = jQuery.sap.getUriParameters().get("myUriParam");

Example for reading the values of the first of the URI parameter (with multiple occurrences):

	var aValues = jQuery.sap.getUriParameters().get("myUriParam", true);
	for(i in aValues){
	var sValue = aValues[i];
	}

Parameters:
stringsUriUri to determine the parameters for
Returns:
jQuery.sap.util.UriParametersA new URI parameters instance
jQuery.sap.getUrlWhitelist(): object[]Module: jquery.sap.encoder
Gets the whitelist for URL validation.
Returns:
object[]A copy of the whitelist
jQuery.sap.globalEval(): void

Executes an 'eval' for its arguments in the global context (without closure variables).

This is a synchronous replacement for jQuery.globalEval which in some browsers (e.g. FireFox) behaves asynchronously.

jQuery.sap.hyphen(sString): stringModule: jquery.sap.strings
Transforms a camel case string into a hyphen separated string.
Parameters:
stringsStringcamel case string
Returns:
stringThe transformed string
Since:
1.15.0
jQuery.sap.includeScript(vUrl, vId?, fnLoadCallback?, fnErrorCallback?): void|Promise
Includes the script (via <script>-tag) into the head for the specified sUrl and optional sId.
Parameters:
string|objectvUrlthe URL of the script to load or a configuration object
stringvUrl.urlthe URL of the script to load
stringvUrl.id?id that should be used for the script tag
objectvUrl.attributes?map of attributes that should be used for the script tag
string|objectvId?id that should be used for the script tag or map of attributes
functionfnLoadCallback?callback function to get notified once the script has been loaded
functionfnErrorCallback?callback function to get notified once the script loading failed
Returns:
void|PromiseWhen using the configuration object a Promise will be returned. The documentation for the fnLoadCallback applies to the resolve handler of the Promise and the one for the fnErrorCallback applies to the reject handler of the Promise.
jQuery.sap.includeStyleSheet(vUrl, vId?, fnLoadCallback?, fnErrorCallback?): void|Promise
Includes the specified stylesheet via a <link>-tag in the head of the current document. If there is call to includeStylesheet providing the sId of an already included stylesheet, the existing element will be replaced.
Parameters:
string|objectvUrlthe URL of the stylesheet to load or a configuration object
stringvUrl.urlthe URL of the stylesheet to load
stringvUrl.id?id that should be used for the link tag
objectvUrl.attributes?map of attributes that should be used for the script tag
string|objectvId?id that should be used for the link tag or map of attributes
functionfnLoadCallback?callback function to get notified once the stylesheet has been loaded
functionfnErrorCallback?callback function to get notified once the stylesheet loading failed. In case of usage in IE the error callback will also be executed if an empty stylesheet is loaded. This is the only option how to determine in IE if the load was successful or not since the native onerror callback for link elements doesn't work in IE. The IE always calls the onload callback of the link element. Another issue of the IE9 is that in case of loading too many stylesheets the eventing is not working and therefore the error or load callback will not be triggered anymore.
Returns:
void|PromiseWhen using the configuration object a Promise will be returned. The documentation for the fnLoadCallback applies to the resolve handler of the Promise and the one for the fnErrorCallback applies to the reject handler of the Promise.
jQuery.sap.initMobile(options?)Module: jquery.sap.mobile

Does some basic modifications to the HTML page that make it more suitable for mobile apps. Only the first call to this method is executed, subsequent calls are ignored. Note that this method is also called by the constructor of toplevel controls like sap.m.App, sap.m.SplitApp and sap.m.Shell. Exception: if no homeIcon was set, subsequent calls have the chance to set it.

The "options" parameter configures what exactly should be done.

It can have the following properties:

  • viewport: whether to set the viewport in a way that disables zooming (default: true)
  • statusBar: the iOS status bar color, "default", "black" or "black-translucent" (default: "default")
  • hideBrowser: whether the browser UI should be hidden as far as possible to make the app feel more native (default: true)
  • preventScroll: whether native scrolling should be disabled in order to prevent the "rubber-band" effect where the whole window is moved (default: true)
  • preventPhoneNumberDetection: whether Safari Mobile should be prevented from transforming any numbers that look like phone numbers into clickable links; this should be left as "true", otherwise it might break controls because Safari actually changes the DOM. This only affects all page content which is created after initMobile is called.
  • rootId: the ID of the root element that should be made fullscreen; only used when hideBrowser is set (default: the document.body)
  • useFullScreenHeight: a boolean that defines whether the height of the html root element should be set to 100%, which is required for other elements to cover the full height (default: true)
  • homeIcon: deprecated since 1.12, use jQuery.sap.setIcons instead.
Parameters:
objectoptions?configures what exactly should be done
booleanoptions.viewport?, Default: truewhether to set the viewport in a way that disables zooming
stringoptions.statusBar?, Default: 'default'the iOS status bar color, "default", "black" or "black-translucent"
booleanoptions.hideBrowser?, Default: truewhether the browser UI should be hidden as far as possible to make the app feel more native
booleanoptions.preventScroll?, Default: truewhether native scrolling should be disabled in order to prevent the "rubber-band" effect where the whole window is moved
booleanoptions.preventPhoneNumberDetection?, Default: truewhether Safari mobile should be prevented from transforming any numbers that look like phone numbers into clickable links
stringoptions.rootId?the ID of the root element that should be made fullscreen; only used when hideBrowser is set. If not set, the body is used
booleanoptions.useFullScreenHeight?, Default: truewhether the height of the html root element should be set to 100%, which is required for other elements to cover the full height
stringoptions.homeIcon?deprecated since 1.12, use jQuery.sap.setIcons instead.
booleanoptions.homeIconPrecomposed?, Default: falsedeprecated since 1.12, use jQuery.sap.setIcons instead.
booleanoptions.mobileWebAppCapable?, Default: truewhether the Application will be loaded in full screen mode after added to home screen on mobile devices. The default value for this property only enables the full screen mode when runs on iOS device.
jQuery.sap.intervalCall(iInterval, oObject, method, aParameters?): stringModule: jquery.sap.script
Calls a method after a given interval and returns an id for this interval.
Parameters:
intiIntervalInterval time in milliseconds
objectoObjectObject from which the method should be called
string|objectmethodfunction pointer or name of the method
arrayaParameters?Method parameters
Returns:
stringId which can be used to cancel the interval with clearIntervalCall
jQuery.sap.isDeclared(sModuleName, bIncludePreloaded?): boolean

Check whether a given module has been loaded / declared already.

Returns true as soon as a module has been required the first time, even when loading/executing it has not finished yet. So the main assertion of a return value of true is that the necessary actions have been taken to make the module available in the near future. It does not mean, that the content of the module is already available!

This fuzzy behavior is necessary to avoid multiple requests for the same module. As a consequence of the assertion above, a preloaded module does not count as declared. For preloaded modules, an explicit call to jQuery.sap.require is necessary to make them available.

If a caller wants to know whether a module needs to be loaded from the server, it can set bIncludePreloaded to true. Then, preloaded modules will be reported as 'declared' as well by this method.

Parameters:
stringsModuleNamename of the module to be checked
booleanbIncludePreloaded?, Default: falsewhether preloaded modules should be reported as declared.
Returns:
booleanwhether the module has been declared already
jQuery.sap.ownerWindow(oDomRef): WindowModule: jquery.sap.dom
Returns the window reference for a DomRef
Parameters:
ElementoDomRefThe DOM reference
Returns:
WindowWindow reference
Since:
0.9.0
jQuery.sap.padLeft(sString, sPadChar, iLength): stringModule: jquery.sap.strings

Pads a string on the left side until is has at least the given length.

The method always adds full copies of sPadChar to the given string. When sPadChar has a length > 1, the length of the returned string actually might be greater than iLength.

Parameters:
stringsStringString to be padded
stringsPadCharChar to use for the padding
intiLengthTarget length of the string
Returns:
stringThe padded string
jQuery.sap.padRight(sString, sPadChar, iLength): stringModule: jquery.sap.strings

Pads a string on the right side until is has at least the given length.

The method always adds full copies of sPadChar to the given string. When sPadChar has a length > 1, the length of the returned string actually might be greater than iLength.

Parameters:
stringsStringString to be padded
stringsPadCharChar to use for the padding
intiLengthTarget length of the string
Returns:
stringThe padded string
jQuery.sap.parseXML(sXMLText): objectModule: jquery.sap.xml
Parses the specified XML formatted string text using native parsing function of the browser and returns a valid XML document. If an error occurred during parsing a parse error object is returned as property (parseError) of the returned XML document object. The parse error object has the following error information parameters: errorCode, url, reason, srcText, line, linepos, filepos
Parameters:
stringsXMLTextthe XML data as string
Returns:
objectthe parsed XML document with a parseError property as described in getParseError. An error occurred if the errorCode property of the parseError is != 0.
jQuery.sap.properties(mParams?): jQuery.sap.util.Properties|null|PromiseModule: jquery.sap.properties

Creates and returns a new instance of jQuery.sap.util.Properties.

If option 'url' is passed, immediately a load request for the given target is triggered. A property file that is loaded can contain comments with a leading ! or #. The loaded property list does not contain any comments.

Example for loading a property file:

 jQuery.sap.properties({url : "../myProperty.properties"});

Example for creating an empty properties instance:

 jQuery.sap.properties();

Examples for getting and setting properties:

	var oProperties = jQuery.sap.properties();
	oProperties.setProperty("KEY_1","Test Key");
	var sValue1 = oProperties.getProperty("KEY_1");
	var sValue2 = oProperties.getProperty("KEY_2","Default");

Parameters:
objectmParams?Parameters used to initialize the property list
stringmParams.url?The URL to the .properties file which should be loaded.
booleanmParams.async?, Default: falseWhether the .properties file which should be loaded asynchronously
objectmParams.headers?A map of additional header key/value pairs to send along with the request (see headers option of jQuery.ajax)
objectmParams.returnNullIfMissing?, Default: falseWhether null should be returned for a missing properties file; by default an empty collection is returned
Returns:
jQuery.sap.util.Properties|null|PromiseA new property collection (synchronous case) or null if the file could not be loaded and returnNullIfMissing was set; in case of asynchronous loading, always a Promise is returned, which resolves with the property collection or with null if the file could not be loaded and returnNullIfMissing was set to true
Throws:
ErrorWhen the file has syntax issues (e.g. incomplete unicode escapes); in async mode, the error is not thrown but the returned Promise will be rejected
jQuery.sap.registerModulePath(sModuleName, vUrlPrefix)

Registers an URL prefix for a module name prefix.

Before a module is loaded, the longest registered prefix of its module name is searched for and the associated URL prefix is used as a prefix for the request URL. The remainder of the module name is attached to the request URL by replacing dots ('.') with slashes ('/').

The registration and search operates on full name segments only. So when a prefix

'sap.com' -> 'http://www.sap.com/ui5/resources/'

is registered, then it will match the name

'sap.com.Button'

but not

'sap.commons.Button'

Note that the empty prefix ('') will always match and thus serves as a fallback for any search.

The prefix can either be given as string or as object which contains the url and a 'final' property. If 'final' is set to true, overwriting a module prefix is not possible anymore.

Parameters:
stringsModuleNamemodule name to register a path for
string|objectvUrlPrefixpath prefix to register, either a string literal or an object (e.g. {url : 'url/to/res', 'final': true})
stringvUrlPrefix.url?path prefix to register
booleanvUrlPrefix.final?flag to avoid overwriting the url path prefix for the given module name at a later point of time
jQuery.sap.registerResourcePath(sResourceNamePrefix, vUrlPrefix)

Registers an URL prefix for a resource name prefix.

Before a resource is loaded, the longest registered prefix of its unified resource name is searched for and the associated URL prefix is used as a prefix for the request URL. The remainder of the resource name is attached to the request URL 1:1.

The registration and search operates on full name segments only. So when a prefix

'sap/com' -> 'http://www.sap.com/ui5/resources/'

is registered, then it will match the name

'sap/com/Button'

but not

'sap/commons/Button'

Note that the empty prefix ('') will always match and thus serves as a fallback for any search.

The url prefix can either be given as string or as object which contains the url and a final flag. If final is set to true, overwriting a resource name prefix is not possible anymore.

Parameters:
stringsResourceNamePrefixin unified resource name syntax
string|objectvUrlPrefixprefix to use instead of the sResourceNamePrefix, either a string literal or an object (e.g. {url : 'url/to/res', 'final': true})
stringvUrlPrefix.url?path prefix to register
booleanvUrlPrefix.final?flag to avoid overwriting the url path prefix for the given module name at a later point of time
jQuery.sap.removeUrlWhitelist(iIndex)Module: jquery.sap.encoder
Removes a whitelist entry for URL validation.
Parameters:
intiIndexindex of entry
jQuery.sap.require(vModuleName)

Ensures that the given module is loaded and executed before execution of the current script continues.

By issuing a call to this method, the caller declares a dependency to the listed modules.

Any required and not yet loaded script will be loaded and execute synchronously. Already loaded modules will be skipped.

Parameters:
string|objectvModuleNameone or more names of modules to be loaded or in case of an object {modName: "...", type: "..."} where modName is the name of the module and the type could be a specific dot separated extension e.g. {modName: "sap.ui.core.Dev", type: "view"} loads sap/ui/core/Dev.view.js and registers as sap.ui.core.Dev.view
jQuery.sap.resources(mParams?): jQuery.sap.util.ResourceBundle|PromiseModule: jquery.sap.resources
Creates and returns a new instance of jQuery.sap.util.ResourceBundle using the given URL and locale to determine what to load.
Parameters:
objectmParams?Parameters used to initialize the resource bundle
stringmParams.url?, Default: ''URL pointing to the base .properties file of a bundle (.properties file without any locale information, e.g. "mybundle.properties")
stringmParams.locale?Optional language (aka 'locale') to load the texts for. Can either be a BCP47 language tag or a JDK compatible locale string (e.g. "en-GB", "en_GB" or "fr"); Defaults to the current session locale if sap.ui.getCore is available, otherwise to 'en'
booleanmParams.includeInfo?, Default: falseWhether to include origin information into the returned property values
booleanmParams.async?, Default: falseWhether the first bundle should be loaded asynchronously Note: Fallback bundles loaded by getText are always loaded synchronously.
Returns:
jQuery.sap.util.ResourceBundle|PromiseA new resource bundle or a Promise on that bundle (in asynchronous case)
jQuery.sap.scrollbarSize(sClasses?, bForce?): objectModule: jquery.sap.dom

Returns the size (width of the vertical / height of the horizontal) native browser scrollbars.

This function must only be used when the DOM is ready.

Parameters:
stringsClasses?, Default: the CSS class that should be added to the test element.
booleanbForce?, Default: falseforce recalculation of size (e.g. when CSS was changed). When no classes are passed all calculated sizes are reset.
Returns:
objectJSON object with properties width and height (the values are of type number and are pixels).
Since:
1.4.0
jQuery.sap.serializeXML(oXMLDocument): objectModule: jquery.sap.xml
Serializes the specified XML document into a string representation.
Parameters:
stringoXMLDocumentthe XML document object to be serialized as string
Returns:
objectthe serialized XML string
jQuery.sap.setIcons(oIcons)Module: jquery.sap.mobile

Sets the bookmark icon for desktop browsers and the icon to be displayed on the home screen of iOS devices after the user does "add to home screen".

Only call this method once and call it early when the page is loading: browsers behave differently when the favicon is modified while the page is alive. Some update the displayed icon inside the browser but use an old icon for bookmarks. When a favicon is given, any other existing favicon in the document will be removed. When at least one home icon is given, all existing home icons will be removed and new home icon tags for all four resolutions will be created.

The home icons must be in PNG format and given in different sizes for iPad/iPhone with and without retina display. The favicon is used in the browser and for desktop shortcuts and should optimally be in ICO format: PNG does not seem to be supported by Internet Explorer and ICO files can contain different image sizes for different usage locations. E.g. a 16x16px version is used inside browsers.

All icons are given in an an object holding icon URLs and other settings. The properties of this object are:

  • phone: a 60x60 pixel version for non-retina iPhones
  • tablet: a 76x76 pixel version for non-retina iPads
  • phone@2: a 120x120 pixel version for retina iPhones
  • tablet@2: a 152x152 pixel version for retina iPads
  • precomposed: whether the home icons already have some glare effect (otherwise iOS will add it) (default: false)
  • favicon: the ICO file to be used inside the browser and for desktop shortcuts

One example is:

{
   'phone':'phone-icon_60x60.png',
   'phone@2':'phone-retina_120x120.png',
   'tablet':'tablet-icon_76x76.png',
   'tablet@2':'tablet-retina_152x152.png',
   'precomposed':true,
   'favicon':'desktop.ico'
}
If one of the sizes is not given, the largest available alternative image will be used instead for this size. On Android these icons may or may not be used by the device. Apparently chances can be improved by using icons with glare effect, so the "precomposed" property can be set to "true". Some Android devices may also use the favicon for bookmarks instead of the home icons.

Parameters:
objectoIcons
jQuery.sap.setMobileWebAppCapable(bValue)Module: jquery.sap.mobile

Sets the "apple-mobile-web-app-capable" and "mobile-web-app-capable" meta information which defines whether the application is loaded in full screen mode (browser address bar and toolbar are hidden) after the user does "add to home screen" on mobile devices. Currently this meta tag is only supported by iOS Safari and mobile Chrome from version 31.

If the application opens new tabs because of attachments, url and so on, setting this to false will let the user be able to go from the new tab back to the application tab after the application is added to home screen.

Note: this function only has effect when the application runs on iOS Safari and mobile Chrome from version 31.

Parameters:
booleanbValuewhether the Application will be loaded in full screen mode after added to home screen from iOS Safari or mobile Chrome from version 31.
jQuery.sap.setObject(sName, vValue, oContext?)

Sets an object property to a given value, where the property is identified by a sequence of names (path).

When a oContext is given, the path starts in that object. Otherwise it starts in the window object that this plugin has been created for.

Note: Although this method internally uses object["key"] to address object properties, it does not support all possible characters in a name. Especially the dot ('.') is not supported in the individual name segments, as it is always interpreted as a name separator.

Parameters:
stringsNamea dot separated sequence of names that identify the property
anyvValuevalue to be set, can have any type
objectoContext?, Default: windowthe context to execute the search in
jQuery.sap.sjax(oOrigSettings)Module: jquery.sap.sjax

Convenience wrapper around jQuery.ajax() that avoids the need for callback functions when synchronous calls are made. If the setting complexResult is true (default), then the return value is an object with the following properties

  • success boolean whether the call succeeded or not
  • data any the data returned by the call. For dataType 'text' this is a string, for JSON it is an object, for XML it is a document. When the call failed, then data is not defined
  • status string a textual status ('success,', 'error', 'timeout',...)
  • statusCode string the HTTP status code of the request
  • error Error an error object (exception) in case an error occurred
  • errorText string an error message in case an error occurred

When complexResult is false, then in the case of success, only 'data' is returned, in case of an error the 'fallback' setting is returned (defaults to undefined).

Note that async=false is always enforced by this method.

Parameters:
stringoOrigSettingsthe ajax() settings
Since:
0.9.0
jQuery.sap.startsWith(sString, sStartString): booleanModule: jquery.sap.strings
Checks whether a given sString starts with sStartString respecting the case of the strings.
Parameters:
stringsStringString to be checked
stringsStartStringThe start string to be searched
Returns:
booleanWhether sString starts with sStartString
See:
jQuery.sap.startsWithIgnoreCase
jQuery.sap.startsWithIgnoreCase(sString, sStartString): booleanModule: jquery.sap.strings
Checks whether a given sString starts with sStartString ignoring the case of both strings.
Parameters:
stringsStringString to be checked
stringsStartStringThe start string to be searched
Returns:
booleanWhether sString starts with sStartString
See:
jQuery.sap.startsWith
jQuery.sap.syncGet(sUrl, data, sDataType?)Module: jquery.sap.sjax
Convenience wrapper for jQuery.sap.sjax that enforeces the Http method GET and defaults the data type of the result to 'text'.
Parameters:
stringsUrlthe URL
string|objectdatarequest parameters in the format accepted by jQuery.ajax()
stringsDataType?, Default: 'text'the type of data expected from the server, default is "text"
Since:
0.9.0
jQuery.sap.syncGetJSON(sUrl, data, fallback?)Module: jquery.sap.sjax

Convenience wrapper for jQuery.sap.sjax that enforces the Http method GET and the data type 'json'. If a fallback value is given, the function simply returns the response as an object or - if some error occurred - the fallback value. This is useful for applications that don't require detailed error diagnostics.

If applications need to know about occurring errors, they can either call sjax() directly or they can omit the fallback value (providing only two parameters to syncGetJSON()). They then receive the same complex result object as for the sjax() call.

Note that providing "undefined" or "null" as a fallback is different from omitting the fallback (complex result).

Parameters:
stringsUrlthe URL
string|objectdatarequest parameters in the format accepted by jQuery.ajax()
objectfallback?if set, only data is returned (and this fallback instead in case of errors); if unset, a result structure is returned
Since:
0.9.0
jQuery.sap.syncGetText(sUrl, data, fallback?)Module: jquery.sap.sjax

Convenience wrapper for jQuery.sap.sjax that enforces the Http method GET and the data type 'text'. If a fallback value is given, the function simply returns the response as a text or - if some error occurred - the fallback value. This is useful for applications that don't require detailed error diagnostics.

If applications need to know about occurring errors, they can either call sjax() directly or they can omit the fallback value (providing only two parameters to syncGetText()). They then receive the same complex result object as for the sjax() call.

Parameters:
stringsUrlthe URL
string|objectdatarequest parameters in the format accepted by jQuery.ajax()
stringfallback?if set, only data is returned (and this fallback instead in case of errors); if unset, a result structure is returned
Since:
0.9.0
jQuery.sap.syncPost(sUrl, data, sDataType?)Module: jquery.sap.sjax
Convenience wrapper for jQuery.sap.sjax that enforces the Http method POST and defaults the data type of the result to 'text'.
Parameters:
stringsUrlthe URL
string|objectdatarequest parameters in the format accepted by jQuery.ajax()
stringsDataType?, Default: 'text'the type of data expected from the server, default is "text"
Since:
0.9.0
jQuery.sap.syncStyleClass(sStyleClass, vSource, vDestination): jQuery|ElementModule: jquery.sap.dom
Search ancestors of the given source DOM element for the specified CSS class name. If the class name is found, set it to the root DOM element of the target control. If the class name is not found, it is also removed from the target DOM element.
Parameters:
stringsStyleClassCSS class name
jQuery|sap.ui.core.Control|stringvSourcejQuery object, control or an id of the source element.
jQuery|sap.ui.core.ControlvDestinationtarget jQuery object or a control.
Returns:
jQuery|ElementTarget element
Since:
1.22
jQuery.sap.uid(): stringModule: jquery.sap.script

Creates and returns a pseudo-unique id.

No means for detection of overlap with already present or future UIDs.

Returns:
stringA pseudo-unique id.
jQuery.sap.unbindAnyEvent(fnCallback)Module: jquery.sap.events
Unbinds all events for listening with the given callback function.
Parameters:
functionfnCallbackCallback function
jQuery.sap.unique(a): ArrayModule: jquery.sap.script

Sorts the given array in-place and removes any duplicates (identified by "===").

Use jQuery.unique() for arrays of DOMElements.

Parameters:
ArrayaAn Array of any type
Returns:
ArraySame array as given (for chaining)
jQuery.sap.validateUrl(sUrl)Module: jquery.sap.encoder

Validates an URL. Check if it's not a script or other security issue.

Split URL into components and check for allowed characters according to RFC 3986:

authority     = [ userinfo "@" ] host [ ":" port ]
userinfo      = *( unreserved / pct-encoded / sub-delims / ":" )
host          = IP-literal / IPv4address / reg-name

IP-literal    = "[" ( IPv6address / IPvFuture  ) "]"
IPvFuture     = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
IPv6address   =                            6( h16 ":" ) ls32
              /                       "::" 5( h16 ":" ) ls32
              / [               h16 ] "::" 4( h16 ":" ) ls32
              / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
              / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
              / [ *3( h16 ":" ) h16 ] "::"    h16 ":"   ls32
              / [ *4( h16 ":" ) h16 ] "::"              ls32
              / [ *5( h16 ":" ) h16 ] "::"              h16
              / [ *6( h16 ":" ) h16 ] "::"
ls32          = ( h16 ":" h16 ) / IPv4address
              ; least-significant 32 bits of address
h16           = 1*4HEXDIG
              ; 16 bits of address represented in hexadecimal

IPv4address   = dec-octet "." dec-octet "." dec-octet "." dec-octet
dec-octet     = DIGIT                 ; 0-9
              / %x31-39 DIGIT         ; 10-99
              / "1" 2DIGIT            ; 100-199
              / "2" %x30-34 DIGIT     ; 200-249
              / "25" %x30-35          ; 250-255

reg-name      = *( unreserved / pct-encoded / sub-delims )

pct-encoded   = "%" HEXDIG HEXDIG
reserved      = gen-delims / sub-delims
gen-delims    = ":" / "/" / "?" / "#" / "[" / "]" / "@"
sub-delims    = "!" / "$" / "&" / "'" / "(" / ")"
              / "*" / "+" / "," / ";" / "="
unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"
pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"

path          = path-abempty    ; begins with "/" or is empty
              / path-absolute   ; begins with "/" but not "//"
              / path-noscheme   ; begins with a non-colon segment
              / path-rootless   ; begins with a segment
              / path-empty      ; zero characters

path-abempty  = *( "/" segment )
path-absolute = "/" [ segment-nz *( "/" segment ) ]
path-noscheme = segment-nz-nc *( "/" segment )
path-rootless = segment-nz *( "/" segment )
path-empty    = 0
segment       = *pchar
segment-nz    = 1*pchar
segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )
              ; non-zero-length segment without any colon ":"

query         = *( pchar / "/" / "?" )

fragment      = *( pchar / "/" / "?" )

For the hostname component, we are checking for valid DNS hostnames according to RFC 952 / RFC 1123:

hname         = name *("." name)
name          = let-or-digit ( *( let-or-digit-or-hyphen ) let-or-digit )

When the URI uses the protocol 'mailto:', the address part is additionally checked against the most commonly used parts of RFC 6068:

mailtoURI     = "mailto:" [ to ] [ hfields ]
to            = addr-spec *("," addr-spec )
hfields       = "?" hfield *( "&" hfield )
hfield        = hfname "=" hfvalue
hfname        = *qchar
hfvalue       = *qchar
addr-spec     = local-part "@" domain
local-part    = dot-atom-text              // not accepted: quoted-string
domain        = dot-atom-text              // not accepted: "[" *dtext-no-obs "]"
dtext-no-obs  = %d33-90 / ; Printable US-ASCII
                %d94-126  ; characters not including
                          ; "[", "]", or "\"
qchar         = unreserved / pct-encoded / some-delims
some-delims   = "!" / "$" / "'" / "(" / ")" / "*"
              / "+" / "," / ";" / ":" / "@"

Note:
A number of characters that can appear in <addr-spec> MUST be
percent-encoded.  These are the characters that cannot appear in
a URI according to [STD66] as well as "%" (because it is used for
percent-encoding) and all the characters in gen-delims except "@"
and ":" (i.e., "/", "?", "#", "[", and "]").  Of the characters
in sub-delims, at least the following also have to be percent-
encoded: "&", ";", and "=".  Care has to be taken both when
encoding as well as when decoding to make sure these operations
are applied only once.

When a whitelist has been configured using addUrlWhitelist, any URL that passes the syntactic checks above, additionally will be tested against the content of the whitelist.

Parameters:
stringsUrl
jQuery.sap.arrayDiff(aOld, aNew, fnCompare?, bUniqueEntries?): ArrayModule: jquery.sap.script

Calculate delta of old list and new list.

This partly implements the algorithm described in "A Technique for Isolating Differences Between Files" but instead of working with hashes, it does compare each entry of the old list with each entry of the new list, which causes terrible performane on large datasets.

Parameters:
ArrayaOldOld Array
ArrayaNewNew Array
functionfnCompare?Function to compare list entries
booleanbUniqueEntries?Whether entries are unique, so no duplicate entries exist
Returns:
ArrayList of changes
Deprecated API:
As of 1.38, use jQuery.sap.arraySymbolDiff instead if applicable
jQuery.sap.escapeHTML(sString)Module: jquery.sap.encoder
Encode the string for inclusion into HTML content/attribute. Old name "escapeHTML" kept for backward compatibility
Parameters:
stringsStringThe string to be escaped
Deprecated API:
Has been renamed, use jQuery.sap.encodeHTML instead.
jQuery.sap.escapeJS(sString)Module: jquery.sap.encoder
Encode the string for inclusion into a JS string literal. Old name "escapeJS" kept for backward compatibility
Parameters:
stringsStringThe string to be escaped
Deprecated API:
Since 1.3.0. Has been renamed, use jQuery.sap.encodeJS instead.
jQuery.sap.factory(oPrototype): function

Returns a new constructor function that creates objects with the given prototype.

As of 1.45.0, this method has been deprecated. Use the following code pattern instead:

  function MyFunction() {
  };
  MyFunction.prototype = oPrototype;

Parameters:
objectoPrototypePrototype to use for the new objects
Returns:
functionthe newly created constructor function
Deprecated API:
As of 1.45.0, define your own function and assign oPrototype to its prototype property instead.
jQuery.sap.newObject(oPrototype): object

Returns a new object which has the given oPrototype as its prototype.

If several objects with the same prototype are to be created, jQuery.sap.factory should be used instead.

Parameters:
objectoPrototypePrototype to use for the new object
Returns:
objectnew object
Deprecated API:
As of 1.45.0, use Object.create(oPrototype) instead.