From c996ae2b79073ee4b1a7ff5ee7e5fa1d0eef02e6 Mon Sep 17 00:00:00 2001 From: Will <> Date: Wed, 14 Apr 2021 17:23:54 -0700 Subject: [PATCH] Remove inline styles from JS reference --- .../index.html | 444 +++++++++--------- .../en-us/web/javascript/eventloop/index.html | 2 +- .../details_of_the_object_model/index.html | 11 +- .../global_objects/function/apply/index.html | 35 -- .../reference/global_objects/math/index.html | 2 +- .../global_objects/math/log1p/index.html | 13 +- .../global_objects/regexp/exec/index.html | 21 +- .../web/javascript/typed_arrays/index.html | 4 +- 8 files changed, 251 insertions(+), 281 deletions(-) diff --git a/files/en-us/web/javascript/enumerability_and_ownership_of_properties/index.html b/files/en-us/web/javascript/enumerability_and_ownership_of_properties/index.html index 1cfefd670f2b39b..be078677454dc72 100644 --- a/files/en-us/web/javascript/enumerability_and_ownership_of_properties/index.html +++ b/files/en-us/web/javascript/enumerability_and_ownership_of_properties/index.html @@ -7,154 +7,154 @@ ---
{{JsSidebar("More")}}
-

Enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer (properties defined via Object.defineProperty and such default enumerable to false). Enumerable properties show up in for...in loops unless the property's key is a Symbol. Ownership of properties is determined by whether the property belongs to the object directly and not to its prototype chain. Properties of an object can also be retrieved in total. There are a number of built-in means of detecting, iterating/enumerating, and retrieving object properties, with the chart showing below which are available. Some sample code follows which demonstrates how to obtain the missing categories.

+

Enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer. Properties defined via Object.defineProperty and such default enumerable to false.

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - +
Property enumerability and ownership - built-in methods of detection, retrieval, and iteration
FunctionalityOwn objectOwn object and its prototype chainPrototype chain only
Detection - - - - - - - - - - - - - - - -
EnumerableNonenumerableEnumerable and Nonenumerable
-

propertyIsEnumerable

+

Enumerable properties show up in for...in loops unless the property's key is a Symbol. Ownership of properties is determined by whether the property belongs to the object directly and not to its prototype chain. Properties of an object can also be retrieved in total.

-

hasOwnProperty

-
-

hasOwnProperty – filtered to exclude enumerables using propertyIsEnumerable

-
hasOwnProperty
-
- - - - - - - - - - - - - - - -
EnumerableNonenumerableEnumerable and Nonenumerable
Not available without extra codeNot available without extra codein
-
Not available without extra code
Retrieval - - - - - - - - - - - - - - - -
EnumerableNonenumerableEnumerable and Nonenumerable
-

Object.keys

+

Detecting, retrieving, and enumerating object properties

-

getOwnPropertyNames 

+

There are a number of built-in means of detecting, iterating/enumerating, and retrieving object properties. These are summarized in the tables below.

-

getOwnPropertySymbols

-
getOwnPropertyNames, getOwnPropertySymbols – filtered to exclude enumerables using propertyIsEnumerable -

getOwnPropertyNames

+

Detection

-

getOwnPropertySymbols

-
-
Not available without extra codeNot available without extra code
Iterable - - - - - - - - - - - - - - - -
EnumerableNonenumerableEnumerable and Nonenumerable
-

Object.keys

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Own objectOwn object and prototype chainPrototype chain only
+ Enumerable + +

propertyIsEnumerable

+

hasOwnProperty

+
Not available without extra codeNot available without extra code
+ Nonenumerable + +

hasOwnProperty – filtered to exclude enumerables using propertyIsEnumerable

+
Not available without extra codeNot available without extra code
+ Enumerable and Nonenumerable + +

hasOwnProperty

+
inNot available without extra code
-

getOwnPropertyNames 

+

Retrieval

-

getOwnPropertySymbols

-
getOwnPropertyNames, getOwnPropertySymbols – filtered to exclude enumerables using propertyIsEnumerable -

getOwnPropertyNames

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Own objectOwn object and prototype chainPrototype chain only
+ Enumerable + +

Object.keys

+

getOwnPropertyNames 

+

getOwnPropertySymbols

+
Not available without extra codeNot available without extra code
+ Nonenumerable + getOwnPropertyNames, getOwnPropertySymbols – filtered to exclude enumerables using propertyIsEnumerableNot available without extra codeNot available without extra code
+ Enumerable and Nonenumerable + +

getOwnPropertyNames

