html/generated/
head.rs

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