Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions files/en-us/web/api/cssfontfeaturevaluesmap/clear/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
title: "CSSFontFeatureValuesMap: clear() method"
short-title: clear()
slug: Web/API/CSSFontFeatureValuesMap/clear
page-type: web-api-instance-method
browser-compat: api.CSSFontFeatureValuesMap.clear
---

{{APIRef("CSSOM")}}

The **`clear()`** method of the {{domxref("CSSFontFeatureValuesMap")}} interface removes all declarations in the `CSSFontFeatureValuesMap`.

## Syntax

```js-nolint
clear()
```

### Parameters

None.

### Return value

None ({{jsxref("undefined")}}).

## Examples

### Basic usage

The following example removes all the declarations within the [`@swash`](/en-US/docs/Web/CSS/Reference/At-rules/@font-feature-values#swash) feature block. This example is using `@swash` but also works with other [feature value blocks](/en-US/docs/Web/CSS/Reference/At-rules/@font-feature-values#feature_value_blocks).

#### CSS

```css
@font-feature-values "MonteCarlo" {
@swash {
swishy: 1;
swashy: 2;
}
}
```

#### JavaScript

```js
// get the rules
const myRule = document.styleSheets[0].cssRules[0];
console.log(myRule.swash.size); // logs 2
myRule.swash.clear();
console.log(myRule.swash.size); // logs 0
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- [Map.prototype.clear()](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/clear)
65 changes: 65 additions & 0 deletions files/en-us/web/api/cssfontfeaturevaluesmap/delete/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: "CSSFontFeatureValuesMap: delete() method"
short-title: delete()
slug: Web/API/CSSFontFeatureValuesMap/delete
page-type: web-api-instance-method
browser-compat: api.CSSFontFeatureValuesMap.delete
---

{{APIRef("CSSOM")}}

The **`delete()`** method of the {{domxref("CSSFontFeatureValuesMap")}} interface removes the CSS declaration with the given property in the `CSSFontFeatureValuesMap`.

## Syntax

```js-nolint
delete(property)
```

### Parameters

- `property`
- : An identifier indicating the declaration to remove.

### Return value

None ({{jsxref("undefined")}}).

## Examples

### Basic usage

The following example deletes the first declaration within the [`@swash`](/en-US/docs/Web/CSS/Reference/At-rules/@font-feature-values#swash) feature block. This example is using `@swash` but also works with other [feature value blocks](/en-US/docs/Web/CSS/Reference/At-rules/@font-feature-values#feature_value_blocks).

#### CSS

```css
@font-feature-values "MonteCarlo" {
@swash {
swishy: 1;
swashy: 2;
}
}
```

#### JavaScript

```js
// get the rules
const myRule = document.styleSheets[0].cssRules[0];
console.log(myRule.swash.has("swishy")); // logs true
myRule.swash.delete("swishy");
console.log(myRule.swash.has("swishy")); // logs false
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- [Map.prototype.delete()](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/delete)
65 changes: 65 additions & 0 deletions files/en-us/web/api/cssfontfeaturevaluesmap/entries/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: "CSSFontFeatureValuesMap: entries() method"
short-title: entries()
slug: Web/API/CSSFontFeatureValuesMap/entries
page-type: web-api-instance-method
browser-compat: api.CSSFontFeatureValuesMap.entries
---

{{APIRef("CSSOM")}}

The **`entries()`** method of {{domxref("CSSFontFeatureValuesMap")}} instances returns a new [map iterator](/en-US/docs/Web/API/CSSFontFeatureValuesMap/Symbol.iterator) object that contains the `[key, value]` pairs for each declaration in this `CSSFontFeatureValuesMap` in insertion order.

## Syntax

```js-nolint
entries()
```

### Parameters

None.

### Return value

A new iterable [iterator object](/en-US/docs/Web/API/CSSFontFeatureValuesMap/Symbol.iterator).

## Examples

### Basic usage

The following example assigns the entries to the `swashes` variable and then logs the first two values. This example is using `@swash` but also works with other [feature value blocks](/en-US/docs/Web/CSS/Reference/At-rules/@font-feature-values#feature_value_blocks).

#### CSS

```css
@font-feature-values "MonteCarlo" {
@swash {
swishy: 1;
swashy: 2;
}
}
```

#### JavaScript

```js
// get the rules
const myRule = document.styleSheets[0].cssRules[0];
// get the entries of swash
const swashes = myRule.swash.entries();
console.log(swashes.next().value); // logs ["swishy", [1]]
console.log(swashes.next().value); // logs ["swashy", [2]]
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- [Map.prototype.entries()](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries)
79 changes: 79 additions & 0 deletions files/en-us/web/api/cssfontfeaturevaluesmap/foreach/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
title: "CSSFontFeatureValuesMap: forEach() method"
short-title: forEach()
slug: Web/API/CSSFontFeatureValuesMap/forEach
page-type: web-api-instance-method
browser-compat: api.CSSFontFeatureValuesMap.forEach
---

{{APIRef("CSSOM")}}

The **`forEach()`** method of {{domxref("CSSFontFeatureValuesMap")}} instances executes a provided function once per each key/value pair in this map, in insertion order.

## Syntax

```js-nolint
forEach(callbackFn)
forEach(callbackFn, thisArg)
```

### Parameters

- `callbackFn`
- : A function to execute for each entry in the map. The function is called with the following arguments:
- `value`
- : Value of each iteration.
- `key`
- : Key of each iteration.
- `map`
- : The map being iterated.
- `thisArg` {{optional_inline}}
- : A value to use as `this` when executing `callbackFn`.

### Return value

None ({{jsxref("undefined")}}).

## Examples

### Basic usage

The following example logs the `key` and `value` for each entry in the `@swash` rule. This example is using `@swash` but also works with other [feature value blocks](/en-US/docs/Web/CSS/Reference/At-rules/@font-feature-values#feature_value_blocks).

#### CSS

```css
@font-feature-values "MonteCarlo" {
@swash {
swishy: 1;
swashy: 2;
}
}
```

#### JavaScript

```js
// function to be used as callback
function logSwashes(value, key, map) {
console.log(`('${key}') = ${value}`);
}
// get the rules
const myRule = document.styleSheets[0].cssRules[0];
myRule.swash.forEach(logSwashes);
// logs:
// "('swishy') = 1"
// "('swashy') = 2"
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- [Map.prototype.forEach()](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/forEach)
64 changes: 64 additions & 0 deletions files/en-us/web/api/cssfontfeaturevaluesmap/get/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
title: "CSSFontFeatureValuesMap: get() method"
short-title: get()
slug: Web/API/CSSFontFeatureValuesMap/get
page-type: web-api-instance-method
browser-compat: api.CSSFontFeatureValuesMap.get
---

{{APIRef("CSSOM")}}

The **`get()`** method of the {{domxref("CSSFontFeatureValuesMap")}} interface returns value corresponding to the key in this `CSSFontFeatureValuesMap`, or `undefined` if there is none.

## Syntax

```js-nolint
get(property)
```

### Parameters

- `key`
- : The key of the value to return from the `CSSFontFeatureValuesMap` object.

### Return value

Returns `true` if an entry with the specified key exists in the `CSSFontFeatureValuesMap` object; otherwise `false`.

## Examples

### Basic usage

The following example gets the values that match the `key`s in the `@swash` rule. This example is using `@swash` but also works with other [feature value blocks](/en-US/docs/Web/CSS/Reference/At-rules/@font-feature-values#feature_value_blocks).

#### CSS

```css
@font-feature-values "MonteCarlo" {
@swash {
swishy: 1;
swashy: 2;
}
}
```

#### JavaScript

```js
// get the rules
const myRule = document.styleSheets[0].cssRules[0];
console.log(myRule.swash.get("swishy")); // logs [1]
console.log(myRule.swash.get("swashy")); // logs [2]
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- [Map.prototype.get()](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get)
Loading