+

getOwnPropertySymbols

+
Not available without extra codeNot available without extra code
-

getOwnPropertySymbols

-
-
- - - - - - - - - - - - - - - -
EnumerableNonenumerableEnumerable and Nonenumerable
-

for..in

+

Iteration

-

(excluding symbols)

-
Not available without extra codeNot available without extra code
-
Not available without extra code
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Own objectOwn object and prototype chainPrototype chain only
+ Enumerable + +

Object.keys

+

getOwnPropertyNames 

+

getOwnPropertySymbols

+
+

for..in

+

(excluding symbols)

+
Not available without extra code
+ Nonenumerable + getOwnPropertyNames, getOwnPropertySymbols – filtered to exclude enumerables using propertyIsEnumerableNot available without extra codeNot available without extra code
+ Enumerable and Nonenumerable + +

getOwnPropertyNames

+

getOwnPropertySymbols

+
Not available without extra codeNot available without extra code
-

Obtaining properties by enumerability/ownership

@@ -230,91 +230,93 @@

Obtaining properties by

Detection Table

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
infor..inobj.hasOwnPropertyobj.propertyIsEnumerableObject.keysObject.getOwnPropertyNamesObject.getOwnPropertyDescriptorsReflect.ownKeys()
Enumerabletruetruetruetruetruetruetruetrue
Nonenumerabletruefalsetruefalsefalsetruetruetrue
Symbols keystruefalsetruetruefalsefalsetruetrue
Inherited Enumerabletruetruefalsefalsefalsefalsefalsefalse
Inherited Nonenumerabletruefalsefalsefalsefalsefalsefalsefalse
Inherited Symbols keystruefalsefalsefalsefalsefalsefalsefalse
EnumerableNonenumerableSymbols keysInherited EnumerableInherited NonenumerableInherited Symbols keys
intruetruetruetruetruetrue
for..intruefalsefalsetruefalsefalse
obj.hasOwnPropertytruetruetruefalsefalsefalse
obj.propertyIsEnumerabletruefalsetruefalsefalsefalse
Object.keystruefalsefalsefalsefalsefalse
Object.getOwnPropertyNamestruetruefalsefalsefalsefalse
Object.getOwnPropertyDescriptorstruetruetruefalsefalsefalse
Reflect.ownKeys()truetruetruefalsefalsefalse
-

See also

diff --git a/files/en-us/web/javascript/eventloop/index.html b/files/en-us/web/javascript/eventloop/index.html index fcbc5b64ba0f98b..8fbb6a7f96b0932 100644 --- a/files/en-us/web/javascript/eventloop/index.html +++ b/files/en-us/web/javascript/eventloop/index.html @@ -21,7 +21,7 @@

Runtime concepts

Visual representation

-

Stack, heap, queue

+

Stack, heap, queue

Stack

diff --git a/files/en-us/web/javascript/guide/details_of_the_object_model/index.html b/files/en-us/web/javascript/guide/details_of_the_object_model/index.html index 77d0b870e9464d7..7c9ff561ce35799 100644 --- a/files/en-us/web/javascript/guide/details_of_the_object_model/index.html +++ b/files/en-us/web/javascript/guide/details_of_the_object_model/index.html @@ -100,14 +100,10 @@

The employee example

The remainder of this chapter uses the employee hierarchy shown in the following figure.

-
-
-

A simple object hierarchy with the following objects:

-

-
-
+

This shows an object hierarchy with the following objects:

+ -
-
+

Creating the hierarchy

diff --git a/files/en-us/web/javascript/reference/global_objects/function/apply/index.html b/files/en-us/web/javascript/reference/global_objects/function/apply/index.html index 945a18282f193b2..aa8e7758c41a43a 100644 --- a/files/en-us/web/javascript/reference/global_objects/function/apply/index.html +++ b/files/en-us/web/javascript/reference/global_objects/function/apply/index.html @@ -145,41 +145,6 @@

Using apply to chain constructors

-
-

Note: The Object.create() method used above is relatively new. For alternative methods, please consider one of the following approaches:

- -

Using {{jsxref("Object/proto", "Object.__proto__")}}:

- -
Function.prototype.construct = function (aArgs) {
-  let oNew = {};
-  oNew.__proto__ = this.prototype;
-  this.apply(oNew, aArgs);
-  return oNew;
-};
-
- -

Using closures:

- -
Function.prototype.construct = function(aArgs) {
-  let fConstructor = this, fNewConstr = function() {
-    fConstructor.apply(this, aArgs);
-  };
-  fNewConstr.prototype = fConstructor.prototype;
-  return new fNewConstr();
-};
- -

