Skip to content

Commit c8d5b12

Browse files
committed
Be more spec compliant, and add links to the specs of the mixins HTMLOrSVGElement and TouchEventHandlers
1 parent 5c3180b commit c8d5b12

File tree

8 files changed

+53
-8
lines changed

8 files changed

+53
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Released 2024-10-10
3636

3737
### Added
3838

39-
* Added bindings for [MathML](https://www.w3.org/TR/MathML3/) elements and added support for the [`HTMLOrSVGElement`](https://html.spec.whatwg.org/#htmlorsvgelement) `mixin` (which is named `HTMLOrForeignElement` here), which is used for all interfaces deriving from `Element`.
39+
* Added bindings for [MathML](https://www.w3.org/TR/MathML3/) elements and added support for the [`HTMLOrSVGElement`](https://html.spec.whatwg.org/#htmlorsvgelement) `mixin`, which is used for all interfaces deriving from `Element`.
4040
[#4143](https://github.com/rustwasm/wasm-bindgen/pull/4143)
4141

4242
* Added support for implicit discriminants in enums.

crates/web-sys/src/features/gen_HtmlElement.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,6 +1463,20 @@ extern "C" {
14631463
#[doc = ""]
14641464
#[doc = "*This API requires the following crate features to be activated: `DomStringMap`, `HtmlElement`*"]
14651465
pub fn dataset(this: &HtmlElement) -> DomStringMap;
1466+
# [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = nonce)]
1467+
#[doc = "Getter for the `nonce` field of this object."]
1468+
#[doc = ""]
1469+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/nonce)"]
1470+
#[doc = ""]
1471+
#[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"]
1472+
pub fn nonce(this: &HtmlElement) -> String;
1473+
# [wasm_bindgen (structural , method , setter , js_class = "HTMLElement" , js_name = nonce)]
1474+
#[doc = "Setter for the `nonce` field of this object."]
1475+
#[doc = ""]
1476+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/nonce)"]
1477+
#[doc = ""]
1478+
#[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"]
1479+
pub fn set_nonce(this: &HtmlElement, value: &str);
14661480
# [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = autofocus)]
14671481
#[doc = "Getter for the `autofocus` field of this object."]
14681482
#[doc = ""]

crates/web-sys/src/features/gen_MathMlElement.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,20 @@ extern "C" {
11901190
#[doc = ""]
11911191
#[doc = "*This API requires the following crate features to be activated: `DomStringMap`, `MathMlElement`*"]
11921192
pub fn dataset(this: &MathMlElement) -> DomStringMap;
1193+
# [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = nonce)]
1194+
#[doc = "Getter for the `nonce` field of this object."]
1195+
#[doc = ""]
1196+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/nonce)"]
1197+
#[doc = ""]
1198+
#[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"]
1199+
pub fn nonce(this: &MathMlElement) -> String;
1200+
# [wasm_bindgen (structural , method , setter , js_class = "MathMLElement" , js_name = nonce)]
1201+
#[doc = "Setter for the `nonce` field of this object."]
1202+
#[doc = ""]
1203+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement/nonce)"]
1204+
#[doc = ""]
1205+
#[doc = "*This API requires the following crate features to be activated: `MathMlElement`*"]
1206+
pub fn set_nonce(this: &MathMlElement, value: &str);
11931207
# [wasm_bindgen (structural , method , getter , js_class = "MathMLElement" , js_name = autofocus)]
11941208
#[doc = "Getter for the `autofocus` field of this object."]
11951209
#[doc = ""]

crates/web-sys/src/features/gen_SvgElement.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,6 +1269,20 @@ extern "C" {
12691269
#[doc = ""]
12701270
#[doc = "*This API requires the following crate features to be activated: `DomStringMap`, `SvgElement`*"]
12711271
pub fn dataset(this: &SvgElement) -> DomStringMap;
1272+
# [wasm_bindgen (structural , method , getter , js_class = "SVGElement" , js_name = nonce)]
1273+
#[doc = "Getter for the `nonce` field of this object."]
1274+
#[doc = ""]
1275+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/nonce)"]
1276+
#[doc = ""]
1277+
#[doc = "*This API requires the following crate features to be activated: `SvgElement`*"]
1278+
pub fn nonce(this: &SvgElement) -> String;
1279+
# [wasm_bindgen (structural , method , setter , js_class = "SVGElement" , js_name = nonce)]
1280+
#[doc = "Setter for the `nonce` field of this object."]
1281+
#[doc = ""]
1282+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/nonce)"]
1283+
#[doc = ""]
1284+
#[doc = "*This API requires the following crate features to be activated: `SvgElement`*"]
1285+
pub fn set_nonce(this: &SvgElement, value: &str);
12721286
# [wasm_bindgen (structural , method , getter , js_class = "SVGElement" , js_name = autofocus)]
12731287
#[doc = "Getter for the `autofocus` field of this object."]
12741288
#[doc = ""]

