001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.dto.html5;
014
015import static org.apache.juneau.xml.annotation.XmlFormat.*;
016
017import java.net.*;
018import java.net.URI;
019import java.util.*;
020import java.util.Map.*;
021
022import org.apache.juneau.*;
023import org.apache.juneau.annotation.*;
024import org.apache.juneau.html.*;
025import org.apache.juneau.internal.*;
026import org.apache.juneau.xml.annotation.*;
027
028/**
029 * Superclass for all HTML elements.
030 * 
031 * <p>
032 * These are beans that when serialized using {@link HtmlSerializer} generate valid HTML5 elements.
033 * 
034 * <h5 class='section'>See Also:</h5>
035 * <ul class='doctree'>
036 *    <li class='link'><a class='doclink' href='../../../../../overview-summary.html#juneau-dto.HTML5'>Overview &gt; juneau-dto &gt; HTML5</a>
037 * </ul>
038 */
039@org.apache.juneau.html.annotation.Html(asXml=true)
040public abstract class HtmlElement {
041
042   private LinkedHashMap<String,Object> attrs;
043
044   /**
045    * The attributes of this element.
046    * 
047    * @return The attributes of this element.
048    */
049   @Xml(format=ATTRS)
050   @BeanProperty("a")
051   public LinkedHashMap<String,Object> getAttrs() {
052      return attrs;
053   }
054
055   /**
056    * Sets the attributes for this element.
057    * 
058    * @param attrs The new attributes for this element.
059    * @return This object (for method chaining).
060    */
061   @BeanProperty("a")
062   public HtmlElement setAttrs(LinkedHashMap<String,Object> attrs) {
063      for (Entry<String,Object> e : attrs.entrySet()) {
064         String key = e.getKey();
065         if ("url".equals(key) || "href".equals(key) || key.endsWith("action"))
066            e.setValue(StringUtils.toURI(e.getValue()));
067      }
068      this.attrs = attrs;
069      return this;
070   }
071
072   /**
073    * Adds an arbitrary attribute to this element.
074    * 
075    * @param key The attribute name.
076    * @param val The attribute value.
077    * @return This object (for method chaining).
078    */
079   public HtmlElement attr(String key, Object val) {
080      if (this.attrs == null)
081         this.attrs = new LinkedHashMap<>();
082      if ("url".equals(key) || "href".equals(key) || key.endsWith("action"))
083         val = StringUtils.toURI(val);
084      this.attrs.put(key, val);
085      return this;
086   }
087
088   /**
089    * Adds an arbitrary URI attribute to this element.
090    * 
091    * <p>
092    * Same as {@link #attr(String, Object)}, except if the value is a string that appears to be a URI
093    * (e.g. <js>"servlet:/xxx"</js>).
094    * 
095    * <p>
096    * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}.
097    * Strings must be valid URIs.
098    * 
099    * <p>
100    * URIs defined by {@link UriResolver} can be used for values.
101    * 
102    * @param key The attribute name.
103    * @param val The attribute value.
104    * @return This object (for method chaining).
105    */
106   public HtmlElement attrUri(String key, Object val) {
107      if (this.attrs == null)
108         this.attrs = new LinkedHashMap<>();
109      this.attrs.put(key, StringUtils.toURI(val));
110      return this;
111   }
112
113   /**
114    * Returns the attribute with the specified name.
115    * 
116    * @param key The attribute name.
117    * @return The attribute value, or <jk>null</jk> if the named attribute does not exist.
118    */
119   public String getAttr(String key) {
120      return getAttr(String.class, key);
121   }
122
123   /**
124    * Returns the attribute with the specified name converted to the specified class type.
125    * 
126    * @param type
127    *    The class type to convert this class to.
128    *    See {@link ObjectUtils} for a list of supported conversion types.
129    * @param key The attribute name.
130    * @return The attribute value, or <jk>null</jk> if the named attribute does not exist.
131    */
132   public <T> T getAttr(Class<T> type, String key) {
133      return attrs == null ? null : ObjectUtils.toType(attrs.get(key), type);
134   }
135
136   /**
137    * <a class="doclink" href="https://www.w3.org/TR/html5/editing.html#the-accesskey-attribute">accesskey</a>
138    * attribute.
139    * 
140    * @param accesskey The new value for this attribute.
141    * @return This object (for method chaining).
142    */
143   public HtmlElement accesskey(String accesskey) {
144      attr("accesskey", accesskey);
145      return this;
146   }
147
148   /**
149    * <a class="doclink" href="https://www.w3.org/TR/html5/dom.html#classes">class</a> attribute.
150    * 
151    * @param _class The new value for this attribute.
152    * @return This object (for method chaining).
153    */
154   public HtmlElement _class(String _class) {
155      attr("class", _class);
156      return this;
157   }
158
159   /**
160    * <a class="doclink" href="https://www.w3.org/TR/html5/editing.html#attr-contenteditable">contenteditable</a>
161    * attribute.
162    * 
163    * @param contenteditable The new value for this attribute.
164    * Typically a {@link Boolean} or {@link String}.
165    * @return This object (for method chaining).
166    */
167   public HtmlElement contenteditable(Object contenteditable) {
168      attr("contenteditable", contenteditable);
169      return this;
170   }
171
172   /**
173    * <a class="doclink" href="https://www.w3.org/TR/html5/dom.html#the-dir-attribute">dir</a> attribute.
174    * 
175    * @param dir The new value for this attribute.
176    * @return This object (for method chaining).
177    */
178   public HtmlElement dir(String dir) {
179      attr("dir", dir);
180      return this;
181   }
182
183   /**
184    * <a class="doclink" href="https://www.w3.org/TR/html5/editing.html#the-hidden-attribute">hidden</a> attribute.
185    * 
186    * @param hidden
187    *    The new value for this attribute.
188    *    Typically a {@link Boolean} or {@link String}.
189    * @return This object (for method chaining).
190    */
191   public HtmlElement hidden(Object hidden) {
192      attr("hidden", hidden);
193      return this;
194   }
195
196   /**
197    * <a class="doclink" href="https://www.w3.org/TR/html5/dom.html#the-id-attribute">id</a> attribute.
198    * 
199    * @param id The new value for this attribute.
200    * @return This object (for method chaining).
201    */
202   public HtmlElement id(String id) {
203      attr("id", id);
204      return this;
205   }
206
207   /**
208    * <a class="doclink" href="https://www.w3.org/TR/html5/dom.html#attr-lang">lang</a> attribute.
209    * 
210    * @param lang The new value for this attribute.
211    * @return This object (for method chaining).
212    */
213   public HtmlElement lang(String lang) {
214      attr("lang", lang);
215      return this;
216   }
217
218   /**
219    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onabort">onabort</a> attribute.
220    * 
221    * @param onabort The new value for this attribute.
222    * @return This object (for method chaining).
223    */
224   public HtmlElement onabort(String onabort) {
225      attr("onabort", onabort);
226      return this;
227   }
228
229   /**
230    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onblur">onblur</a> attribute.
231    * 
232    * @param onblur The new value for this attribute.
233    * @return This object (for method chaining).
234    */
235   public HtmlElement onblur(String onblur) {
236      attr("onblur", onblur);
237      return this;
238   }
239
240   /**
241    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-oncancel">oncancel</a> attribute.
242    * 
243    * @param oncancel The new value for this attribute.
244    * @return This object (for method chaining).
245    */
246   public HtmlElement oncancel(String oncancel) {
247      attr("oncancel", oncancel);
248      return this;
249   }
250
251   /**
252    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-oncanplay">oncanplay</a> attribute.
253    * 
254    * @param oncanplay The new value for this attribute.
255    * @return This object (for method chaining).
256    */
257   public HtmlElement oncanplay(String oncanplay) {
258      attr("oncanplay", oncanplay);
259      return this;
260   }
261
262   /**
263    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-oncanplaythrough">oncanplaythrough</a>
264    * attribute.
265    * 
266    * @param oncanplaythrough The new value for this attribute.
267    * @return This object (for method chaining).
268    */
269   public HtmlElement oncanplaythrough(String oncanplaythrough) {
270      attr("oncanplaythrough", oncanplaythrough);
271      return this;
272   }
273
274   /**
275    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onchange">onchange</a> attribute.
276    * 
277    * @param onchange The new value for this attribute.
278    * @return This object (for method chaining).
279    */
280   public HtmlElement onchange(String onchange) {
281      attr("onchange", onchange);
282      return this;
283   }
284
285   /**
286    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onclick">onclick</a> attribute.
287    * 
288    * @param onclick The new value for this attribute.
289    * @return This object (for method chaining).
290    */
291   public HtmlElement onclick(String onclick) {
292      attr("onclick", onclick);
293      return this;
294   }
295
296   /**
297    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-oncuechange">oncuechange</a>
298    * attribute.
299    * 
300    * @param oncuechange The new value for this attribute.
301    * @return This object (for method chaining).
302    */
303   public HtmlElement oncuechange(String oncuechange) {
304      attr("oncuechange", oncuechange);
305      return this;
306   }
307
308   /**
309    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-ondblclick">ondblclick</a> attribute.
310    * 
311    * @param ondblclick The new value for this attribute.
312    * @return This object (for method chaining).
313    */
314   public HtmlElement ondblclick(String ondblclick) {
315      attr("ondblclick", ondblclick);
316      return this;
317   }
318
319   /**
320    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-ondurationchange">ondurationchange</a>
321    * attribute.
322    * 
323    * @param ondurationchange The new value for this attribute.
324    * @return This object (for method chaining).
325    */
326   public HtmlElement ondurationchange(String ondurationchange) {
327      attr("ondurationchange", ondurationchange);
328      return this;
329   }
330
331   /**
332    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onemptied">onemptied</a> attribute.
333    * 
334    * @param onemptied The new value for this attribute.
335    * @return This object (for method chaining).
336    */
337   public HtmlElement onemptied(String onemptied) {
338      attr("onemptied", onemptied);
339      return this;
340   }
341
342   /**
343    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onended">onended</a> attribute.
344    * 
345    * @param onended The new value for this attribute.
346    * @return This object (for method chaining).
347    */
348   public HtmlElement onended(String onended) {
349      attr("onended", onended);
350      return this;
351   }
352
353   /**
354    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onerror">onerror</a> attribute.
355    * 
356    * @param onerror The new value for this attribute.
357    * @return This object (for method chaining).
358    */
359   public HtmlElement onerror(String onerror) {
360      attr("onerror", onerror);
361      return this;
362   }
363
364   /**
365    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onfocus">onfocus</a> attribute.
366    * 
367    * @param onfocus The new value for this attribute.
368    * @return This object (for method chaining).
369    */
370   public HtmlElement onfocus(String onfocus) {
371      attr("onfocus", onfocus);
372      return this;
373   }
374
375   /**
376    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-oninput">oninput</a> attribute.
377    * 
378    * @param oninput The new value for this attribute.
379    * @return This object (for method chaining).
380    */
381   public HtmlElement oninput(String oninput) {
382      attr("oninput", oninput);
383      return this;
384   }
385
386   /**
387    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-oninvalid">oninvalid</a> attribute.
388    * 
389    * @param oninvalid The new value for this attribute.
390    * @return This object (for method chaining).
391    */
392   public HtmlElement oninvalid(String oninvalid) {
393      attr("oninvalid", oninvalid);
394      return this;
395   }
396
397   /**
398    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onkeydown">onkeydown</a> attribute.
399    * 
400    * @param onkeydown The new value for this attribute.
401    * @return This object (for method chaining).
402    */
403   public HtmlElement onkeydown(String onkeydown) {
404      attr("onkeydown", onkeydown);
405      return this;
406   }
407
408   /**
409    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onkeypress">onkeypress</a> attribute.
410    * 
411    * @param onkeypress The new value for this attribute.
412    * @return This object (for method chaining).
413    */
414   public HtmlElement onkeypress(String onkeypress) {
415      attr("onkeypress", onkeypress);
416      return this;
417   }
418
419   /**
420    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onkeyup">onkeyup</a> attribute.
421    * 
422    * @param onkeyup The new value for this attribute.
423    * @return This object (for method chaining).
424    */
425   public HtmlElement onkeyup(String onkeyup) {
426      attr("onkeyup", onkeyup);
427      return this;
428   }
429
430   /**
431    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onload">onload</a> attribute.
432    * 
433    * @param onload The new value for this attribute.
434    * @return This object (for method chaining).
435    */
436   public HtmlElement onload(String onload) {
437      attr("onload", onload);
438      return this;
439   }
440
441   /**
442    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onloadeddata">onloadeddata</a>
443    * attribute.
444    * 
445    * @param onloadeddata The new value for this attribute.
446    * @return This object (for method chaining).
447    */
448   public HtmlElement onloadeddata(String onloadeddata) {
449      attr("onloadeddata", onloadeddata);
450      return this;
451   }
452
453   /**
454    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onloadedmetadata">onloadedmetadata</a>
455    * attribute.
456    * 
457    * @param onloadedmetadata The new value for this attribute.
458    * @return This object (for method chaining).
459    */
460   public HtmlElement onloadedmetadata(String onloadedmetadata) {
461      attr("onloadedmetadata", onloadedmetadata);
462      return this;
463   }
464
465   /**
466    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onloadstart">onloadstart</a>
467    * attribute.
468    * 
469    * @param onloadstart The new value for this attribute.
470    * @return This object (for method chaining).
471    */
472   public HtmlElement onloadstart(String onloadstart) {
473      attr("onloadstart", onloadstart);
474      return this;
475   }
476
477   /**
478    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onmousedown">onmousedown</a>
479    * attribute.
480    * 
481    * @param onmousedown The new value for this attribute.
482    * @return This object (for method chaining).
483    */
484   public HtmlElement onmousedown(String onmousedown) {
485      attr("onmousedown", onmousedown);
486      return this;
487   }
488
489   /**
490    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onmouseenter">onmouseenter</a> attribute.
491    * 
492    * @param onmouseenter The new value for this attribute.
493    * @return This object (for method chaining).
494    */
495   public HtmlElement onmouseenter(String onmouseenter) {
496      attr("onmouseenter", onmouseenter);
497      return this;
498   }
499
500   /**
501    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onmouseleave">onmouseleave</a>
502    * attribute.
503    * 
504    * @param onmouseleave The new value for this attribute.
505    * @return This object (for method chaining).
506    */
507   public HtmlElement onmouseleave(String onmouseleave) {
508      attr("onmouseleave", onmouseleave);
509      return this;
510   }
511
512   /**
513    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onmousemove">onmousemove</a>
514    * attribute.
515    * 
516    * @param onmousemove The new value for this attribute.
517    * @return This object (for method chaining).
518    */
519   public HtmlElement onmousemove(String onmousemove) {
520      attr("onmousemove", onmousemove);
521      return this;
522   }
523
524   /**
525    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onmouseout">onmouseout</a> attribute.
526    * 
527    * @param onmouseout The new value for this attribute.
528    * @return This object (for method chaining).
529    */
530   public HtmlElement onmouseout(String onmouseout) {
531      attr("onmouseout", onmouseout);
532      return this;
533   }
534
535   /**
536    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onmouseover">onmouseover</a>
537    * attribute.
538    * 
539    * @param onmouseover The new value for this attribute.
540    * @return This object (for method chaining).
541    */
542   public HtmlElement onmouseover(String onmouseover) {
543      attr("onmouseover", onmouseover);
544      return this;
545   }
546
547   /**
548    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onmouseup">onmouseup</a> attribute.
549    * 
550    * @param onmouseup The new value for this attribute.
551    * @return This object (for method chaining).
552    */
553   public HtmlElement onmouseup(String onmouseup) {
554      attr("onmouseup", onmouseup);
555      return this;
556   }
557
558   /**
559    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onmousewheel">onmousewheel</a>
560    * attribute.
561    * 
562    * @param onmousewheel The new value for this attribute.
563    * @return This object (for method chaining).
564    */
565   public HtmlElement onmousewheel(String onmousewheel) {
566      attr("onmousewheel", onmousewheel);
567      return this;
568   }
569
570   /**
571    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onpause">onpause</a> attribute.
572    * 
573    * @param onpause The new value for this attribute.
574    * @return This object (for method chaining).
575    */
576   public HtmlElement onpause(String onpause) {
577      attr("onpause", onpause);
578      return this;
579   }
580
581   /**
582    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onplay">onplay</a> attribute.
583    * 
584    * @param onplay The new value for this attribute.
585    * @return This object (for method chaining).
586    */
587   public HtmlElement onplay(String onplay) {
588      attr("onplay", onplay);
589      return this;
590   }
591
592   /**
593    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onplaying">onplaying</a> attribute.
594    * 
595    * @param onplaying The new value for this attribute.
596    * @return This object (for method chaining).
597    */
598   public HtmlElement onplaying(String onplaying) {
599      attr("onplaying", onplaying);
600      return this;
601   }
602
603   /**
604    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onprogress">onprogress</a> attribute.
605    * 
606    * @param onprogress The new value for this attribute.
607    * @return This object (for method chaining).
608    */
609   public HtmlElement onprogress(String onprogress) {
610      attr("onprogress", onprogress);
611      return this;
612   }
613
614   /**
615    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onratechange">onratechange</a>
616    * attribute.
617    * 
618    * @param onratechange The new value for this attribute.
619    * @return This object (for method chaining).
620    */
621   public HtmlElement onratechange(String onratechange) {
622      attr("onratechange", onratechange);
623      return this;
624   }
625
626   /**
627    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onreset">onreset</a> attribute.
628    * 
629    * @param onreset The new value for this attribute.
630    * @return This object (for method chaining).
631    */
632   public HtmlElement onreset(String onreset) {
633      attr("onreset", onreset);
634      return this;
635   }
636
637   /**
638    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onresize">onresize</a> attribute.
639    * 
640    * @param onresize The new value for this attribute.
641    * @return This object (for method chaining).
642    */
643   public HtmlElement onresize(String onresize) {
644      attr("onresize", onresize);
645      return this;
646   }
647
648   /**
649    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onscroll">onscroll</a> attribute.
650    * 
651    * @param onscroll The new value for this attribute.
652    * @return This object (for method chaining).
653    */
654   public HtmlElement onscroll(String onscroll) {
655      attr("onscroll", onscroll);
656      return this;
657   }
658
659   /**
660    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onseeked">onseeked</a> attribute.
661    * 
662    * @param onseeked The new value for this attribute.
663    * @return This object (for method chaining).
664    */
665   public HtmlElement onseeked(String onseeked) {
666      attr("onseeked", onseeked);
667      return this;
668   }
669
670   /**
671    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onseeking">onseeking</a> attribute.
672    * 
673    * @param onseeking The new value for this attribute.
674    * @return This object (for method chaining).
675    */
676   public HtmlElement onseeking(String onseeking) {
677      attr("onseeking", onseeking);
678      return this;
679   }
680
681   /**
682    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onselect">onselect</a> attribute.
683    * 
684    * @param onselect The new value for this attribute.
685    * @return This object (for method chaining).
686    */
687   public HtmlElement onselect(String onselect) {
688      attr("onselect", onselect);
689      return this;
690   }
691
692   /**
693    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onshow">onshow</a> attribute.
694    * 
695    * @param onshow The new value for this attribute.
696    * @return This object (for method chaining).
697    */
698   public HtmlElement onshow(String onshow) {
699      attr("onshow", onshow);
700      return this;
701   }
702
703   /**
704    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onstalled">onstalled</a> attribute.
705    * 
706    * @param onstalled The new value for this attribute.
707    * @return This object (for method chaining).
708    */
709   public HtmlElement onstalled(String onstalled) {
710      attr("onstalled", onstalled);
711      return this;
712   }
713
714   /**
715    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onsubmit">onsubmit</a> attribute.
716    * 
717    * @param onsubmit The new value for this attribute.
718    * @return This object (for method chaining).
719    */
720   public HtmlElement onsubmit(String onsubmit) {
721      attr("onsubmit", onsubmit);
722      return this;
723   }
724
725   /**
726    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onsuspend">onsuspend</a> attribute.
727    * 
728    * @param onsuspend The new value for this attribute.
729    * @return This object (for method chaining).
730    */
731   public HtmlElement onsuspend(String onsuspend) {
732      attr("onsuspend", onsuspend);
733      return this;
734   }
735
736   /**
737    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-ontimeupdate">ontimeupdate</a>
738    * attribute.
739    * 
740    * @param ontimeupdate The new value for this attribute.
741    * @return This object (for method chaining).
742    */
743   public HtmlElement ontimeupdate(String ontimeupdate) {
744      attr("ontimeupdate", ontimeupdate);
745      return this;
746   }
747
748   /**
749    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-ontoggle">ontoggle</a> attribute.
750    * 
751    * @param ontoggle The new value for this attribute.
752    * @return This object (for method chaining).
753    */
754   public HtmlElement ontoggle(String ontoggle) {
755      attr("ontoggle", ontoggle);
756      return this;
757   }
758
759   /**
760    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onvolumechange">onvolumechange</a>
761    * attribute.
762    * 
763    * @param onvolumechange The new value for this attribute.
764    * @return This object (for method chaining).
765    */
766   public HtmlElement onvolumechange(String onvolumechange) {
767      attr("onvolumechange", onvolumechange);
768      return this;
769   }
770
771   /**
772    * <a class="doclink" href="https://www.w3.org/TR/html5/webappapis.html#handler-onwaiting">onwaiting</a> attribute.
773    * 
774    * @param onwaiting The new value for this attribute.
775    * @return This object (for method chaining).
776    */
777   public HtmlElement onwaiting(String onwaiting) {
778      attr("onwaiting", onwaiting);
779      return this;
780   }
781
782   /**
783    * <a class="doclink" href="https://www.w3.org/TR/html5/editing.html#attr-spellcheck">spellcheck</a> attribute.
784    * 
785    * @param spellcheck
786    *    The new value for this attribute.
787    *    Typically a {@link Boolean} or {@link String}.
788    * @return This object (for method chaining).
789    */
790   public HtmlElement spellcheck(Object spellcheck) {
791      attr("spellcheck", spellcheck);
792      return this;
793   }
794
795   /**
796    * <a class="doclink" href="https://www.w3.org/TR/html5/dom.html#the-style-attribute">style</a> attribute.
797    * 
798    * @param style The new value for this attribute.
799    * @return This object (for method chaining).
800    */
801   public HtmlElement style(String style) {
802      attr("style", style);
803      return this;
804   }
805
806   /**
807    * <a class="doclink" href="https://www.w3.org/TR/html5/editing.html#attr-tabindex">tabindex</a> attribute.
808    * 
809    * @param tabindex
810    *    The new value for this attribute.
811    *    Typically a {@link Number} or {@link String}.
812    * @return This object (for method chaining).
813    */
814   public HtmlElement tabindex(Object tabindex) {
815      attr("tabindex", tabindex);
816      return this;
817   }
818
819   /**
820    * <a class="doclink" href="https://www.w3.org/TR/html5/dom.html#attr-title">title</a> attribute.
821    * 
822    * @param title The new value for this attribute.
823    * @return This object (for method chaining).
824    */
825   public HtmlElement title(String title) {
826      attr("title", title);
827      return this;
828   }
829
830   /**
831    * <a class="doclink" href="https://www.w3.org/TR/html5/dom.html#attr-translate">translate</a> attribute.
832    * 
833    * @param translate
834    *    The new value for this attribute.
835    *    Typically a {@link Number} or {@link String}.
836    * @return This object (for method chaining).
837    */
838   public HtmlElement translate(Object translate) {
839      attr("translate", translate);
840      return this;
841   }
842
843   @Override /* Object */
844   public String toString() {
845      return HtmlSerializer.DEFAULT_SQ.toString(this);
846   }
847}