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
3 changes: 3 additions & 0 deletions files/en-us/mozilla/firefox/releases/150/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ Firefox 150 is the current [Beta version of Firefox](https://www.firefox.com/en-
This allows the method to return the node containing the caret from within a shadow DOM, provided its associated {{domxref("ShadowRoot")}} was passed as an option.
([Firefox bug 1914596](https://bugzil.la/1914596)).

- The {{domxref("CSSFontFaceDescriptors")}} interface is now supported, and an instance of this type is returned by the {{domxref("CSSFontFaceRule.style")}} property. ([Firefox bug 2019904](https://bugzil.la/2019904)).

- The non-standard {{domxref("Document/caretRangeFromPoint","caretRangeFromPoint()")}} method of the {{domxref("Document")}} interface is now supported. ([Firefox bug 1550635](https://bugzil.la/1550635)).

- The `ariaNotify()` method is now supported on {{domxref("Document/ariaNotify","Document")}} and {{domxref("Element/ariaNotify","Element")}}.
This queues a string of text to be announced by a {{glossary("screen reader")}}, providing a more ergonomic and reliable alternative to [ARIA live regions](/en-US/docs/Web/Accessibility/ARIA/Guides/Live_regions).
([Firefox bug 2018095](https://bugzil.la/2018095)).
Expand Down
47 changes: 44 additions & 3 deletions files/en-us/web/api/cssfontfacerule/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ _Inherits methods from its ancestor {{domxref("CSSRule")}}._

## Examples

This example uses the CSS found as an example on the {{cssxref("@font-face")}} page. The first {{domxref("CSSRule")}} returned will be a `CSSFontFaceRule`.
### Accessing @font-face properties

This example defines a {{cssxref("@font-face")}} rule and then iterates over the rules on the page until the associated `CSSFontFaceRule` is found.
It then logs some of the properties.

#### CSS

```css
@font-face {
Expand All @@ -36,11 +41,47 @@ This example uses the CSS found as an example on the {{cssxref("@font-face")}} p
}
```

```css hidden
#log {
height: 200px;
overflow: scroll;
padding: 0.5rem;
border: 1px solid black;
}
```

```html hidden
<pre id="log"></pre>
```

#### JavaScript

```js hidden
const logElement = document.querySelector("#log");
function log(text) {
logElement.innerText = `${logElement.innerText}${text}\n`;
logElement.scrollTop = logElement.scrollHeight;
}
```

```js
const myRules = document.styleSheets[0].cssRules;
console.log(myRules[0]); // A CSSFontFaceRule
const myRules = document.getElementById("css-output").sheet.cssRules;
for (const rule of myRules) {
if (rule instanceof CSSFontFaceRule) {
log(`this: ${rule}`);
log(` cssText: ${rule.cssText}`);
log(` parentRule: ${rule.parentRule}`);
log(` parentStyleSheet: ${rule.parentStyleSheet}`);
log(` type: ${rule.type}`);
log(` style: ${rule.style}`);
}
}
```

#### Result

{{EmbedLiveSample("Accessing @font-face properties", "100%", "250px")}}

## Specifications

{{Specifications}}
Expand Down
62 changes: 56 additions & 6 deletions files/en-us/web/api/cssfontfacerule/style/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,77 @@ The read-only **`style`** property of the {{domxref("CSSFontFaceRule")}} interfa

A {{domxref("CSSFontFaceDescriptors")}} object.

Although the `style` property itself is read-only in the sense that you can't replace the `CSSFontFaceDescriptors` object, you can still assign to the `style` property directly, which is equivalent to assigning to its {{domxref("CSSStyleDeclaration/cssText", "cssText")}} property. You can also modify the `CSSFontFaceDescriptors` object using the {{domxref("CSSStyleDeclaration/setProperty", "setProperty()")}} and {{domxref("CSSStyleDeclaration/removeProperty", "removeProperty()")}} methods.
Although the `style` property itself is read-only in the sense that you can't replace the `CSSFontFaceDescriptors` object, you can still assign to the `style` property directly, which is equivalent to assigning to its {{domxref("CSSStyleDeclaration/cssText", "cssText")}} property.
You can also modify the `CSSFontFaceDescriptors` object using the {{domxref("CSSStyleDeclaration/setProperty", "setProperty()")}} and {{domxref("CSSStyleDeclaration/removeProperty", "removeProperty()")}} methods.

## Examples

This example uses the CSS found as an example on the {{cssxref("@font-face")}} page. The first {{domxref("CSSRule")}} returned will be a `CSSFontFaceRule`. The `style` property returns a {{domxref("CSSFontFaceDescriptors")}} object with the properties `fontFamily`, `fontWeight`, and `src` populated with the information from the rule.
### Basic usage

This example defines a {{cssxref("@font-face")}} rule and then uses `CSSFontFaceDescriptors` to read back the descriptor values.

#### CSS

```css
@font-face {
font-family: "MyHelvetica";
src:
local("Helvetica Neue Bold"), local("HelveticaNeue-Bold"),
url("MgOpenModernaBold.woff2");
local("Helvetica Neue Bold"),
local("HelveticaNeue-Bold"),
url("MgOpenModernaBold.woff2") format("woff2");
font-weight: bold;
font-style: normal;
font-display: swap;
}
```

```css hidden
#log {
height: 200px;
overflow: scroll;
padding: 0.5rem;
border: 1px solid black;
}
```

```html hidden
<pre id="log"></pre>
```

```js hidden
const logElement = document.querySelector("#log");
function log(text) {
logElement.innerText = `${logElement.innerText}${text}\n`;
logElement.scrollTop = logElement.scrollHeight;
}
```

#### JavaScript

```js
const myRules = document.styleSheets[0].cssRules;
console.log(myRules[0].style); // A CSSFontFaceDescriptors
const myRules = document.getElementById("css-output").sheet.cssRules;
for (const rule of myRules) {
if (rule instanceof CSSFontFaceRule) {
const descriptors = rule.style;
if (descriptors instanceof CSSStyleDeclaration) {
log(`rule.style is a CSSStyleDeclaration.`);
} else {
log(`rule.style is a CSSFontFaceDescriptors.`);
}
log("Descriptors:");
log(` font-family: ${descriptors.fontFamily}`);
log(` src: ${descriptors.src}`);
log(` font-weight: ${descriptors["font-weight"]}`);
log(` font-style: ${descriptors.fontStyle}`);
log(` font-display: ${descriptors["font-display"]}`);
}
}
```

#### Result

{{EmbedLiveSample("Basic usage", "100%", "250px")}}

## Specifications

{{Specifications}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,5 +200,5 @@ pElem.addEventListener("dblclick", (event) => {

## See also

- {{domxref("css_custom_highlight_api", "The CSS Custom Highlight API", "", "nocode")}}
- {{domxref("css_custom_highlight_api", "CSS Custom Highlight API", "", "nocode")}}
- [CSS custom highlight API](/en-US/docs/Web/CSS/Guides/Custom_highlight_API) module
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function checkDeadlines() {
}
```

First we grab the current date and time by creating a blank `Date` object. The `Date` object has a number of methods to extract various parts of the date and time inside it. Here we fetch the current minutes (gives an easy numerical value), hours (gives an easy numerical value), day of the month (`getDate()` is needed for this, as `getDay()` returns the day of the week, 1-7), month (returns a number from 0-11, see below), and year (`getFullYear()` is needed; `getYear()` is deprecated, and returns a weird value that is not much use to anyone!)
First we grab the current date and time by creating a blank `Date` object. The `Date` object has a number of methods to extract various parts of the date and time inside it. Here we fetch the current minutes (gives an easy numerical value), hours (gives an easy numerical value), day of the month (`getDate()` is needed for this, as `getDay()` returns the day of the week, 0-6), month (returns a number from 0-11, see below), and year (`getFullYear()` is needed; `getYear()` is deprecated, and returns a weird value that is not much use to anyone!)

```js
function checkDeadlines() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :-moz-broken
title: "`:-moz-broken` CSS pseudo-class"
short-title: :-moz-broken
slug: Web/CSS/Reference/Selectors/:-moz-broken
page-type: css-pseudo-class
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :-moz-drag-over
title: "`:-moz-drag-over` CSS pseudo-class"
short-title: :-moz-drag-over
slug: Web/CSS/Reference/Selectors/:-moz-drag-over
page-type: css-pseudo-class
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :-moz-first-node
title: "`:-moz-first-node` CSS pseudo-class"
short-title: :-moz-first-node
slug: Web/CSS/Reference/Selectors/:-moz-first-node
page-type: css-pseudo-class
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :-moz-handler-blocked
title: "`:-moz-handler-blocked` CSS pseudo-class"
short-title: :-moz-handler-blocked
slug: Web/CSS/Reference/Selectors/:-moz-handler-blocked
page-type: css-pseudo-class
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :-moz-handler-crashed
title: "`:-moz-handler-crashed` CSS pseudo-class"
short-title: :-moz-handler-crashed
slug: Web/CSS/Reference/Selectors/:-moz-handler-crashed
page-type: css-pseudo-class
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :-moz-handler-disabled
title: "`:-moz-handler-disabled` CSS pseudo-class"
short-title: :-moz-handler-disabled
slug: Web/CSS/Reference/Selectors/:-moz-handler-disabled
page-type: css-pseudo-class
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :-moz-last-node
title: "`:-moz-last-node` CSS pseudo-class"
short-title: :-moz-last-node
slug: Web/CSS/Reference/Selectors/:-moz-last-node
page-type: css-pseudo-class
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :-moz-loading
title: "`:-moz-loading` CSS pseudo-class"
short-title: :-moz-loading
slug: Web/CSS/Reference/Selectors/:-moz-loading
page-type: css-pseudo-class
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :-moz-locale-dir(ltr)
title: "`:-moz-locale-dir(ltr)` CSS pseudo-class"
short-title: :-moz-locale-dir(ltr)
slug: Web/CSS/Reference/Selectors/:-moz-locale-dir_ltr
page-type: css-pseudo-class
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :-moz-locale-dir(rtl)
title: "`:-moz-locale-dir(rtl)` CSS pseudo-class"
short-title: :-moz-locale-dir(rtl)
slug: Web/CSS/Reference/Selectors/:-moz-locale-dir_rtl
page-type: css-pseudo-class
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :-moz-only-whitespace
title: "`:-moz-only-whitespace` CSS pseudo-class"
short-title: :-moz-only-whitespace
slug: Web/CSS/Reference/Selectors/:-moz-only-whitespace
page-type: css-pseudo-class
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :-moz-submit-invalid
title: "`:-moz-submit-invalid` CSS pseudo-class"
short-title: :-moz-submit-invalid
slug: Web/CSS/Reference/Selectors/:-moz-submit-invalid
page-type: css-pseudo-class
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :-moz-suppressed
title: "`:-moz-suppressed` CSS pseudo-class"
short-title: :-moz-suppressed
slug: Web/CSS/Reference/Selectors/:-moz-suppressed
page-type: css-pseudo-class
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :-moz-user-disabled
title: "`:-moz-user-disabled` CSS pseudo-class"
short-title: :-moz-user-disabled
slug: Web/CSS/Reference/Selectors/:-moz-user-disabled
page-type: css-pseudo-class
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :-moz-window-inactive
title: "`:-moz-window-inactive` CSS pseudo-class"
short-title: :-moz-window-inactive
slug: Web/CSS/Reference/Selectors/:-moz-window-inactive
page-type: css-pseudo-class
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :active-view-transition-type()
title: "`:active-view-transition-type()` CSS pseudo-class"
short-title: :active-view-transition-type()
slug: Web/CSS/Reference/Selectors/:active-view-transition-type
page-type: css-pseudo-class
browser-compat: css.selectors.active-view-transition-type
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :active-view-transition
title: "`:active-view-transition` CSS pseudo-class"
short-title: :active-view-transition
slug: Web/CSS/Reference/Selectors/:active-view-transition
page-type: css-pseudo-class
browser-compat: css.selectors.active-view-transition
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :active
title: "`:active` CSS pseudo-class"
short-title: :active
slug: Web/CSS/Reference/Selectors/:active
page-type: css-pseudo-class
browser-compat: css.selectors.active
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :any-link
title: "`:any-link` CSS pseudo-class"
short-title: :any-link
slug: Web/CSS/Reference/Selectors/:any-link
page-type: css-pseudo-class
browser-compat: css.selectors.any-link
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :autofill
title: "`:autofill` CSS pseudo-class"
short-title: :autofill
slug: Web/CSS/Reference/Selectors/:autofill
page-type: css-pseudo-class
browser-compat: css.selectors.autofill
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :blank
title: "`:blank` CSS pseudo-class"
short-title: :blank
slug: Web/CSS/Reference/Selectors/:blank
page-type: css-pseudo-class
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :buffering
title: "`:buffering` CSS pseudo-class"
short-title: :buffering
slug: Web/CSS/Reference/Selectors/:buffering
page-type: css-pseudo-class
browser-compat: css.selectors.buffering
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :checked
title: "`:checked` CSS pseudo-class"
short-title: :checked
slug: Web/CSS/Reference/Selectors/:checked
page-type: css-pseudo-class
browser-compat: css.selectors.checked
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :current
title: "`:current` CSS pseudo-class"
short-title: :current
slug: Web/CSS/Reference/Selectors/:current
page-type: css-pseudo-class
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :default
title: "`:default` CSS pseudo-class"
short-title: :default
slug: Web/CSS/Reference/Selectors/:default
page-type: css-pseudo-class
browser-compat: css.selectors.default
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :defined
title: "`:defined` CSS pseudo-class"
short-title: :defined
slug: Web/CSS/Reference/Selectors/:defined
page-type: css-pseudo-class
browser-compat: css.selectors.defined
Expand Down
3 changes: 2 additions & 1 deletion files/en-us/web/css/reference/selectors/_colon_dir/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :dir()
title: "`:dir()` CSS pseudo-class"
short-title: :dir()
slug: Web/CSS/Reference/Selectors/:dir
page-type: css-pseudo-class
browser-compat: css.selectors.dir
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: :disabled
title: "`:disabled` CSS pseudo-class"
short-title: :disabled
slug: Web/CSS/Reference/Selectors/:disabled
page-type: css-pseudo-class
browser-compat: css.selectors.disabled
Expand Down
Loading