crates/web-sys/webidls/enabled/Element.webidl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,14 @@ partial interface Element {
264264
undefined requestPointerLock();
265265
};
266266

267-
interface mixin HTMLOrForeignElement {
267+
// https://html.spec.whatwg.org/#htmlorsvgelement
268+
interface mixin HTMLOrSVGElement {
268269
[SameObject] readonly attribute DOMStringMap dataset;
269270

270-
[CEReactions, SetterThrows, Pure] attribute boolean autofocus;
271-
[CEReactions, SetterThrows, Pure] attribute long tabIndex;
272-
[Throws, NeedsCallerType] undefined focus(optional FocusOptions options = {});
271+
attribute DOMString nonce; // intentionally no [CEReactions]
272+
[CEReactions, SetterThrows] attribute boolean autofocus;
273+
[CEReactions, SetterThrows] attribute long tabIndex;
274+
[Throws] undefined focus(optional FocusOptions options = {});
273275
[Throws] undefined blur();
274276
};
275277

crates/web-sys/webidls/enabled/HTMLElement.webidl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ partial interface HTMLElement {
8787
readonly attribute long offsetHeight;
8888
};
8989

90+
// https://w3c.github.io/touch-events/#extensions-to-the-globaleventhandlers-mixin
9091
interface mixin TouchEventHandlers {
9192
[Func="nsGenericHTMLElement::TouchEventsEnabled"]
9293
attribute EventHandler ontouchstart;
@@ -98,7 +99,7 @@ interface mixin TouchEventHandlers {
9899
attribute EventHandler ontouchcancel;
99100
};
100101

101-
HTMLElement includes HTMLOrForeignElement;
102+
HTMLElement includes HTMLOrSVGElement;
102103
HTMLElement includes ElementCSSInlineStyle;
103104
HTMLElement includes GlobalEventHandlers;
104105
HTMLElement includes DocumentAndElementEventHandlers;

crates/web-sys/webidls/enabled/MathMLElement.webidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
[Exposed=Window]
1414
interface MathMLElement : Element { };
1515
MathMLElement includes GlobalEventHandlers;
16-
MathMLElement includes HTMLOrForeignElement;
16+
MathMLElement includes HTMLOrSVGElement;
1717
MathMLElement includes ElementCSSInlineStyle;
1818
MathMLElement includes TouchEventHandlers;
1919
MathMLElement includes OnErrorEventHandlerForNodes;

crates/web-sys/webidls/enabled/SVGElement.webidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface SVGElement : Element {
2020
readonly attribute SVGElement? viewportElement;
2121
};
2222

23-
SVGElement includes HTMLOrForeignElement;
23+
SVGElement includes HTMLOrSVGElement;
2424
SVGElement includes ElementCSSInlineStyle;
2525
SVGElement includes GlobalEventHandlers;
2626
SVGElement includes DocumentAndElementEventHandlers;

0 commit comments

Comments
 (0)