Using the {{jsxref("Function")}} constructor:

- -
Function.prototype.construct = function (aArgs) {
-  let fNewConstr = new Function("");
-  fNewConstr.prototype = this.prototype;
-  let oNew = new fNewConstr();
-  this.apply(oNew, aArgs);
-  return oNew;
-};
-
-
-

Example usage:

function MyConstructor() {
diff --git a/files/en-us/web/javascript/reference/global_objects/math/index.html b/files/en-us/web/javascript/reference/global_objects/math/index.html
index e6a2e083b0bc2a3..083563b4c9953ee 100644
--- a/files/en-us/web/javascript/reference/global_objects/math/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/math/index.html
@@ -139,7 +139,7 @@ 

Calculating the heigh

If we want to calculate the height of an equilateral triangle, and we know its side length is 100, we can use the formulae length of the adjacent multiplied by the tangent of the angle is equal to the opposite.

-

+

In JavaScript, we can do this with the following:

diff --git a/files/en-us/web/javascript/reference/global_objects/math/log1p/index.html b/files/en-us/web/javascript/reference/global_objects/math/log1p/index.html index 7e6d558cc541e55..04517d855bda7ed 100644 --- a/files/en-us/web/javascript/reference/global_objects/math/log1p/index.html +++ b/files/en-us/web/javascript/reference/global_objects/math/log1p/index.html @@ -71,15 +71,12 @@

Description

When you calculate log(1 + x), you should get an answer very close to x, if x is small (that's why these are called 'natural' logarithms).  If you calculate Math.log(1 + - 1.1111111111e-15) you should get an answer close to 1.1111111111e-15.  Instead, you will end up taking the logarithm of 1.00000000000000111022 (the roundoff is in binary so - sometimes it gets ugly), so you - get the answer 1.11022...e-15, with only  3 - correct digits.  If, instead, you calculate - Math.log1p(1.1111111111e-15) you will get a + 1.1111111111e-15) you should get an answer close to 1.1111111111e-15.  Instead, + you will end up taking the logarithm of 1.00000000000000111022 (the roundoff is in binary so + sometimes it gets ugly), so you get the answer 1.11022...e-15, with only  3 + correct digits.  If, instead, you calculate Math.log1p(1.1111111111e-15) you will get a much more accurate answer 1.1111111110999995e-15 with 15 correct digits of - precision (actually 16 in this case).

+ precision (actually 16 in this case).

If the value of x is less than -1, the return value is always {{jsxref("NaN")}}.

diff --git a/files/en-us/web/javascript/reference/global_objects/regexp/exec/index.html b/files/en-us/web/javascript/reference/global_objects/regexp/exec/index.html index 9245421f1dc1636..c322244b912f0da 100644 --- a/files/en-us/web/javascript/reference/global_objects/regexp/exec/index.html +++ b/files/en-us/web/javascript/reference/global_objects/regexp/exec/index.html @@ -67,12 +67,11 @@

Description

let result = re.exec('The Quick Brown Fox Jumps Over The Lazy Dog');
-

The following table shows the results for this script:

+

The following table shows the state of result after running this script:

- +
- @@ -80,7 +79,6 @@

Description

- @@ -128,8 +126,21 @@

Description

+ +
Object Property/Index Description Example
result [0] The full string of characters matched "Quick Brown Fox Jumps" The original string that was matched against. The Quick Brown Fox Jumps Over The Lazy Dog
+ +

The following table shows the state of re after running this script:

+ + + + + + + + + + - - + @@ -105,7 +105,7 @@

Typed array views

- +
Property/IndexDescriptionExample
re lastIndex

The index at which to start the next match.

diff --git a/files/en-us/web/javascript/typed_arrays/index.html b/files/en-us/web/javascript/typed_arrays/index.html index 4007eec172cf5ef..742f062002504bb 100644 --- a/files/en-us/web/javascript/typed_arrays/index.html +++ b/files/en-us/web/javascript/typed_arrays/index.html @@ -97,7 +97,7 @@

Typed array views

{{jsxref("Float32Array")}}1.2×10-38 to 3.4×10381.2×10-38 to 3.4×1038 4 32-bit IEEE floating point number (7 significant digits e.g., 1.123456) unrestricted float
{{jsxref("Float64Array")}}5.0×10-324 to 1.8×103085.0×10-324 to 1.8×10308 8 64-bit IEEE floating point number (16 significant digits e.g., 1.123...15) unrestricted double