JScrewIt • Docs
FeatureConstructor(...
features
):CustomFeature
Creates a new feature object from the union of the specified features.
The constructor can be used with or without the new
operator, e.g.
new JScrewIt.Feature(feature1, feature2)
or JScrewIt.Feature(feature1, feature2)
.
If no arguments are specified, the new feature object will be equivalent to
DEFAULT
.
• ...features: FeatureElementOrCompatibleArray
[]
The following statements are equivalent, and will all construct a new feature object
including both ANY_DOCUMENT
and ANY_WINDOW
.
new JScrewIt.Feature("ANY_DOCUMENT", "ANY_WINDOW");
new JScrewIt.Feature(JScrewIt.Feature.ANY_DOCUMENT, JScrewIt.Feature.ANY_WINDOW);
new JScrewIt.Feature([JScrewIt.Feature.ANY_DOCUMENT, JScrewIt.Feature.ANY_WINDOW]);
An error is thrown if any of the specified features are not mutually compatible.
new FeatureConstructor(...
features
):CustomFeature
Creates a new feature object from the union of the specified features.
The constructor can be used with or without the new
operator, e.g.
new JScrewIt.Feature(feature1, feature2)
or JScrewIt.Feature(feature1, feature2)
.
If no arguments are specified, the new feature object will be equivalent to
DEFAULT
.
• ...features: FeatureElementOrCompatibleArray
[]
The following statements are equivalent, and will all construct a new feature object
including both ANY_DOCUMENT
and ANY_WINDOW
.
JScrewIt.Feature("ANY_DOCUMENT", "ANY_WINDOW");
JScrewIt.Feature(JScrewIt.Feature.ANY_DOCUMENT, JScrewIt.Feature.ANY_WINDOW);
JScrewIt.Feature([JScrewIt.Feature.ANY_DOCUMENT, JScrewIt.Feature.ANY_WINDOW]);
An error is thrown if any of the specified features are not mutually compatible.
FeatureAll.constructor
readonly
ALL:FeatureAll
An immutable mapping of all predefined feature objects accessed by name or alias.
This will produce an array with the names and aliases of all predefined features.
Object.keys(JScrewIt.Feature.ALL)
This will determine if a particular feature object is predefined or not.
featureObj === JScrewIt.Feature.ALL[featureObj.name]
ANDRO_4_0:
PredefinedFeature
Features available in Android Browser 4.0.
ANDRO_4_1:
PredefinedFeature
Features available in Android Browser 4.1 to 4.3.
ANDRO_4_4:
PredefinedFeature
Features available in Android Browser 4.4.
ANY_DOCUMENT:
ElementaryFeature
Existence of the global object document whose string representation starts with "[object " and ends with "Document]".
Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers.
ANY_WINDOW:
ElementaryFeature
Existence of the global object self whose string representation starts with "[object " and ends with "Window]".
Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers.
ARRAY_ITERATOR:
ElementaryFeature
The property that the string representation of Array.prototype.entries() starts with "[object Array" and ends with "]" at index 21 or 22.
Available in Chrome, Edge, Firefox, Safari 7.1+, Opera, and Node.js 0.12+.
ARROW:
ElementaryFeature
Support for arrow functions.
Available in Chrome, Edge, Firefox, Safari 10.0+, Opera, and Node.js 4+.
ASYNC_FUNCTION:
ElementaryFeature
Support for async functions, which return Promise object.
Available in Chrome, Edge, Firefox, Safari 10.1+, Opera, and Node.js 7.6+.
Existence of the native function Array.prototype.at.
Available in Chrome, Edge, Firefox, Safari 15.4+, Opera, and Node.js 16.6+.
ATOB:
ElementaryFeature
Existence of the global functions atob and btoa.
Available in Chrome, Edge, Firefox, Internet Explorer 10+, Safari, Opera, Android Browser, and Node.js 16.0+. This feature is not available inside web workers in Safari before 10.0.
AUTO:
PredefinedFeature
Features available in the current environment.
BARPROP:
ElementaryFeature
Existence of the global object statusbar having the string representation "[object BarProp]".
Available in Chrome, Edge, Firefox, Safari, Opera, and Android Browser 4.4. This feature is not available inside web workers.
BROWSER:
PredefinedFeature
Features available in all browsers.
No support for Node.js.
CALL_ON_GLOBAL:
ElementaryFeature
The ability to call a function on the global object when invoking Function.prototype.call without binding.
Available in Android Browser before 4.1.
CAPITAL_HTML:
ElementaryFeature
The property that the various string methods returning HTML code such as String.prototype.big or String.prototype.link have both the tag name and attributes written in capital letters.
Available in Internet Explorer.
CHROME:
PredefinedFeature
Features available in the current stable versions of Chrome, Edge and Opera.
An alias for CHROME_122
.
CHROME_122:
PredefinedFeature
Features available in Chrome 122, Edge 122 and Opera 108 or later.
This feature may be replaced or removed in the near future when current browser versions become obsolete. Use CHROME
or CHROME_PREV
instead of CHROME_122
for long term support.
CHROME_PREV:
PredefinedFeature
Features available in the previous to current versions of Chrome and Edge.
An alias for CHROME_122
.
COMPACT:
PredefinedFeature
All new browsers' features.
No support for Node.js and older browsers like Internet Explorer, Safari 17.3 or Android Browser.
CONSOLE:
ElementaryFeature
Existence of the global object console having the string representation "[object Console]".
This feature may become unavailable when certain browser extensions are active.
Available in Internet Explorer 10+, Safari before 14.1, and Android Browser. This feature is not available inside web workers in Safari before 7.1 and Android Browser 4.4.
CREATE_ELEMENT:
ElementaryFeature
Existence of the function document.createElement.
An alias for ANY_DOCUMENT
.
DEFAULT:
PredefinedFeature
Minimum feature level, compatible with all supported engines in all environments.
DOCUMENT:
ElementaryFeature
Existence of the global object document having the string representation "[object Document]".
Available in Internet Explorer before 11. This feature is not available inside web workers.
DOMWINDOW:
ElementaryFeature
Existence of the global object self having the string representation "[object DOMWindow]".
Available in Android Browser before 4.4. This feature is not available inside web workers.
readonly
ELEMENTARY: readonlyElementaryFeature
[]
An immutable array of all elementary feature objects ordered by name.
ESC_HTML_ALL:
ElementaryFeature
The property that double quotation mark, less than and greater than characters in the argument of String.prototype.fontcolor are escaped into their respective HTML entities.
Available in Android Browser and Node.js before 0.12.
ESC_HTML_QUOT:
ElementaryFeature
The property that double quotation marks in the argument of String.prototype.fontcolor are escaped as """.
Available in Chrome, Edge, Firefox, Safari, Opera, Android Browser, and Node.js.
ESC_HTML_QUOT_ONLY:
ElementaryFeature
The property that only double quotation marks and no other characters in the argument of String.prototype.fontcolor are escaped into HTML entities.
Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js 0.12+.
ESC_REGEXP_LF:
ElementaryFeature
Having regular expressions created with the RegExp constructor use escape sequences starting with a backslash to format line feed characters ("\n") in their string representation.
Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Node.js 12+.
ESC_REGEXP_SLASH:
ElementaryFeature
Having regular expressions created with the RegExp constructor use escape sequences starting with a backslash to format slashes ("/") in their string representation.
Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Node.js 4+.
Features available in the current stable version of Firefox.
An alias for FF_131
.
FF_131:
PredefinedFeature
Features available in Firefox 131 or later.
This feature may be replaced or removed in the near future when current browser versions become obsolete. Use FF
instead of FF_131
for long term support.
FF_90:
PredefinedFeature
Features available in Firefox 90 to 130.
This feature may be replaced or removed in the near future when current browser versions become obsolete. Use FF_ESR
or FF_PREV
instead of FF_90
for long term support.
FF_ESR:
PredefinedFeature
Features available in the current version of Firefox ESR.
An alias for FF_90
.
FF_PREV:
PredefinedFeature
Features available in the previous to current version of Firefox.
An alias for FF_90
.
FF_SRC:
ElementaryFeature
A string representation of native functions typical for Firefox and Safari.
Remarkable traits are the lack of line feed characters at the beginning and at the end of the string and the presence of a line feed followed by four whitespaces ("\n ") before the "[native code]" sequence.
Available in Firefox and Safari.
FILL:
ElementaryFeature
Existence of the native function Array.prototype.fill.
Available in Chrome, Edge, Firefox, Safari 7.1+, Opera, and Node.js 4+.
FLAT:
ElementaryFeature
Existence of the native function Array.prototype.flat.
Available in Chrome, Edge, Firefox, Safari 12+, Opera, and Node.js 11+.
FORMS:
ElementaryFeature
Existence of the object document.forms with string representation "[object HTMLCollection]".
An alias for ANY_DOCUMENT
.
FROM_CODE_POINT:
ElementaryFeature
Existence of the function String.fromCodePoint.
Available in Chrome, Edge, Firefox, Safari 9+, Opera, and Node.js 4+.
FUNCTION_19_LF:
ElementaryFeature
A string representation of dynamically generated functions where the character at index 19 is a line feed ("\n").
Available in Chrome, Edge, Firefox, Safari 17.4+, Opera, and Node.js 10+.
FUNCTION_22_LF:
ElementaryFeature
A string representation of dynamically generated functions where the character at index 22 is a line feed ("\n").
Available in Internet Explorer, Safari 9+ before 17.4, Android Browser, and Node.js before 10.
GENERIC_ARRAY_TO_STRING:
ElementaryFeature
Ability to call Array.prototype.toString with a non-array binding.
Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, Android Browser 4.1+, and Node.js.
FeatureAll
.GENERIC_ARRAY_TO_STRING
GLOBAL_UNDEFINED:
ElementaryFeature
Having the global function toString return the string "[object Undefined]" when invoked without a binding.
Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js.
GMT:
ElementaryFeature
Presence of the text "GMT" after the first 25 characters in the string returned by Date().
The string representation of dates is implementation dependent, but most engines use a similar format, making this feature available in all supported engines except Internet Explorer 9 and 10.
Available in Chrome, Edge, Firefox, Internet Explorer 11, Safari, Opera, Android Browser, and Node.js.
HISTORY:
ElementaryFeature
Existence of the global object history having the string representation "[object History]".
Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers.
HTMLAUDIOELEMENT:
ElementaryFeature
Existence of the global object Audio whose string representation starts with "function HTMLAudioElement".
Available in Android Browser 4.4. This feature is not available inside web workers.
IE_10:
PredefinedFeature
Features available in Internet Explorer 10.
IE_11:
PredefinedFeature
Features available in Internet Explorer 11.
IE_11_WIN_10:
PredefinedFeature
Features available in Internet Explorer 11 on Windows 10.
IE_9:
PredefinedFeature
Features available in Internet Explorer 9.
IE_SRC:
ElementaryFeature
A string representation of native functions typical for Internet Explorer.
Remarkable traits are the presence of a line feed character ("\n") at the beginning and at the end of the string and a line feed followed by four whitespaces ("\n ") before the "[native code]" sequence.
Available in Internet Explorer.
INCR_CHAR:
ElementaryFeature
The ability to use unary increment operators with string characters, like in ( ++"some string"[0] ): this will result in a TypeError in strict mode in ECMAScript compliant engines.
Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, Android Browser, and Node.js. This feature is not available when strict mode is enforced in Chrome, Edge, Firefox, Internet Explorer 10+, Safari, Opera, and Node.js 5+.
INTL:
ElementaryFeature
Existence of the global object Intl.
Available in Chrome, Edge, Firefox, Internet Explorer 11, Safari 10.0+, Opera, Android Browser 4.4, and Node.js 0.12+.
ITERATOR_HELPER:
ElementaryFeature
Availability of iterator helpers.
Available in Chrome, Edge, Firefox 131+, Opera, and Node.js 22+.
JAPANESE_INFINITY:
ElementaryFeature
Japanese string representation of Infinity ending with "∞".
Available in Chrome, Edge, Firefox, Internet Explorer 11, Safari 10.0+, Opera, Android Browser 4.4, and Node.js 0.12+.
LOCALE_INFINITY:
ElementaryFeature
Language sensitive string representation of Infinity as "∞".
Available in Chrome, Edge, Firefox, Internet Explorer 11 on Windows 10, Safari 10.0+, Opera, Android Browser 4.4, and Node.js 0.12+.
LOCALE_NUMERALS:
ElementaryFeature
Features shared by all engines capable of localized number formatting, including output of Arabic digits, the Arabic decimal separator "٫", the letters in the first word of the Arabic string representation of NaN ("ليس"), Persian digits and the Persian digit group separator "٬".
Available in Chrome, Edge, Firefox, Internet Explorer 11, Safari 10.0+, Opera, Android Browser 4.4, and Node.js 13+.
LOCALE_NUMERALS_EXT:
ElementaryFeature
Extended localized number formatting.
This includes all features of LOCALE_NUMERALS plus the output of the first three letters in the second word of the Arabic string representation of NaN ("رقم"), Bengali digits, the letters in the Russian string representation of NaN ("не число") and the letters in the Persian string representation of NaN ("ناعدد").
Available in Chrome, Edge, Firefox, Internet Explorer 11 on Windows 10, Safari 10.0+, Opera, Android Browser 4.4, and Node.js 13+.
FeatureAll
.LOCALE_NUMERALS_EXT
LOCATION:
ElementaryFeature
Existence of the global object location with the property that Object.prototype.toString.call(location) evaluates to a string that starts with "[object " and ends with "Location]".
Available in Chrome, Edge, Firefox, Safari, Opera, and Android Browser.
MOZILLA:
ElementaryFeature
Existence of user agent string navigator.userAgent that starts with "Mozilla".
Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser.
NAME:
ElementaryFeature
Existence of the name property for functions.
Available in Chrome, Edge, Firefox, Safari, Opera, Android Browser, and Node.js.
NO_FF_SRC:
ElementaryFeature
A string representation of native functions typical for V8 or for Internet Explorer but not for Firefox and Safari.
Available in Chrome, Edge, Internet Explorer, Opera, Android Browser, and Node.js.
NO_IE_SRC:
ElementaryFeature
A string representation of native functions typical for most engines with the notable exception of Internet Explorer.
A remarkable trait of this feature is the lack of line feed characters at the beginning and at the end of the string.
Available in Chrome, Edge, Firefox, Safari, Opera, Android Browser, and Node.js.
NO_OLD_SAFARI_ARRAY_ITERATOR:
ElementaryFeature
The property that the string representation of Array.prototype.entries() evaluates to "[object Array Iterator]".
Available in Chrome, Edge, Firefox, Safari 9+, Opera, and Node.js 0.12+.
FeatureAll
.NO_OLD_SAFARI_ARRAY_ITERATOR
NO_V8_SRC:
ElementaryFeature
A string representation of native functions typical for Firefox, Internet Explorer and Safari.
A most remarkable trait of this feature is the presence of a line feed followed by four whitespaces ("\n ") before the "[native code]" sequence.
Available in Firefox, Internet Explorer, and Safari.
NODE_0_10:
PredefinedFeature
Features available in Node.js 0.10.
NODE_0_12:
PredefinedFeature
Features available in Node.js 0.12.
NODE_10:
PredefinedFeature
Features available in Node.js 10.
NODE_11:
PredefinedFeature
Features available in Node.js 11.
NODE_12:
PredefinedFeature
Features available in Node.js 12.
NODE_13:
PredefinedFeature
Features available in Node.js 13 and Node.js 14.
NODE_15:
PredefinedFeature
Features available in Node.js 15.
NODE_16_0:
PredefinedFeature
Features available in Node.js 16.0 to 16.5.
NODE_16_6:
PredefinedFeature
Features available in Node.js 16.6 to 21.
NODE_22:
PredefinedFeature
Features available in Node.js 22 or later.
NODE_4:
PredefinedFeature
Features available in Node.js 4.
NODE_5:
PredefinedFeature
Features available in Node.js 5 to 7.5.
NODE_7_6:
PredefinedFeature
Features available in Node.js 7.6 to 9.
NODE_NAME:
ElementaryFeature
Existence of the string document.nodeName that starts with a number sign ("#").
An alias for ANY_DOCUMENT
.
NODECONSTRUCTOR:
ElementaryFeature
Existence of the global object Node having the string representation "[object NodeConstructor]".
Available in Safari before 10.0. This feature is not available inside web workers.
OBJECT_ARRAY_ENTRIES_CTOR:
ElementaryFeature
The property that the Array.prototype.entries().constructor is the Object constructor.
Available in Firefox before 131, Safari 9+, and Node.js 0.12+ before 22.
FeatureAll
.OBJECT_ARRAY_ENTRIES_CTOR
OBJECT_L_LOCATION_CTOR:
ElementaryFeature
Existence of the global function location.constructor whose string representation starts with "[object L".
Available in Internet Explorer and Safari before 10.0. This feature is not available inside web workers.
FeatureAll
.OBJECT_L_LOCATION_CTOR
OBJECT_UNDEFINED:
ElementaryFeature
Having the function Object.prototype.toString return the string "[object Undefined]" when invoked without a binding.
Available in Chrome, Edge, Firefox, Internet Explorer 10+, Safari, Opera, Android Browser 4.1+, and Node.js.
OBJECT_W_SELF:
ElementaryFeature
The property that the string representation of the global object self starts with "[object W".
Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser 4.4. This feature is not available inside web workers in Chrome, Edge, Firefox, Safari, Opera, and Android Browser 4.4.
OLD_SAFARI_LOCATION_CTOR:
ElementaryFeature
Existence of the global object location.constructor whose string representation starts with "[object " and ends with "LocationConstructor]".
Available in Safari before 10.0.
FeatureAll
.OLD_SAFARI_LOCATION_CTOR
PLAIN_INTL:
ElementaryFeature
Existence of the global object Intl having the string representation "[object Object]".
Available in Internet Explorer 11, Safari 10.0+ before 14.0.1, Android Browser 4.4, and Node.js 0.12+ before 15.
REGEXP_STRING_ITERATOR:
ElementaryFeature
The property that the string representation of String.prototype.matchAll() evaluates to "[object RegExp String Iterator]".
Available in Chrome, Edge, Firefox, Safari 13+, Opera, and Node.js 12+.
FeatureAll
.REGEXP_STRING_ITERATOR
SAFARI:
PredefinedFeature
Features available in the current stable version of Safari.
An alias for SAFARI_18
.
SAFARI_10_0:
PredefinedFeature
Features available in Safari 10.0.
SAFARI_10_1:
PredefinedFeature
Features available in Safari 10.1 and Safari 11.
SAFARI_12:
PredefinedFeature
Features available in Safari 12.
SAFARI_13:
PredefinedFeature
Features available in Safari 13 and Safari 14.0.0.
SAFARI_14_0_1:
PredefinedFeature
Features available in Safari 14.0.1 to 14.0.3.
SAFARI_14_1:
PredefinedFeature
Features available in Safari 14.1 to 15.3.
SAFARI_15_4:
PredefinedFeature
Features available in Safari 15.4 to 17.3.
SAFARI_17_4:
PredefinedFeature
Features available in Safari 17.4 to 17.6.
SAFARI_18:
PredefinedFeature
Features available in Safari 18 or later.
SAFARI_7_0:
PredefinedFeature
Features available in Safari 7.0.
SAFARI_7_1:
PredefinedFeature
Features available in Safari 7.1 and Safari 8.
SAFARI_9:
PredefinedFeature
Features available in Safari 9.
SELF:
ElementaryFeature
An alias for ANY_WINDOW
.
SELF_OBJ:
ElementaryFeature
Existence of the global object self whose string representation starts with "[object ".
Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers in Safari 7.1+ before 10.0.
SHORT_LOCALES:
ElementaryFeature
Support for the two-letter locale name "ar" to format decimal numbers as Arabic numerals.
Available in Firefox, Internet Explorer 11, Safari 10.0+ before 18, Android Browser 4.4, and Node.js 13+.
STATUS:
ElementaryFeature
Existence of the global string status.
Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers.
UNDEFINED:
ElementaryFeature
The property that Object.prototype.toString.call() evaluates to "[object Undefined]".
This behavior is specified by ECMAScript, and is enforced by all engines except Android Browser versions prior to 4.1.2, where this feature is not available.
Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, Android Browser 4.1+, and Node.js.
V8_SRC:
ElementaryFeature
A string representation of native functions typical for the V8 engine.
Remarkable traits are the lack of line feed characters at the beginning and at the end of the string and the presence of a single whitespace before the "[native code]" sequence.
Available in Chrome, Edge, Opera, Android Browser, and Node.js.
WINDOW:
ElementaryFeature
Existence of the global object self having the string representation "[object Window]".
Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser 4.4. This feature is not available inside web workers.
areCompatible(...
features
):boolean
Determines whether the specified features are mutually compatible.
• ...features: FeatureElement
[]
boolean
true
if the specified features are mutually compatible; otherwise, false
.
If less than two features are specified, the return value is true
.
// false: only one of "V8_SRC" or "IE_SRC" may be available.
JScrewIt.Feature.areCompatible("V8_SRC", "IE_SRC")
// true
JScrewIt.Feature.areCompatible(JScrewIt.Feature.DEFAULT, JScrewIt.Feature.FILL)
areEqual(...
features
):boolean
Determines whether all of the specified features are equivalent.
Different features are considered equivalent if they include the same set of elementary features, regardless of any other difference.
• ...features: FeatureElementOrCompatibleArray
[]
boolean
true
if all of the specified features are equivalent; otherwise, false
.
If less than two arguments are specified, the return value is true
.
// false
JScrewIt.Feature.areEqual(JScrewIt.Feature.CHROME, JScrewIt.Feature.FF)
// true
JScrewIt.Feature.areEqual("DEFAULT", [])
commonOf(...
features
):null
|CustomFeature
Creates a new feature object equivalent to the intersection of the specified features.
• ...features: FeatureElementOrCompatibleArray
[]
null
| CustomFeature
A feature object, or null
if no arguments are specified.
This will create a new feature object equivalent to NAME
.
const newFeature = JScrewIt.Feature.commonOf(["ATOB", "NAME"], ["NAME", "SELF"]);
This will create a new feature object equivalent to FeatureConstructor.ANY_WINDOW | ANY_WINDOW
.
This is because both DOMWINDOW
and WINDOW
imply FeatureConstructor.ANY_WINDOW | ANY_WINDOW
.
const newFeature = JScrewIt.Feature.commonOf("DOMWINDOW", "WINDOW");
descriptionFor(
name
):string
Returns a short description of a predefined feature in plain English.
• name: keyof FeatureAll
A name or alias of a predefined feature.
string
Different names or aliases of the same feature may have different descriptions.
An error is thrown if the specified argument is not a name or alias of a predefined feature.