1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
use super::*;
/// The HTMLPortalElement class.
/// [`HTMLPortalElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLPortalElement)
#[derive(Clone, Debug, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct HTMLPortalElement {
inner: HTMLElement,
}
impl FromVal for HTMLPortalElement {
fn from_val(v: &Any) -> Self {
HTMLPortalElement {
inner: HTMLElement::from_val(v),
}
}
fn take_ownership(v: AnyHandle) -> Self {
Self::from_val(&Any::take_ownership(v))
}
fn as_handle(&self) -> AnyHandle {
self.inner.as_handle()
}
}
impl core::ops::Deref for HTMLPortalElement {
type Target = HTMLElement;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl core::ops::DerefMut for HTMLPortalElement {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
impl AsRef<Any> for HTMLPortalElement {
fn as_ref(&self) -> &Any {
&self.inner
}
}
impl AsMut<Any> for HTMLPortalElement {
fn as_mut(&mut self) -> &mut Any {
&mut self.inner
}
}
impl From<HTMLPortalElement> for Any {
fn from(s: HTMLPortalElement) -> Any {
let handle = s.inner.as_handle();
core::mem::forget(s);
Any::take_ownership(handle)
}
}
impl From<&HTMLPortalElement> for Any {
fn from(s: &HTMLPortalElement) -> Any {
s.inner.clone().into()
}
}
jsbind::utils::impl_dyn_cast!(HTMLPortalElement);
impl HTMLPortalElement {
/// Getter of the `src` attribute.
/// [`HTMLPortalElement.src`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLPortalElement/src)
pub fn src(&self) -> JsString {
self.inner.get("src").as_::<JsString>()
}
/// Setter of the `src` attribute.
/// [`HTMLPortalElement.src`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLPortalElement/src)
pub fn set_src(&mut self, value: &JsString) {
self.inner.set("src", value);
}
}
impl HTMLPortalElement {
/// Getter of the `referrerPolicy` attribute.
/// [`HTMLPortalElement.referrerPolicy`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLPortalElement/referrerPolicy)
pub fn referrer_policy(&self) -> JsString {
self.inner.get("referrerPolicy").as_::<JsString>()
}
/// Setter of the `referrerPolicy` attribute.
/// [`HTMLPortalElement.referrerPolicy`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLPortalElement/referrerPolicy)
pub fn set_referrer_policy(&mut self, value: &JsString) {
self.inner.set("referrerPolicy", value);
}
}
impl HTMLPortalElement {
/// Getter of the `onmessage` attribute.
/// [`HTMLPortalElement.onmessage`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLPortalElement/onmessage)
pub fn onmessage(&self) -> Any {
self.inner.get("onmessage").as_::<Any>()
}
/// Setter of the `onmessage` attribute.
/// [`HTMLPortalElement.onmessage`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLPortalElement/onmessage)
pub fn set_onmessage(&mut self, value: &Any) {
self.inner.set("onmessage", value);
}
}
impl HTMLPortalElement {
/// Getter of the `onmessageerror` attribute.
/// [`HTMLPortalElement.onmessageerror`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLPortalElement/onmessageerror)
pub fn onmessageerror(&self) -> Any {
self.inner.get("onmessageerror").as_::<Any>()
}
/// Setter of the `onmessageerror` attribute.
/// [`HTMLPortalElement.onmessageerror`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLPortalElement/onmessageerror)
pub fn set_onmessageerror(&mut self, value: &Any) {
self.inner.set("onmessageerror", value);
}
}
impl HTMLPortalElement {
/// The `new HTMLPortalElement(..)` constructor, creating a new HTMLPortalElement instance
pub fn new() -> HTMLPortalElement {
Self {
inner: Any::global("HTMLPortalElement")
.new(&[])
.as_::<HTMLElement>(),
}
}
}
impl HTMLPortalElement {
/// The activate method.
/// [`HTMLPortalElement.activate`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLPortalElement/activate)
pub fn activate(&self) -> Promise<Undefined> {
self.inner.call("activate", &[]).as_::<Promise<Undefined>>()
}
}
impl HTMLPortalElement {
/// The activate method.
/// [`HTMLPortalElement.activate`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLPortalElement/activate)
pub fn activate_with_options(&self, options: &PortalActivateOptions) -> Promise<Undefined> {
self.inner
.call("activate", &[options.into()])
.as_::<Promise<Undefined>>()
}
}
impl HTMLPortalElement {
/// The postMessage method.
/// [`HTMLPortalElement.postMessage`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLPortalElement/postMessage)
pub fn post_message(&self, message: &Any) -> Undefined {
self.inner
.call("postMessage", &[message.into()])
.as_::<Undefined>()
}
}
impl HTMLPortalElement {
/// The postMessage method.
/// [`HTMLPortalElement.postMessage`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLPortalElement/postMessage)
pub fn post_message_with_options(
&self,
message: &Any,
options: &StructuredSerializeOptions,
) -> Undefined {
self.inner
.call("postMessage", &[message.into(), options.into()])
.as_::<Undefined>()
}
}