1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.htmlunit.javascript.host.html;
16
17 import static org.htmlunit.javascript.configuration.SupportedBrowser.CHROME;
18 import static org.htmlunit.javascript.configuration.SupportedBrowser.EDGE;
19 import static org.htmlunit.javascript.configuration.SupportedBrowser.FF;
20 import static org.htmlunit.javascript.configuration.SupportedBrowser.FF_ESR;
21
22 import org.htmlunit.corejs.javascript.Function;
23 import org.htmlunit.html.HtmlBody;
24 import org.htmlunit.html.HtmlElement;
25 import org.htmlunit.javascript.configuration.JsxClass;
26 import org.htmlunit.javascript.configuration.JsxConstructor;
27 import org.htmlunit.javascript.configuration.JsxGetter;
28 import org.htmlunit.javascript.configuration.JsxSetter;
29 import org.htmlunit.javascript.host.event.Event;
30 import org.htmlunit.util.StringUtils;
31
32
33
34
35
36
37
38
39
40 @JsxClass(domClass = HtmlBody.class)
41 public class HTMLBodyElement extends HTMLElement {
42
43
44
45
46 @Override
47 @JsxConstructor
48 public void jsConstructor() {
49 super.jsConstructor();
50 }
51
52
53
54
55
56
57
58 public void createEventHandlerFromAttribute(final String attributeName, final String value) {
59
60
61 if (StringUtils.toRootLowerCase(attributeName).startsWith("on")) {
62 createEventHandler(attributeName.substring(2), value);
63 }
64 }
65
66
67
68
69 @Override
70 protected boolean isEventHandlerOnWindow() {
71 return true;
72 }
73
74
75
76
77 @Override
78 public HTMLElement getOffsetParent_js() {
79 return null;
80 }
81
82
83
84
85
86
87 @JsxGetter
88 public String getALink() {
89 return getDomNodeOrDie().getAttribute("aLink");
90 }
91
92
93
94
95
96
97 @JsxSetter
98 public void setALink(final String aLink) {
99 setColorAttribute("aLink", aLink);
100 }
101
102
103
104
105
106
107 @JsxGetter
108 public String getBackground() {
109 final HtmlElement node = getDomNodeOrDie();
110 return node.getAttributeDirect("background");
111 }
112
113
114
115
116
117
118 @JsxSetter
119 public void setBackground(final String background) {
120 getDomNodeOrDie().setAttribute("background", background);
121 }
122
123
124
125
126
127
128 @JsxGetter
129 public String getBgColor() {
130 return getDomNodeOrDie().getAttribute("bgColor");
131 }
132
133
134
135
136
137
138 @JsxSetter
139 public void setBgColor(final String bgColor) {
140 setColorAttribute("bgColor", bgColor);
141 }
142
143
144
145
146
147
148 @JsxGetter
149 public String getLink() {
150 return getDomNodeOrDie().getAttributeDirect("link");
151 }
152
153
154
155
156
157
158 @JsxSetter
159 public void setLink(final String link) {
160 setColorAttribute("link", link);
161 }
162
163
164
165
166
167
168 @JsxGetter
169 public String getText() {
170 return getDomNodeOrDie().getAttributeDirect("text");
171 }
172
173
174
175
176
177
178 @JsxSetter
179 public void setText(final String text) {
180 setColorAttribute("text", text);
181 }
182
183
184
185
186
187
188 @JsxGetter
189 public String getVLink() {
190 return getDomNodeOrDie().getAttribute("vLink");
191 }
192
193
194
195
196
197
198 @JsxSetter
199 public void setVLink(final String vLink) {
200 setColorAttribute("vLink", vLink);
201 }
202
203
204
205
206 @Override
207 public int getClientWidth() {
208 return super.getClientWidth() + 16;
209 }
210
211
212
213
214 @Override
215 @JsxGetter({CHROME, EDGE})
216 public Function getOnload() {
217 return super.getOnload();
218 }
219
220
221
222
223 @Override
224 @JsxSetter({CHROME, EDGE})
225 public void setOnload(final Object onload) {
226 super.setOnload(onload);
227 }
228
229
230
231
232 @Override
233 @JsxSetter({CHROME, EDGE})
234 public void setOnblur(final Object handler) {
235 super.setOnblur(handler);
236 }
237
238
239
240
241 @Override
242 @JsxGetter({CHROME, EDGE})
243 public Function getOnblur() {
244 return super.getOnblur();
245 }
246
247
248
249
250 @Override
251 @JsxSetter({CHROME, EDGE})
252 public void setOnfocus(final Object handler) {
253 super.setOnfocus(handler);
254 }
255
256
257
258
259 @Override
260 @JsxGetter({CHROME, EDGE})
261 public Function getOnfocus() {
262 return super.getOnfocus();
263 }
264
265
266
267
268 @Override
269 @JsxSetter({CHROME, EDGE})
270 public void setOnerror(final Object handler) {
271 super.setOnerror(handler);
272 }
273
274
275
276
277 @Override
278 @JsxGetter({CHROME, EDGE})
279 public Function getOnerror() {
280 return super.getOnerror();
281 }
282
283
284
285
286
287 @JsxGetter
288 public Function getOnbeforeunload() {
289 return getEventHandler(Event.TYPE_BEFORE_UNLOAD);
290 }
291
292
293
294
295
296 @JsxSetter
297 public void setOnbeforeunload(final Object onbeforeunload) {
298 setEventHandler(Event.TYPE_BEFORE_UNLOAD, onbeforeunload);
299 }
300
301
302
303
304
305 @JsxGetter({FF, FF_ESR})
306 public Function getOngamepadconnected() {
307 return getEventHandler(Event.TYPE_GAMEPAD_CONNECTED);
308 }
309
310
311
312
313
314 @JsxSetter({FF, FF_ESR})
315 public void setOngamepadconnected(final Object gamepadconnected) {
316 setEventHandler(Event.TYPE_GAMEPAD_CONNECTED, gamepadconnected);
317 }
318
319
320
321
322
323 @JsxGetter({FF, FF_ESR})
324 public Function getOngamepaddisconnected() {
325 return getEventHandler(Event.TYPE_GAMEPAD_DISCONNECTED);
326 }
327
328
329
330
331
332 @JsxSetter({FF, FF_ESR})
333 public void setOngamepaddisconnected(final Object gamepaddisconnected) {
334 setEventHandler(Event.TYPE_GAMEPAD_DISCONNECTED, gamepaddisconnected);
335 }
336
337
338
339
340
341 @JsxGetter
342 public Function getOnhashchange() {
343 return getEventHandler(Event.TYPE_HASH_CHANGE);
344 }
345
346
347
348
349
350 @JsxSetter
351 public void setOnhashchange(final Object onhashchange) {
352 setEventHandler(Event.TYPE_HASH_CHANGE, onhashchange);
353 }
354
355
356
357
358
359 @JsxGetter
360 public Function getOnlanguagechange() {
361 return getEventHandler(Event.TYPE_LANGUAGECHANGE);
362 }
363
364
365
366
367
368 @JsxSetter
369 public void setOnlanguagechange(final Object onlanguagechange) {
370 setEventHandler(Event.TYPE_LANGUAGECHANGE, onlanguagechange);
371 }
372
373
374
375
376
377 @JsxGetter
378 public Function getOnmessage() {
379 return getEventHandler(Event.TYPE_MESSAGE);
380 }
381
382
383
384
385
386 @JsxSetter
387 public void setOnmessage(final Object onmessage) {
388 setEventHandler(Event.TYPE_MESSAGE, onmessage);
389 }
390
391
392
393
394
395 @JsxGetter
396 public Function getOnoffline() {
397 return getEventHandler(Event.TYPE_OFFLINE);
398 }
399
400
401
402
403
404 @JsxSetter
405 public void setOnoffline(final Object onoffline) {
406 setEventHandler(Event.TYPE_OFFLINE, onoffline);
407 }
408
409
410
411
412
413 @JsxGetter
414 public Function getOnonline() {
415 return getEventHandler(Event.TYPE_ONLINE);
416 }
417
418
419
420
421
422 @JsxSetter
423 public void setOnonline(final Object ononline) {
424 setEventHandler(Event.TYPE_ONLINE, ononline);
425 }
426
427
428
429
430
431 @JsxGetter
432 public Function getOnpagehide() {
433 return getEventHandler(Event.TYPE_PAGEHIDE);
434 }
435
436
437
438
439
440 @JsxSetter
441 public void setOnpagehide(final Object onpagehide) {
442 setEventHandler(Event.TYPE_PAGEHIDE, onpagehide);
443 }
444
445
446
447
448
449 @JsxGetter
450 public Function getOnpageshow() {
451 return getEventHandler(Event.TYPE_PAGESHOW);
452 }
453
454
455
456
457
458 @JsxSetter
459 public void setOnpageshow(final Object onpageshow) {
460 setEventHandler(Event.TYPE_PAGESHOW, onpageshow);
461 }
462
463
464
465
466
467 @JsxGetter
468 public Function getOnpopstate() {
469 return getEventHandler(Event.TYPE_POPSTATE);
470 }
471
472
473
474
475
476 @JsxSetter
477 public void setOnpopstate(final Object onpopstate) {
478 setEventHandler(Event.TYPE_POPSTATE, onpopstate);
479 }
480
481
482
483
484
485 @JsxGetter
486 public Function getOnrejectionhandled() {
487 return getEventHandler(Event.TYPE_REJECTIONHANDLED);
488 }
489
490
491
492
493
494 @JsxSetter
495 public void setOnrejectionhandled(final Object onrejectionhandled) {
496 setEventHandler(Event.TYPE_REJECTIONHANDLED, onrejectionhandled);
497 }
498
499
500
501
502
503 @JsxGetter
504 public Function getOnstorage() {
505 return getEventHandler(Event.TYPE_STORAGE);
506 }
507
508
509
510
511
512 @JsxSetter
513 public void setOnstorage(final Object onstorage) {
514 setEventHandler(Event.TYPE_STORAGE, onstorage);
515 }
516
517
518
519
520
521 @JsxGetter
522 public Function getOnunhandledrejection() {
523 return getEventHandler(Event.TYPE_UNHANDLEDREJECTION);
524 }
525
526
527
528
529
530 @JsxSetter
531 public void setOnunhandledrejection(final Object onunhandledrejection) {
532 setEventHandler(Event.TYPE_UNHANDLEDREJECTION, onunhandledrejection);
533 }
534
535
536
537
538
539 @JsxGetter
540 public Function getOnunload() {
541 return getEventHandler(Event.TYPE_UNLOAD);
542 }
543
544
545
546
547
548 @JsxSetter
549 public void setOnunload(final Object onunload) {
550 setEventHandler(Event.TYPE_UNLOAD, onunload);
551 }
552
553
554
555
556
557 @JsxGetter
558 public Function getOnafterprint() {
559 return getEventHandler(Event.TYPE_AFTERPRINT);
560 }
561
562
563
564
565
566 @JsxSetter
567 public void setOnafterprint(final Object onafterprint) {
568 setEventHandler(Event.TYPE_AFTERPRINT, onafterprint);
569 }
570
571
572
573
574
575 @JsxGetter
576 public Function getOnbeforeprint() {
577 return getEventHandler(Event.TYPE_BEFOREPRINT);
578 }
579
580
581
582
583
584 @JsxSetter
585 public void setOnbeforeprint(final Object onbeforeprint) {
586 setEventHandler(Event.TYPE_BEFOREPRINT, onbeforeprint);
587 }
588
589
590
591
592
593 @JsxGetter
594 public Function getOnmessageerror() {
595 return getEventHandler(Event.TYPE_ONMESSAGEERROR);
596 }
597
598
599
600
601
602 @JsxSetter
603 public void setOnmessageerror(final Object onmessageerror) {
604 setEventHandler(Event.TYPE_ONMESSAGEERROR, onmessageerror);
605 }
606
607
608
609
610 @Override
611 @JsxGetter({CHROME, EDGE})
612 public Function getOnresize() {
613 return super.getOnresize();
614 }
615
616
617
618
619 @Override
620 @JsxSetter({CHROME, EDGE})
621 public void setOnresize(final Object onresize) {
622 super.setOnresize(onresize);
623 }
624
625
626
627
628 @Override
629 @JsxGetter({CHROME, EDGE})
630 public Function getOnscroll() {
631 return super.getOnscroll();
632 }
633
634
635
636
637 @Override
638 @JsxSetter({CHROME, EDGE})
639 public void setOnscroll(final Object onresize) {
640 super.setOnscroll(onresize);
641 }
642 }