-
Notifications
You must be signed in to change notification settings - Fork 22.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/SVGFEDropShadowElement
- Loading branch information
Showing
66 changed files
with
2,000 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ting_started/challenge_solutions/index.md → ..._web_development/core/challenges/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
title: "ShadowRoot: elementFromPoint() method" | ||
short-title: elementFromPoint() | ||
slug: Web/API/ShadowRoot/elementFromPoint | ||
page-type: web-api-instance-method | ||
browser-compat: api.ShadowRoot.elementFromPoint | ||
--- | ||
|
||
{{APIRef("DOM")}}{{Non-standard_Header}} | ||
|
||
The **`elementFromPoint()`** method, available on the {{domxref("ShadowRoot")}} object, returns the element at the topmost shadow root layer at the specified coordinates relative to the viewport (the shadow root highest in the display z-order, that is able to receive pointer events). Shadow root elements that have {{cssxref("pointer-events")}} set to `none` are ignored. | ||
|
||
If the specified point is outside the bounds of the shadow root, the result is `undefined`. | ||
|
||
## Syntax | ||
|
||
```js-nolint | ||
elementFromPoint(x, y) | ||
``` | ||
|
||
### Parameters | ||
|
||
- `x` | ||
- : The horizontal coordinate of a point, relative to the left edge of the current {{Glossary("viewport")}}. | ||
- `y` | ||
- : The vertical coordinate of a point, relative to the top edge of the current viewport. | ||
|
||
### Return value | ||
|
||
An {{domxref("Element")}}; the topmost shadow root element located at the specified coordinates, if any. | ||
|
||
## Examples | ||
|
||
In this example, assuming the existence of a {{htmlelement("template")}} in the HTML, we define a `<my-custom-element>`. If the appended custom element abuts the top-left corner of the viewport, or any portion of it overlaps that corner, the element that is the topmost layer at that point in the custom element will have a thin, dashed red border. | ||
|
||
```js | ||
customElements.define( | ||
"my-custom-element", | ||
class extends HTMLElement { | ||
constructor() { | ||
super(); | ||
const templateContent = document.getElementById( | ||
"my-custom-element-template", | ||
).content; | ||
const sRoot = this.attachShadow({ mode: "open" }); | ||
sRoot.appendChild(templateContent.cloneNode(true)); | ||
|
||
// get the topmost element in the top left corner of the viewport | ||
const srElement = this.shadowRoot.elementFromPoint(0, 0); | ||
// apply a border to that element | ||
srElement.style.border = "1px dashed red"; | ||
} | ||
}, | ||
); | ||
``` | ||
|
||
## Specifications | ||
|
||
Not part of any standard. | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- {{domxref("ShadowRoot.elementsFromPoint()")}} | ||
- {{domxref("Document.elementFromPoint()")}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
title: "ShadowRoot: elementsFromPoint() method" | ||
short-title: elementsFromPoint() | ||
slug: Web/API/ShadowRoot/elementsFromPoint | ||
page-type: web-api-instance-method | ||
browser-compat: api.ShadowRoot.elementsFromPoint | ||
--- | ||
|
||
{{APIRef("DOM")}}{{Non-standard_Header}} | ||
|
||
The **`elementsFromPoint()`** method of the {{domxref("ShadowRoot")}} interface returns an array of all the shadow root elements at the specified coordinates (relative to the viewport). The elements are ordered from the topmost element (highest in the display z-order), to the bottommost element. | ||
|
||
It operates in a similar way to the {{domxref("ShadowRoot.elementFromPoint")}} method. Some browsers return only the shadow root elements present at that location. Other browsers include elements outside of the [shadow DOM](/en-US/docs/Web/API/Web_components/Using_shadow_DOM), from the shadow DOM element in the topmost layer to the document root node, such as the {{htmlelement("html")}} or {{SVGElement("svg")}} root element. In these browsers, it operates similar to the {{domxref("Document.elementsFromPoint")}} method, but with the ability to cross the [shadow boundary](/en-US/docs/Glossary/Shadow_tree). | ||
|
||
## Syntax | ||
|
||
```js-nolint | ||
elementsFromPoint(x, y) | ||
``` | ||
|
||
### Parameters | ||
|
||
- `x` | ||
- : The horizontal coordinate of a point, relative to the left edge of the current {{Glossary("viewport")}}. | ||
- `y` | ||
- : The vertical coordinate of a point, relative to the top edge of the current viewport. | ||
|
||
### Return value | ||
|
||
An array of {{domxref('Element')}} objects. | ||
|
||
## Examples | ||
|
||
```js | ||
const customElem = document.querySelector("my-custom-element"); | ||
const shadow = customElem.shadowRoot; | ||
const elements = shadow.elementsFromPoint(20, 20); | ||
const msg = elements.map((el) => el.localName).join(" < "); | ||
if (msg) { | ||
console.log(msg); | ||
} else { | ||
console.log("The custom element had no descendants at x: 20, y: 20."); | ||
} | ||
``` | ||
|
||
If `<my-custom-element>` is near the top left corner of the viewport, and contains a single `<div>`, the above may return either of the following, depending on the browser implementation: | ||
|
||
```plain | ||
div | ||
div < my-custom-element < body < html | ||
``` | ||
|
||
## Specifications | ||
|
||
Not part of any standard. | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- {{DOMxRef("ShadowRoot.elementFromPoint()")}} | ||
- {{DOMxRef("Document.elementsFromPoint()")}} |
60 changes: 60 additions & 0 deletions
60
files/en-us/web/api/svgfeconvolvematrixelement/bias/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
title: "SVGFEConvolveMatrixElement: bias property" | ||
short-title: bias | ||
slug: Web/API/SVGFEConvolveMatrixElement/bias | ||
page-type: web-api-instance-property | ||
browser-compat: api.SVGFEConvolveMatrixElement.bias | ||
--- | ||
|
||
{{APIRef("SVG")}} | ||
|
||
The **`bias`** read-only property of the {{domxref("SVGFEConvolveMatrixElement")}} interface reflects the {{SVGAttr("bias")}} attribute of the given {{SVGElement("feConvolveMatrix")}} element. | ||
|
||
## Value | ||
|
||
An {{domxref("SVGAnimatedNumber")}} object. | ||
|
||
## Examples | ||
|
||
### Access the `bias` property | ||
|
||
The `bias` property is used to adjust the brightness of the output. | ||
|
||
```html | ||
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> | ||
<defs> | ||
<filter id="convolveFilterWithBias"> | ||
<feConvolveMatrix | ||
in="SourceGraphic" | ||
order="3" | ||
kernelMatrix="0 -1 0 -1 5 -1 0 -1 0" | ||
bias="0.25" /> | ||
</filter> | ||
</defs> | ||
<rect | ||
x="20" | ||
y="20" | ||
width="100" | ||
height="100" | ||
style="fill:lightblue;" | ||
filter="url(#convolveFilterWithBias)" /> | ||
</svg> | ||
``` | ||
|
||
```js | ||
const convolveMatrix = document.querySelector("feConvolveMatrix"); | ||
|
||
console.log(convolveMatrix.bias.baseVal); // Output: 0.25 | ||
``` | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- {{domxref("SVGAnimatedNumber")}} |
60 changes: 60 additions & 0 deletions
60
files/en-us/web/api/svgfeconvolvematrixelement/divisor/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
title: "SVGFEConvolveMatrixElement: divisor property" | ||
short-title: divisor | ||
slug: Web/API/SVGFEConvolveMatrixElement/divisor | ||
page-type: web-api-instance-property | ||
browser-compat: api.SVGFEConvolveMatrixElement.divisor | ||
--- | ||
|
||
{{APIRef("SVG")}} | ||
|
||
The **`divisor`** read-only property of the {{domxref("SVGFEConvolveMatrixElement")}} interface reflects the {{SVGAttr("divisor")}} attribute of the given {{SVGElement("feConvolveMatrix")}} element. | ||
|
||
## Value | ||
|
||
An {{domxref("SVGAnimatedNumber")}} object. | ||
|
||
## Examples | ||
|
||
### Access the `divisor` property | ||
|
||
A convolution filter is applied to a rectangle, and the `divisor` is used to control the brightness. | ||
|
||
```html | ||
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> | ||
<defs> | ||
<filter id="convolveFilterWithDivisor"> | ||
<feConvolveMatrix | ||
in="SourceGraphic" | ||
order="3" | ||
kernelMatrix="0 -1 0 -1 4 -1 0 -1 0" | ||
divisor="1" /> | ||
</filter> | ||
</defs> | ||
<rect | ||
x="20" | ||
y="20" | ||
width="100" | ||
height="100" | ||
style="fill:lightgreen;" | ||
filter="url(#convolveFilterWithDivisor)" /> | ||
</svg> | ||
``` | ||
|
||
```js | ||
const convolveMatrix = document.querySelector("feConvolveMatrix"); | ||
|
||
console.log(convolveMatrix.divisor.baseVal); // Output: 1 | ||
``` | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- {{domxref("SVGAnimatedNumber")}} |
Oops, something went wrong.