html/generated/
script.rs

1pub mod element {
2    /// The HTML `<script>` element
3    ///
4    /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
5    #[doc(alias = "script")]
6    #[non_exhaustive]
7    #[derive(PartialEq, Clone, Default)]
8    pub struct Script {
9        sys: html_sys::scripting::Script,
10        children: Vec<super::child::ScriptChild>,
11    }
12    impl Script {
13        /// Create a new builder
14        pub fn builder() -> super::builder::ScriptBuilder {
15            super::builder::ScriptBuilder::new(Default::default())
16        }
17    }
18    impl Script {
19        /// Access the element's `data-*` properties
20        pub fn data_map(&self) -> &html_sys::DataMap {
21            &self.sys.data_map
22        }
23        /// Mutably access the element's `data-*` properties
24        pub fn data_map_mut(&mut self) -> &mut html_sys::DataMap {
25            &mut self.sys.data_map
26        }
27    }
28    impl Script {
29        /// Get the value of the `src` attribute
30        pub fn src(&self) -> std::option::Option<&str> {
31            self.sys.src.as_deref()
32        }
33        /// Set the value of the `src` attribute
34        pub fn set_src(
35            &mut self,
36            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
37        ) {
38            self.sys.src = value.map(|v| v.into());
39        }
40        /// Get the value of the `type` attribute
41        pub fn type_(&self) -> std::option::Option<&str> {
42            self.sys.type_.as_deref()
43        }
44        /// Set the value of the `type` attribute
45        pub fn set_type_(
46            &mut self,
47            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
48        ) {
49            self.sys.type_ = value.map(|v| v.into());
50        }
51        /// Get the value of the `nomodule` attribute
52        pub fn nomodule(&self) -> std::option::Option<&str> {
53            self.sys.nomodule.as_deref()
54        }
55        /// Set the value of the `nomodule` attribute
56        pub fn set_nomodule(
57            &mut self,
58            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
59        ) {
60            self.sys.nomodule = value.map(|v| v.into());
61        }
62        /// Get the value of the `async` attribute
63        pub fn async_(&self) -> std::option::Option<&str> {
64            self.sys.async_.as_deref()
65        }
66        /// Set the value of the `async` attribute
67        pub fn set_async_(
68            &mut self,
69            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
70        ) {
71            self.sys.async_ = value.map(|v| v.into());
72        }
73        /// Get the value of the `defer` attribute
74        pub fn defer(&self) -> std::option::Option<&str> {
75            self.sys.defer.as_deref()
76        }
77        /// Set the value of the `defer` attribute
78        pub fn set_defer(
79            &mut self,
80            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
81        ) {
82            self.sys.defer = value.map(|v| v.into());
83        }
84        /// Get the value of the `crossorigin` attribute
85        pub fn crossorigin(&self) -> std::option::Option<&str> {
86            self.sys.crossorigin.as_deref()
87        }
88        /// Set the value of the `crossorigin` attribute
89        pub fn set_crossorigin(
90            &mut self,
91            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
92        ) {
93            self.sys.crossorigin = value.map(|v| v.into());
94        }
95        /// Get the value of the `integrity` attribute
96        pub fn integrity(&self) -> std::option::Option<&str> {
97            self.sys.integrity.as_deref()
98        }
99        /// Set the value of the `integrity` attribute
100        pub fn set_integrity(
101            &mut self,
102            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
103        ) {
104            self.sys.integrity = value.map(|v| v.into());
105        }
106        /// Get the value of the `referrerpolicy` attribute
107        pub fn referrerpolicy(&self) -> std::option::Option<&str> {
108            self.sys.referrerpolicy.as_deref()
109        }
110        /// Set the value of the `referrerpolicy` attribute
111        pub fn set_referrerpolicy(
112            &mut self,
113            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
114        ) {
115            self.sys.referrerpolicy = value.map(|v| v.into());
116        }
117        /// Get the value of the `blocking` attribute
118        pub fn blocking(&self) -> std::option::Option<&str> {
119            self.sys.blocking.as_deref()
120        }
121        /// Set the value of the `blocking` attribute
122        pub fn set_blocking(
123            &mut self,
124            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
125        ) {
126            self.sys.blocking = value.map(|v| v.into());
127        }
128        /// Get the value of the `fetchpriority` attribute
129        pub fn fetchpriority(&self) -> std::option::Option<&str> {
130            self.sys.fetchpriority.as_deref()
131        }
132        /// Set the value of the `fetchpriority` attribute
133        pub fn set_fetchpriority(
134            &mut self,
135            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
136        ) {
137            self.sys.fetchpriority = value.map(|v| v.into());
138        }
139        /// Get the value of the `accesskey` attribute
140        pub fn access_key(&self) -> std::option::Option<&str> {
141            self.sys.access_key.as_deref()
142        }
143        /// Set the value of the `accesskey` attribute
144        pub fn set_access_key(
145            &mut self,
146            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
147        ) {
148            self.sys.access_key = value.map(|v| v.into());
149        }
150        /// Get the value of the `autocapitalize` attribute
151        pub fn auto_capitalize(&self) -> std::option::Option<&str> {
152            self.sys.auto_capitalize.as_deref()
153        }
154        /// Set the value of the `autocapitalize` attribute
155        pub fn set_auto_capitalize(
156            &mut self,
157            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
158        ) {
159            self.sys.auto_capitalize = value.map(|v| v.into());
160        }
161        /// Get the value of the `autofocus` attribute
162        pub fn autofocus(&self) -> bool {
163            self.sys.autofocus
164        }
165        /// Set the value of the `autofocus` attribute
166        pub fn set_autofocus(&mut self, value: bool) {
167            self.sys.autofocus = value;
168        }
169        /// Get the value of the `class` attribute
170        pub fn class(&self) -> std::option::Option<&str> {
171            self.sys.class.as_deref()
172        }
173        /// Set the value of the `class` attribute
174        pub fn set_class(
175            &mut self,
176            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
177        ) {
178            self.sys.class = value.map(|v| v.into());
179        }
180        /// Get the value of the `contenteditable` attribute
181        pub fn content_editable(&self) -> std::option::Option<&str> {
182            self.sys.content_editable.as_deref()
183        }
184        /// Set the value of the `contenteditable` attribute
185        pub fn set_content_editable(
186            &mut self,
187            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
188        ) {
189            self.sys.content_editable = value.map(|v| v.into());
190        }
191        /// Get the value of the `dir` attribute
192        pub fn direction(&self) -> std::option::Option<&str> {
193            self.sys.direction.as_deref()
194        }
195        /// Set the value of the `dir` attribute
196        pub fn set_direction(
197            &mut self,
198            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
199        ) {
200            self.sys.direction = value.map(|v| v.into());
201        }
202        /// Get the value of the `draggable` attribute
203        pub fn draggable(&self) -> bool {
204            self.sys.draggable
205        }
206        /// Set the value of the `draggable` attribute
207        pub fn set_draggable(&mut self, value: bool) {
208            self.sys.draggable = value;
209        }
210        /// Get the value of the `enterkeyhint` attribute
211        pub fn enter_key_hint(&self) -> std::option::Option<&str> {
212            self.sys.enter_key_hint.as_deref()
213        }
214        /// Set the value of the `enterkeyhint` attribute
215        pub fn set_enter_key_hint(
216            &mut self,
217            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
218        ) {
219            self.sys.enter_key_hint = value.map(|v| v.into());
220        }
221        /// Get the value of the `exportparts` attribute
222        pub fn export_parts(&self) -> std::option::Option<&str> {
223            self.sys.export_parts.as_deref()
224        }
225        /// Set the value of the `exportparts` attribute
226        pub fn set_export_parts(
227            &mut self,
228            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
229        ) {
230            self.sys.export_parts = value.map(|v| v.into());
231        }
232        /// Get the value of the `hidden` attribute
233        pub fn hidden(&self) -> std::option::Option<&str> {
234            self.sys.hidden.as_deref()
235        }
236        /// Set the value of the `hidden` attribute
237        pub fn set_hidden(
238            &mut self,
239            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
240        ) {
241            self.sys.hidden = value.map(|v| v.into());
242        }
243        /// Get the value of the `id` attribute
244        pub fn id(&self) -> std::option::Option<&str> {
245            self.sys.id.as_deref()
246        }
247        /// Set the value of the `id` attribute
248        pub fn set_id(
249            &mut self,
250            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
251        ) {
252            self.sys.id = value.map(|v| v.into());
253        }
254        /// Get the value of the `inert` attribute
255        pub fn inert(&self) -> bool {
256            self.sys.inert
257        }
258        /// Set the value of the `inert` attribute
259        pub fn set_inert(&mut self, value: bool) {
260            self.sys.inert = value;
261        }
262        /// Get the value of the `inputmode` attribute
263        pub fn input_mode(&self) -> std::option::Option<&str> {
264            self.sys.input_mode.as_deref()
265        }
266        /// Set the value of the `inputmode` attribute
267        pub fn set_input_mode(
268            &mut self,
269            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
270        ) {
271            self.sys.input_mode = value.map(|v| v.into());
272        }
273        /// Get the value of the `is` attribute
274        pub fn is_(&self) -> std::option::Option<&str> {
275            self.sys.is_.as_deref()
276        }
277        /// Set the value of the `is` attribute
278        pub fn set_is_(
279            &mut self,
280            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
281        ) {
282            self.sys.is_ = value.map(|v| v.into());
283        }
284        /// Get the value of the `itemid` attribute
285        pub fn item_id(&self) -> std::option::Option<&str> {
286            self.sys.item_id.as_deref()
287        }
288        /// Set the value of the `itemid` attribute
289        pub fn set_item_id(
290            &mut self,
291            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
292        ) {
293            self.sys.item_id = value.map(|v| v.into());
294        }
295        /// Get the value of the `itemprop` attribute
296        pub fn item_prop(&self) -> std::option::Option<&str> {
297            self.sys.item_prop.as_deref()
298        }
299        /// Set the value of the `itemprop` attribute
300        pub fn set_item_prop(
301            &mut self,
302            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
303        ) {
304            self.sys.item_prop = value.map(|v| v.into());
305        }
306        /// Get the value of the `itemref` attribute
307        pub fn item_ref(&self) -> std::option::Option<&str> {
308            self.sys.item_ref.as_deref()
309        }
310        /// Set the value of the `itemref` attribute
311        pub fn set_item_ref(
312            &mut self,
313            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
314        ) {
315            self.sys.item_ref = value.map(|v| v.into());
316        }
317        /// Get the value of the `itemscope` attribute
318        pub fn item_scope(&self) -> std::option::Option<&str> {
319            self.sys.item_scope.as_deref()
320        }
321        /// Set the value of the `itemscope` attribute
322        pub fn set_item_scope(
323            &mut self,
324            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
325        ) {
326            self.sys.item_scope = value.map(|v| v.into());
327        }
328        /// Get the value of the `itemtype` attribute
329        pub fn item_type(&self) -> std::option::Option<&str> {
330            self.sys.item_type.as_deref()
331        }
332        /// Set the value of the `itemtype` attribute
333        pub fn set_item_type(
334            &mut self,
335            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
336        ) {
337            self.sys.item_type = value.map(|v| v.into());
338        }
339        /// Get the value of the `lang` attribute
340        pub fn lang(&self) -> std::option::Option<&str> {
341            self.sys.lang.as_deref()
342        }
343        /// Set the value of the `lang` attribute
344        pub fn set_lang(
345            &mut self,
346            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
347        ) {
348            self.sys.lang = value.map(|v| v.into());
349        }
350        /// Get the value of the `nonce` attribute
351        pub fn nonce(&self) -> std::option::Option<&str> {
352            self.sys.nonce.as_deref()
353        }
354        /// Set the value of the `nonce` attribute
355        pub fn set_nonce(
356            &mut self,
357            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
358        ) {
359            self.sys.nonce = value.map(|v| v.into());
360        }
361        /// Get the value of the `part` attribute
362        pub fn part(&self) -> std::option::Option<&str> {
363            self.sys.part.as_deref()
364        }
365        /// Set the value of the `part` attribute
366        pub fn set_part(
367            &mut self,
368            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
369        ) {
370            self.sys.part = value.map(|v| v.into());
371        }
372        /// Get the value of the `slot` attribute
373        pub fn slot(&self) -> std::option::Option<&str> {
374            self.sys.slot.as_deref()
375        }
376        /// Set the value of the `slot` attribute
377        pub fn set_slot(
378            &mut self,
379            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
380        ) {
381            self.sys.slot = value.map(|v| v.into());
382        }
383        /// Get the value of the `spellcheck` attribute
384        pub fn spellcheck(&self) -> std::option::Option<&str> {
385            self.sys.spellcheck.as_deref()
386        }
387        /// Set the value of the `spellcheck` attribute
388        pub fn set_spellcheck(
389            &mut self,
390            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
391        ) {
392            self.sys.spellcheck = value.map(|v| v.into());
393        }
394        /// Get the value of the `style` attribute
395        pub fn style(&self) -> std::option::Option<&str> {
396            self.sys.style.as_deref()
397        }
398        /// Set the value of the `style` attribute
399        pub fn set_style(
400            &mut self,
401            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
402        ) {
403            self.sys.style = value.map(|v| v.into());
404        }
405        /// Get the value of the `tabindex` attribute
406        pub fn tab_index(&self) -> std::option::Option<i64> {
407            self.sys.tab_index
408        }
409        /// Set the value of the `tabindex` attribute
410        pub fn set_tab_index(&mut self, value: std::option::Option<i64>) {
411            self.sys.tab_index = value;
412        }
413        /// Get the value of the `title` attribute
414        pub fn title(&self) -> std::option::Option<&str> {
415            self.sys.title.as_deref()
416        }
417        /// Set the value of the `title` attribute
418        pub fn set_title(
419            &mut self,
420            value: std::option::Option<impl Into<std::borrow::Cow<'static, str>>>,
421        ) {
422            self.sys.title = value.map(|v| v.into());
423        }
424        /// Get the value of the `translate` attribute
425        pub fn translate(&self) -> bool {
426            self.sys.translate
427        }
428        /// Set the value of the `translate` attribute
429        pub fn set_translate(&mut self, value: bool) {
430            self.sys.translate = value;
431        }
432    }
433    impl Script {
434        /// Access the element's children
435        pub fn children(&self) -> &[super::child::ScriptChild] {
436            self.children.as_ref()
437        }
438        /// Mutably access the element's children
439        pub fn children_mut(&mut self) -> &mut Vec<super::child::ScriptChild> {
440            &mut self.children
441        }
442    }
443    impl crate::Render for Script {
444        fn render(
445            &self,
446            f: &mut std::fmt::Formatter<'_>,
447            depth: usize,
448        ) -> std::fmt::Result {
449            write!(f, "{:level$}", "", level = depth * 4)?;
450            html_sys::RenderElement::write_opening_tag(&self.sys, f)?;
451            if !self.children.is_empty() {
452                write!(f, "\n")?;
453            }
454            for el in &self.children {
455                crate::Render::render(&el, f, depth)?;
456                write!(f, "\n")?;
457            }
458            write!(f, "{:level$}", "", level = depth * 4)?;
459            html_sys::RenderElement::write_closing_tag(&self.sys, f)?;
460            Ok(())
461        }
462    }
463    impl std::fmt::Debug for Script {
464        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
465            crate::Render::render(self, f, 0)?;
466            Ok(())
467        }
468    }
469    impl std::fmt::Display for Script {
470        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
471            html_sys::RenderElement::write_opening_tag(&self.sys, f)?;
472            for el in &self.children {
473                write!(f, "{el}")?;
474            }
475            html_sys::RenderElement::write_closing_tag(&self.sys, f)?;
476            Ok(())
477        }
478    }
479    impl crate::HtmlElement for Script {}
480    impl crate::MetadataContent for Script {}
481    impl crate::FlowContent for Script {}
482    impl crate::PhrasingContent for Script {}
483    impl crate::ScriptSupportingContent for Script {}
484    impl std::convert::Into<html_sys::scripting::Script> for Script {
485        fn into(self) -> html_sys::scripting::Script {
486            self.sys
487        }
488    }
489    impl From<html_sys::scripting::Script> for Script {
490        fn from(sys: html_sys::scripting::Script) -> Self {
491            Self { sys, children: vec![] }
492        }
493    }
494}
495pub mod child {
496    /// The permitted child items for the `Script` element
497    #[derive(PartialEq, Clone)]
498    pub enum ScriptChild {
499        /// The Text element
500        Text(std::borrow::Cow<'static, str>),
501    }
502    impl std::convert::From<std::borrow::Cow<'static, str>> for ScriptChild {
503        fn from(value: std::borrow::Cow<'static, str>) -> Self {
504            Self::Text(value)
505        }
506    }
507    impl std::convert::From<&'static str> for ScriptChild {
508        fn from(value: &'static str) -> Self {
509            Self::Text(value.into())
510        }
511    }
512    impl std::convert::From<String> for ScriptChild {
513        fn from(value: String) -> Self {
514            Self::Text(value.into())
515        }
516    }
517    impl crate::Render for ScriptChild {
518        fn render(
519            &self,
520            f: &mut std::fmt::Formatter<'_>,
521            depth: usize,
522        ) -> std::fmt::Result {
523            match self {
524                Self::Text(el) => crate::Render::render(el, f, depth + 1),
525            }
526        }
527    }
528    impl std::fmt::Debug for ScriptChild {
529        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
530            crate::Render::render(self, f, 0)?;
531            Ok(())
532        }
533    }
534    impl std::fmt::Display for ScriptChild {
535        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
536            match self {
537                Self::Text(el) => write!(f, "{el}"),
538            }
539        }
540    }
541}
542pub mod builder {
543    /// A builder struct for Script
544    pub struct ScriptBuilder {
545        element: super::element::Script,
546    }
547    impl ScriptBuilder {
548        pub(crate) fn new(element: super::element::Script) -> Self {
549            Self { element }
550        }
551        /// Finish building the element
552        pub fn build(&mut self) -> super::element::Script {
553            self.element.clone()
554        }
555        /// Insert a `data-*` property
556        pub fn data(
557            &mut self,
558            data_key: impl Into<std::borrow::Cow<'static, str>>,
559            value: impl Into<std::borrow::Cow<'static, str>>,
560        ) -> &mut ScriptBuilder {
561            self.element.data_map_mut().insert(data_key.into(), value.into());
562            self
563        }
564        /// Append a new text element.
565        pub fn text(
566            &mut self,
567            s: impl Into<std::borrow::Cow<'static, str>>,
568        ) -> &mut Self {
569            let cow = s.into();
570            self.element.children_mut().push(cow.into());
571            self
572        }
573        /// Set the value of the `src` attribute
574        pub fn src(
575            &mut self,
576            value: impl Into<std::borrow::Cow<'static, str>>,
577        ) -> &mut Self {
578            self.element.set_src(Some(value.into()));
579            self
580        }
581        /// Set the value of the `type` attribute
582        pub fn type_(
583            &mut self,
584            value: impl Into<std::borrow::Cow<'static, str>>,
585        ) -> &mut Self {
586            self.element.set_type_(Some(value.into()));
587            self
588        }
589        /// Set the value of the `nomodule` attribute
590        pub fn nomodule(
591            &mut self,
592            value: impl Into<std::borrow::Cow<'static, str>>,
593        ) -> &mut Self {
594            self.element.set_nomodule(Some(value.into()));
595            self
596        }
597        /// Set the value of the `async` attribute
598        pub fn async_(
599            &mut self,
600            value: impl Into<std::borrow::Cow<'static, str>>,
601        ) -> &mut Self {
602            self.element.set_async_(Some(value.into()));
603            self
604        }
605        /// Set the value of the `defer` attribute
606        pub fn defer(
607            &mut self,
608            value: impl Into<std::borrow::Cow<'static, str>>,
609        ) -> &mut Self {
610            self.element.set_defer(Some(value.into()));
611            self
612        }
613        /// Set the value of the `crossorigin` attribute
614        pub fn crossorigin(
615            &mut self,
616            value: impl Into<std::borrow::Cow<'static, str>>,
617        ) -> &mut Self {
618            self.element.set_crossorigin(Some(value.into()));
619            self
620        }
621        /// Set the value of the `integrity` attribute
622        pub fn integrity(
623            &mut self,
624            value: impl Into<std::borrow::Cow<'static, str>>,
625        ) -> &mut Self {
626            self.element.set_integrity(Some(value.into()));
627            self
628        }
629        /// Set the value of the `referrerpolicy` attribute
630        pub fn referrerpolicy(
631            &mut self,
632            value: impl Into<std::borrow::Cow<'static, str>>,
633        ) -> &mut Self {
634            self.element.set_referrerpolicy(Some(value.into()));
635            self
636        }
637        /// Set the value of the `blocking` attribute
638        pub fn blocking(
639            &mut self,
640            value: impl Into<std::borrow::Cow<'static, str>>,
641        ) -> &mut Self {
642            self.element.set_blocking(Some(value.into()));
643            self
644        }
645        /// Set the value of the `fetchpriority` attribute
646        pub fn fetchpriority(
647            &mut self,
648            value: impl Into<std::borrow::Cow<'static, str>>,
649        ) -> &mut Self {
650            self.element.set_fetchpriority(Some(value.into()));
651            self
652        }
653        /// Set the value of the `accesskey` attribute
654        pub fn access_key(
655            &mut self,
656            value: impl Into<std::borrow::Cow<'static, str>>,
657        ) -> &mut Self {
658            self.element.set_access_key(Some(value.into()));
659            self
660        }
661        /// Set the value of the `autocapitalize` attribute
662        pub fn auto_capitalize(
663            &mut self,
664            value: impl Into<std::borrow::Cow<'static, str>>,
665        ) -> &mut Self {
666            self.element.set_auto_capitalize(Some(value.into()));
667            self
668        }
669        /// Set the value of the `autofocus` attribute
670        pub fn autofocus(&mut self, value: bool) -> &mut Self {
671            self.element.set_autofocus(value);
672            self
673        }
674        /// Set the value of the `class` attribute
675        pub fn class(
676            &mut self,
677            value: impl Into<std::borrow::Cow<'static, str>>,
678        ) -> &mut Self {
679            self.element.set_class(Some(value.into()));
680            self
681        }
682        /// Set the value of the `contenteditable` attribute
683        pub fn content_editable(
684            &mut self,
685            value: impl Into<std::borrow::Cow<'static, str>>,
686        ) -> &mut Self {
687            self.element.set_content_editable(Some(value.into()));
688            self
689        }
690        /// Set the value of the `dir` attribute
691        pub fn direction(
692            &mut self,
693            value: impl Into<std::borrow::Cow<'static, str>>,
694        ) -> &mut Self {
695            self.element.set_direction(Some(value.into()));
696            self
697        }
698        /// Set the value of the `draggable` attribute
699        pub fn draggable(&mut self, value: bool) -> &mut Self {
700            self.element.set_draggable(value);
701            self
702        }
703        /// Set the value of the `enterkeyhint` attribute
704        pub fn enter_key_hint(
705            &mut self,
706            value: impl Into<std::borrow::Cow<'static, str>>,
707        ) -> &mut Self {
708            self.element.set_enter_key_hint(Some(value.into()));
709            self
710        }
711        /// Set the value of the `exportparts` attribute
712        pub fn export_parts(
713            &mut self,
714            value: impl Into<std::borrow::Cow<'static, str>>,
715        ) -> &mut Self {
716            self.element.set_export_parts(Some(value.into()));
717            self
718        }
719        /// Set the value of the `hidden` attribute
720        pub fn hidden(
721            &mut self,
722            value: impl Into<std::borrow::Cow<'static, str>>,
723        ) -> &mut Self {
724            self.element.set_hidden(Some(value.into()));
725            self
726        }
727        /// Set the value of the `id` attribute
728        pub fn id(
729            &mut self,
730            value: impl Into<std::borrow::Cow<'static, str>>,
731        ) -> &mut Self {
732            self.element.set_id(Some(value.into()));
733            self
734        }
735        /// Set the value of the `inert` attribute
736        pub fn inert(&mut self, value: bool) -> &mut Self {
737            self.element.set_inert(value);
738            self
739        }
740        /// Set the value of the `inputmode` attribute
741        pub fn input_mode(
742            &mut self,
743            value: impl Into<std::borrow::Cow<'static, str>>,
744        ) -> &mut Self {
745            self.element.set_input_mode(Some(value.into()));
746            self
747        }
748        /// Set the value of the `is` attribute
749        pub fn is_(
750            &mut self,
751            value: impl Into<std::borrow::Cow<'static, str>>,
752        ) -> &mut Self {
753            self.element.set_is_(Some(value.into()));
754            self
755        }
756        /// Set the value of the `itemid` attribute
757        pub fn item_id(
758            &mut self,
759            value: impl Into<std::borrow::Cow<'static, str>>,
760        ) -> &mut Self {
761            self.element.set_item_id(Some(value.into()));
762            self
763        }
764        /// Set the value of the `itemprop` attribute
765        pub fn item_prop(
766            &mut self,
767            value: impl Into<std::borrow::Cow<'static, str>>,
768        ) -> &mut Self {
769            self.element.set_item_prop(Some(value.into()));
770            self
771        }
772        /// Set the value of the `itemref` attribute
773        pub fn item_ref(
774            &mut self,
775            value: impl Into<std::borrow::Cow<'static, str>>,
776        ) -> &mut Self {
777            self.element.set_item_ref(Some(value.into()));
778            self
779        }
780        /// Set the value of the `itemscope` attribute
781        pub fn item_scope(
782            &mut self,
783            value: impl Into<std::borrow::Cow<'static, str>>,
784        ) -> &mut Self {
785            self.element.set_item_scope(Some(value.into()));
786            self
787        }
788        /// Set the value of the `itemtype` attribute
789        pub fn item_type(
790            &mut self,
791            value: impl Into<std::borrow::Cow<'static, str>>,
792        ) -> &mut Self {
793            self.element.set_item_type(Some(value.into()));
794            self
795        }
796        /// Set the value of the `lang` attribute
797        pub fn lang(
798            &mut self,
799            value: impl Into<std::borrow::Cow<'static, str>>,
800        ) -> &mut Self {
801            self.element.set_lang(Some(value.into()));
802            self
803        }
804        /// Set the value of the `nonce` attribute
805        pub fn nonce(
806            &mut self,
807            value: impl Into<std::borrow::Cow<'static, str>>,
808        ) -> &mut Self {
809            self.element.set_nonce(Some(value.into()));
810            self
811        }
812        /// Set the value of the `part` attribute
813        pub fn part(
814            &mut self,
815            value: impl Into<std::borrow::Cow<'static, str>>,
816        ) -> &mut Self {
817            self.element.set_part(Some(value.into()));
818            self
819        }
820        /// Set the value of the `slot` attribute
821        pub fn slot(
822            &mut self,
823            value: impl Into<std::borrow::Cow<'static, str>>,
824        ) -> &mut Self {
825            self.element.set_slot(Some(value.into()));
826            self
827        }
828        /// Set the value of the `spellcheck` attribute
829        pub fn spellcheck(
830            &mut self,
831            value: impl Into<std::borrow::Cow<'static, str>>,
832        ) -> &mut Self {
833            self.element.set_spellcheck(Some(value.into()));
834            self
835        }
836        /// Set the value of the `style` attribute
837        pub fn style(
838            &mut self,
839            value: impl Into<std::borrow::Cow<'static, str>>,
840        ) -> &mut Self {
841            self.element.set_style(Some(value.into()));
842            self
843        }
844        /// Set the value of the `tabindex` attribute
845        pub fn tab_index(&mut self, value: i64) -> &mut Self {
846            self.element.set_tab_index(Some(value));
847            self
848        }
849        /// Set the value of the `title` attribute
850        pub fn title(
851            &mut self,
852            value: impl Into<std::borrow::Cow<'static, str>>,
853        ) -> &mut Self {
854            self.element.set_title(Some(value.into()));
855            self
856        }
857        /// Set the value of the `translate` attribute
858        pub fn translate(&mut self, value: bool) -> &mut Self {
859            self.element.set_translate(value);
860            self
861        }
862        /// Push a new child element to the list of children.
863        pub fn push<T>(&mut self, child_el: T) -> &mut Self
864        where
865            T: Into<crate::generated::all::children::ScriptChild>,
866        {
867            let child_el = child_el.into();
868            self.element.children_mut().push(child_el);
869            self
870        }
871        /// Extend the list of children with an iterator of child elements.
872        pub fn extend<I, T>(&mut self, iter: I) -> &mut Self
873        where
874            I: IntoIterator<Item = T>,
875            T: Into<crate::generated::all::children::ScriptChild>,
876        {
877            let iter = iter.into_iter().map(|child_el| child_el.into());
878            self.element.children_mut().extend(iter);
879            self
880        }
881    }
882}