Skip to content

Latest commit

 

History

History
1222 lines (634 loc) · 27.4 KB

File metadata and controls

1222 lines (634 loc) · 27.4 KB

JScrewIt


Interface: FeatureConstructor()

Extends

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`.

Parameters

features

...FeatureElementOrCompatibleArray[]

Returns

CustomFeature

Example

The following statements are equivalent, and will all construct a new feature object including both `DOCUMENT` and `WINDOW`.

new JScrewIt.Feature("DOCUMENT", "WINDOW");
new JScrewIt.Feature(JScrewIt.Feature.DOCUMENT, JScrewIt.Feature.WINDOW);
new JScrewIt.Feature([JScrewIt.Feature.DOCUMENT, JScrewIt.Feature.WINDOW]);

Throws

An error is thrown if any of the specified features are not mutually compatible.

Constructors

Constructor

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`.

Parameters

features

...FeatureElementOrCompatibleArray[]

Returns

CustomFeature

Example

The following statements are equivalent, and will all construct a new feature object including both `DOCUMENT` and `WINDOW`.

JScrewIt.Feature("DOCUMENT", "WINDOW");
JScrewIt.Feature(JScrewIt.Feature.DOCUMENT, JScrewIt.Feature.WINDOW);
JScrewIt.Feature([JScrewIt.Feature.DOCUMENT, JScrewIt.Feature.WINDOW]);

Throws

An error is thrown if any of the specified features are not mutually compatible.

Inherited from

FeatureAll.constructor

Properties

ALL

readonly ALL: FeatureAll

An immutable mapping of all predefined feature objects accessed by name or alias.

Example

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]

ARRAY_ITERATOR

ARRAY_ITERATOR: ElementaryFeature

The property that the string representation of Array.prototype.entries() evaluates to "[object Array Iterator]".

Remarks

Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js.

Inherited from

FeatureAll.ARRAY_ITERATOR


ARROW

ARROW: ElementaryFeature

Support for arrow functions.

Remarks

Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js.

Inherited from

FeatureAll.ARROW


AT

AT: ElementaryFeature

Existence of the native functions Array.prototype.at and String.prototype.at.

Remarks

Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js.

Inherited from

FeatureAll.AT


AUTO

AUTO: PredefinedFeature

Features available in the current environment.

Inherited from

FeatureAll.AUTO


BARPROP

BARPROP: ElementaryFeature

Existence of the global object statusbar having the string representation "[object BarProp]".

Remarks

Available in Chrome, Edge, Firefox, Safari, and Opera. This feature is not available inside web workers.

Inherited from

FeatureAll.BARPROP


BROWSER

BROWSER: PredefinedFeature

Features available in all browsers.

No support for Node.js.

Inherited from

FeatureAll.BROWSER


CAPITAL_HTML

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.

Remarks

Available in Internet Explorer.

Inherited from

FeatureAll.CAPITAL_HTML


CHROME

CHROME: PredefinedFeature

Features available in the current stable versions of Chrome, Edge and Opera.

An alias for CHROME_122.

Inherited from

FeatureAll.CHROME


CHROME_122

CHROME_122: PredefinedFeature

Features available in Chrome 122, Edge 122 and Opera 108 or later.

Remarks

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.

See

Engine Support Policy

Inherited from

FeatureAll.CHROME_122


CHROME_PREV

CHROME_PREV: PredefinedFeature

Features available in the previous to current versions of Chrome and Edge.

An alias for CHROME_122.

Inherited from

FeatureAll.CHROME_PREV


COMPACT

COMPACT: PredefinedFeature

All new browsers' features.

Not compatible with Node.js, Internet Explorer, and old versions of supported browsers.

Inherited from

FeatureAll.COMPACT


CONSOLE

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.

Remarks

Available in Internet Explorer.

Inherited from

FeatureAll.CONSOLE


DEFAULT

DEFAULT: PredefinedFeature

Minimum feature level, compatible with all supported engines in all environments.

Inherited from

FeatureAll.DEFAULT


DOCUMENT

DOCUMENT: ElementaryFeature

Existence of the global object document whose string representation starts with "[object " and ends with "Document]".

Remarks

Available in Chrome, Edge, Firefox, Internet Explorer, Safari, and Opera. This feature is not available inside web workers.

Inherited from

FeatureAll.DOCUMENT


ELEMENTARY

readonly ELEMENTARY: readonly ElementaryFeature[]

An immutable array of all elementary feature objects ordered by name.


ESC_HTML_QUOT

