Properties
Promise
#
Wrapper class for Promises
- Source:
Methods
Deferred() → {jQuery.Deferred}
#
all(promises) → {jQuery.Promise}
#
Wrapper class for the $.when that is compatible with Promise.all
Parameters:
Name | Type | Description |
---|---|---|
promises |
Array.<jQuery.Promise> |
- Source:
Returns:
- Type
- jQuery.Promise
docReady(fn) → {jQuery.Object}
#
Run method when document is ready.
Parameters:
Name | Type | Description |
---|---|---|
fn |
function |
- Source:
Returns:
- Type
- jQuery.Object
escapeSelector(selector) → {string}
#
Escape a string for use as a css selector
Parameters:
Name | Type | Description |
---|---|---|
selector |
string |
- Source:
Returns:
- Type
- string
extend() → {Object}
#
Wrapper for jQuery.extend method. In future this can be bound to Object.assign when support allows.
Warning: if only one argument is supplied to util.extend(), this means the target argument was omitted. In this case, the jQuery object itself is assumed to be the target.
- Source:
Returns:
- Type
- Object
getDir(language) → {Object}
#
Determine whether a language is LTR or RTL This works around T74153 and T189036 and the fact that adding dir attribute to HTML in core at time of writing is memory-intensive (I7cd8a3117f49467e3ff26f35371459a667c71470)
Parameters:
Name | Type | Description |
---|---|---|
language |
Object | with 'lang' key. |
Returns:
language with 'lang' key and new 'dir' key.
- Type
- Object
getDocument() → {jQuery.Object}
#
Adds a class to the document
- Source:
Returns:
element representing the documentElement
- Type
- jQuery.Object
getFrequentlyUsedLanguages() → {Object}
#
getWindow() → {jQuery.Object}
#
parseHTML(html, [ctx]) → {jQuery.Object}
#
Given some html, create new element(s). Unlike jQuery.parseHTML this will return a jQuery object not an array.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
html |
string | ||
ctx |
Element |
optional |
Document element to serve as the context in which the HTML fragment will be created |
- Source:
Returns:
- Type
- jQuery.Object
saveFrequentlyUsedLanguages(languageMap)
#
Save the frequently used languages to the user's device
Parameters:
Name | Type | Description |
---|---|---|
languageMap |
Object |
saveLanguageUsageCount(languageCode, frequentlyUsedLanguages)
#
Increment the current language usage by one and save it to the device. Cap the result at 100.
Parameters:
Name | Type | Description |
---|---|---|
languageCode |
string | |
frequentlyUsedLanguages |
Object | list of the frequently used languages |