ESC_HTML_QUOT: ElementaryFeature

The property that double quotation marks in the argument of String.prototype.fontcolor are escaped as """.

Remarks

Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js.

Inherited from

FeatureAll.ESC_HTML_QUOT


FF

FF: PredefinedFeature

Features available in the current stable version of Firefox.

An alias for FF_134.

Inherited from

FeatureAll.FF


FF_131

FF_131: PredefinedFeature

Features available in Firefox 131 to 133.

Remarks

This feature may be replaced or removed in the near future when current browser versions become obsolete.

See

Engine Support Policy

Inherited from

FeatureAll.FF_131


FF_134

FF_134: PredefinedFeature

Features available in Firefox 134 or later.

Remarks

This feature may be replaced or removed in the near future when current browser versions become obsolete. Use FF or FF_PREV instead of FF_134 for long term support.

See

Engine Support Policy

Inherited from

FeatureAll.FF_134


FF_90

FF_90: PredefinedFeature

Features available in Firefox 90 to 130.

Remarks

This feature may be replaced or removed in the near future when current browser versions become obsolete. Use FF_ESR instead of FF_90 for long term support.

See

Engine Support Policy

Inherited from

FeatureAll.FF_90


FF_ESR

FF_ESR: PredefinedFeature

Features available in the current version of Firefox ESR.

An alias for FF_90.

Inherited from

FeatureAll.FF_ESR


FF_PREV

FF_PREV: PredefinedFeature

Features available in the previous to current version of Firefox.

An alias for FF_134.

Inherited from

FeatureAll.FF_PREV


FF_SRC

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.

Remarks

Available in Firefox and Safari.

Inherited from

FeatureAll.FF_SRC


FLAT

FLAT: ElementaryFeature

Existence of the native function Array.prototype.flat.

Remarks

Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js.

Inherited from

FeatureAll.FLAT


FROM_CODE_POINT

FROM_CODE_POINT: ElementaryFeature

Existence of the function String.fromCodePoint.

Remarks

Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js.

Inherited from

FeatureAll.FROM_CODE_POINT


FUNCTION_19_LF

FUNCTION_19_LF: ElementaryFeature

A string representation of dynamically generated functions where the character at index 19 is a line feed ("\n").

Remarks

Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js.

Inherited from

FeatureAll.FUNCTION_19_LF


FUNCTION_22_LF

FUNCTION_22_LF: ElementaryFeature

A string representation of dynamically generated functions where the character at index 22 is a line feed ("\n").

Remarks

Available in Internet Explorer.

Inherited from

FeatureAll.FUNCTION_22_LF


IE_11

IE_11: PredefinedFeature

Features available in Internet Explorer 11.

Inherited from

FeatureAll.IE_11


IE_11_WIN_10

IE_11_WIN_10: PredefinedFeature

Features available in Internet Explorer 11 on Windows 10.

Inherited from

FeatureAll.IE_11_WIN_10


IE_11_WIN_7

IE_11_WIN_7: PredefinedFeature

Features available in Internet Explorer 11 on Windows 7.

Inherited from

FeatureAll.IE_11_WIN_7


IE_11_WIN_8

IE_11_WIN_8: PredefinedFeature

Features available in Internet Explorer 11 on Windows 8.

Inherited from

FeatureAll.IE_11_WIN_8


IE_SRC

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.

Remarks

Available in Internet Explorer.

Inherited from

FeatureAll.IE_SRC


INCR_CHAR

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.

Remarks

Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Node.js. This feature is not available when strict mode is enforced in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Node.js.

Inherited from

FeatureAll.INCR_CHAR


ITERATOR_HELPER

ITERATOR_HELPER: ElementaryFeature

Availability of iterator helpers having the string representation "[object Iterator Helper]".

Remarks

Available in Chrome, Edge, Firefox 131+, Safari 18.4+, Opera, and Node.js 22.0+.

Inherited from

FeatureAll.ITERATOR_HELPER


LOCALE_INFINITY

LOCALE_INFINITY: ElementaryFeature

Language sensitive string representation of Infinity as "∞".

Remarks

Available in Chrome, Edge, Firefox, Internet Explorer 11 on Windows 10, Safari, Opera, and Node.js.

Inherited from

FeatureAll.LOCALE_INFINITY


LOCALE_NUMERALS_BN

LOCALE_NUMERALS_BN: ElementaryFeature

Localized number formatting for Bengali.

Remarks

Available in Chrome, Edge, Firefox, Internet Explorer 11 on Windows 10, Safari before 18.4, Opera, and Node.js.

Inherited from

FeatureAll.LOCALE_NUMERALS_BN


LOCALE_NUMERALS_EXT

LOCALE_NUMERALS_EXT: ElementaryFeature

Extended localized number formatting.

Localized number formatting including the output of the first three letters in the second word of the Arabic string representation of NaN ("رقم"), the letters in the Russian string representation of NaN ("не число") and the letters in the Persian string representation of NaN ("ناعدد").

Remarks

Available in Chrome, Edge, Firefox, Internet Explorer 11 on Windows 10, Safari, Opera, and Node.js.

Inherited from

FeatureAll.LOCALE_NUMERALS_EXT


LOCALE_NUMERALS_IE11_WIN7

LOCALE_NUMERALS_IE11_WIN7: ElementaryFeature

Localized number formatting exclusive to Internet Explorer 11 on Windows 7.

Remarks

Available in Internet Explorer 11 on Windows 7.

Inherited from

FeatureAll.LOCALE_NUMERALS_IE11_WIN7


LOCALE_NUMERALS_IE11_WIN7_8

LOCALE_NUMERALS_IE11_WIN7_8: ElementaryFeature

Localized number formatting exclusive to Internet Explorer 11 on Windows 7 and 8.

Remarks

Available in Internet Explorer 11 on Windows 7 and on Windows 8.

Inherited from

FeatureAll.LOCALE_NUMERALS_IE11_WIN7_8


NAME

NAME: ElementaryFeature

Existence of the name property for functions.

Remarks

Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js.

Inherited from

FeatureAll.NAME


NO_FF_SRC

NO_FF_SRC: ElementaryFeature

A string representation of native functions typical for V8 or for Internet Explorer but not for Firefox and Safari.

Remarks

Available in Chrome, Edge, Internet Explorer, Opera, and Node.js.

Inherited from

FeatureAll.NO_FF_SRC


NO_IE_SRC

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.

Remarks

Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js.

Inherited from

FeatureAll.NO_IE_SRC


NO_V8_SRC

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.

Remarks

Available in Firefox, Internet Explorer, and Safari.

Inherited from

FeatureAll.NO_V8_SRC


NODE_20

NODE_20: PredefinedFeature

Features available in Node.js 20 to 21.

Inherited from

FeatureAll.NODE_20


NODE_22

NODE_22: PredefinedFeature

Features available in Node.js 22.0 to 22.11 and Node.js 23.0 to 23.2.

Inherited from

FeatureAll.NODE_22


NODE_22_12

NODE_22_12: PredefinedFeature

Features available in Node.js 22.12 to 22.14 and Node.js 23.3 or later.

Inherited from

FeatureAll.NODE_22_12


OBJECT_ARRAY_ENTRIES_CTOR

OBJECT_ARRAY_ENTRIES_CTOR: ElementaryFeature

The property that the Array.prototype.entries().constructor is the Object constructor.

Remarks

Available in Firefox before 131, Safari before 18.4, and Node.js before 22.0.

Inherited from

FeatureAll.OBJECT_ARRAY_ENTRIES_CTOR


OBJECT_W_SELF

OBJECT_W_SELF: ElementaryFeature

The property that the string representation of the global object self starts with "[object W".

Remarks

Available in Chrome, Edge, Firefox, Internet Explorer, Safari, and Opera. This feature is not available inside web workers in Chrome, Edge, Firefox, Safari, and Opera.

Inherited from

FeatureAll.OBJECT_W_SELF


PLAIN_INTL

PLAIN_INTL: ElementaryFeature

Existence of the global object Intl having the string representation "[object Object]".

Remarks

Available in Internet Explorer.

Inherited from

FeatureAll.PLAIN_INTL


REGEXP_STRING_ITERATOR

REGEXP_STRING_ITERATOR: ElementaryFeature

The property that the string representation of String.prototype.matchAll() evaluates to "[object RegExp String Iterator]".

Remarks

Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js.

Inherited from

FeatureAll.REGEXP_STRING_ITERATOR


RUSSIAN_INFINITY

RUSSIAN_INFINITY: ElementaryFeature

Russian string representation of Infinity as "∞".

Remarks

Available in Chrome, Edge, Firefox, Internet Explorer 11 on Windows 8 and on Windows 10, Safari, Opera, and Node.js.

Inherited from

FeatureAll.RUSSIAN_INFINITY


SAFARI

SAFARI: PredefinedFeature

Features available in the current stable version of Safari.

An alias for SAFARI_18_4.

Inherited from

FeatureAll.SAFARI


SAFARI_17_4

SAFARI_17_4: PredefinedFeature

Features available in Safari 17.4 to 17.6.

Remarks

This feature may be replaced or removed in the near future when current browser versions become obsolete. Use SAFARI_PRE_PREV instead of SAFARI_17_4 for long term support.

See

Engine Support Policy

Inherited from

FeatureAll.SAFARI_17_4


SAFARI_18_0

SAFARI_18_0: PredefinedFeature

Features available in Safari 18.0 to 18.3.

Remarks

This feature may be replaced or removed in the near future when current browser versions become obsolete.

See

Engine Support Policy

Inherited from

FeatureAll.SAFARI_18_0


SAFARI_18_4

SAFARI_18_4: PredefinedFeature

Features available in Safari 18.4 or later.

Remarks

This feature may be replaced or removed in the near future when current browser versions become obsolete. Use SAFARI or SAFARI_PREV instead of SAFARI_18_4 for long term support.

See

Engine Support Policy

Inherited from

FeatureAll.SAFARI_18_4


SAFARI_PRE_PREV

SAFARI_PRE_PREV: PredefinedFeature

Features available in the previous to previous version of Safari.

An alias for SAFARI_17_4.

Inherited from

FeatureAll.SAFARI_PRE_PREV


SAFARI_PREV

SAFARI_PREV: PredefinedFeature

Features available in the previous to current version of Safari.

An alias for SAFARI_18_4.

Inherited from

FeatureAll.SAFARI_PREV


SELF

SELF: ElementaryFeature

Existence of the global object self whose string representation starts with "[object ".

Remarks

Available in Chrome, Edge, Firefox, Internet Explorer, Safari, and Opera.

Inherited from

FeatureAll.SELF


SHORT_LOCALES

SHORT_LOCALES: ElementaryFeature

Support for the two-letter locale name "ar" to format decimal numbers as Arabic numerals.

Remarks

Available in Firefox before 134, Internet Explorer, Safari before 18.0, and Node.js before 22.12–22.14 and 23.3.

Inherited from

FeatureAll.SHORT_LOCALES


STATUS

STATUS: ElementaryFeature

Existence of the global string status.

Remarks

Available in Chrome, Edge, Firefox, Internet Explorer, Safari, and Opera. This feature is not available inside web workers.

Inherited from

FeatureAll.STATUS


V8_SRC

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.

Remarks

Available in Chrome, Edge, Opera, and Node.js.

Inherited from

FeatureAll.V8_SRC


WINDOW

WINDOW: ElementaryFeature

Existence of the global object self having the string representation "[object Window]".

Remarks

Available in Chrome, Edge, Firefox, Internet Explorer, Safari, and Opera. This feature is not available inside web workers.

Inherited from

FeatureAll.WINDOW

Methods

areCompatible()

areCompatible(...features): boolean

Determines whether the specified features are mutually compatible.

Parameters

features

...FeatureElement[]

Returns

boolean

true if the specified features are mutually compatible; otherwise, false. If less than two features are specified, the return value is true.

Example

// 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.FLAT)

areEqual()

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.

Parameters

features

...FeatureElementOrCompatibleArray[]

Returns

boolean

true if all of the specified features are equivalent; otherwise, false. If less than two arguments are specified, the return value is true.

Example

// false
JScrewIt.Feature.areEqual(JScrewIt.Feature.CHROME, JScrewIt.Feature.FF)
// true
JScrewIt.Feature.areEqual("DEFAULT", [])

commonOf()

commonOf(...features): CustomFeature | null

Creates a new feature object equivalent to the intersection of the specified features.

Parameters

features

...FeatureElementOrCompatibleArray[]

Returns

CustomFeature | null

A feature object, or null if no arguments are specified.

Example

The following declaration creates a new feature object equivalent to `NAME`.

const newFeature = JScrewIt.Feature.commonOf(["AT", "NAME"], ["NAME", "WINDOW"]);

The following declaration creates a new feature object equivalent to `NO_IE_SRC`. This is because both `FF_SRC` and `V8_SRC` imply `NO_IE_SRC`.

const newFeature = JScrewIt.Feature.commonOf("FF_SRC", "V8_SRC");

descriptionFor()

descriptionFor(name): string

Returns a short description of a predefined feature in plain English.

Parameters

name

keyof FeatureAll

A name or alias of a predefined feature.

Returns

string

Remarks

Different names or aliases of the same feature may have different descriptions.

Throws

An error is thrown if the specified argument is not a name or alias of a predefined feature.