View Javadoc
1   /*
2    * Copyright (c) 2002-2017 Gargoyle Software Inc.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  package com.gargoylesoftware.htmlunit.javascript.host.dom;
16  
17  import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_ONCLOSE_DOCUMENT_CREATE_NOT_SUPPORTED;
18  import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_BEFOREUNLOADEVENT;
19  import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_HASHCHANGEEVENT;
20  import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_KEY_EVENTS;
21  import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_POINTEREVENT;
22  import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_PROGRESSEVENT;
23  import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLDOCUMENT_CHARSET_LOWERCASE;
24  import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ANCHORS_REQUIRES_NAME_OR_ID;
25  import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCUMENT_CREATE_ELEMENT_STRICT;
26  import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCUMENT_DESIGN_MODE_INHERIT;
27  import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCUMENT_FORMS_FUNCTION_SUPPORTED;
28  import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCUMENT_SELECTION_RANGE_COUNT;
29  import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCUMENT_SETTING_DOMAIN_THROWS_FOR_ABOUT_BLANK;
30  import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCUMENT_SET_LOCATION_EXECUTED_IN_ANCHOR;
31  import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_TREEWALKER_EXPAND_ENTITY_REFERENCES_FALSE;
32  import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_TREEWALKER_FILTER_FUNCTION_ONLY;
33  import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.QUERYSELECTORALL_NOT_IN_QUIRKS;
34  import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.CHROME;
35  import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.EDGE;
36  import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.FF;
37  import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.FF45;
38  import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.FF52;
39  import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.IE;
40  import static com.gargoylesoftware.htmlunit.util.StringUtils.parseHttpDate;
41  
42  import java.io.IOException;
43  import java.net.URL;
44  import java.nio.charset.Charset;
45  import java.text.SimpleDateFormat;
46  import java.util.Arrays;
47  import java.util.Collections;
48  import java.util.Date;
49  import java.util.HashMap;
50  import java.util.HashSet;
51  import java.util.List;
52  import java.util.Locale;
53  import java.util.Map;
54  import java.util.Set;
55  import java.util.regex.Matcher;
56  import java.util.regex.Pattern;
57  
58  import org.apache.commons.logging.Log;
59  import org.apache.commons.logging.LogFactory;
60  import org.apache.xml.utils.PrefixResolver;
61  import org.w3c.css.sac.CSSException;
62  import org.w3c.dom.DOMException;
63  import org.w3c.dom.DocumentType;
64  
65  import com.gargoylesoftware.htmlunit.BrowserVersion;
66  import com.gargoylesoftware.htmlunit.ElementNotFoundException;
67  import com.gargoylesoftware.htmlunit.Page;
68  import com.gargoylesoftware.htmlunit.SgmlPage;
69  import com.gargoylesoftware.htmlunit.WebClient;
70  import com.gargoylesoftware.htmlunit.WebResponse;
71  import com.gargoylesoftware.htmlunit.WebWindow;
72  import com.gargoylesoftware.htmlunit.html.BaseFrameElement;
73  import com.gargoylesoftware.htmlunit.html.DomComment;
74  import com.gargoylesoftware.htmlunit.html.DomDocumentFragment;
75  import com.gargoylesoftware.htmlunit.html.DomElement;
76  import com.gargoylesoftware.htmlunit.html.DomNode;
77  import com.gargoylesoftware.htmlunit.html.DomText;
78  import com.gargoylesoftware.htmlunit.html.FrameWindow;
79  import com.gargoylesoftware.htmlunit.html.HTMLParser;
80  import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
81  import com.gargoylesoftware.htmlunit.html.HtmlApplet;
82  import com.gargoylesoftware.htmlunit.html.HtmlArea;
83  import com.gargoylesoftware.htmlunit.html.HtmlAttributeChangeEvent;
84  import com.gargoylesoftware.htmlunit.html.HtmlElement;
85  import com.gargoylesoftware.htmlunit.html.HtmlEmbed;
86  import com.gargoylesoftware.htmlunit.html.HtmlForm;
87  import com.gargoylesoftware.htmlunit.html.HtmlImage;
88  import com.gargoylesoftware.htmlunit.html.HtmlInput;
89  import com.gargoylesoftware.htmlunit.html.HtmlPage;
90  import com.gargoylesoftware.htmlunit.html.HtmlRp;
91  import com.gargoylesoftware.htmlunit.html.HtmlRt;
92  import com.gargoylesoftware.htmlunit.html.HtmlScript;
93  import com.gargoylesoftware.htmlunit.html.HtmlSvg;
94  import com.gargoylesoftware.htmlunit.html.HtmlUnknownElement;
95  import com.gargoylesoftware.htmlunit.html.UnknownElementFactory;
96  import com.gargoylesoftware.htmlunit.html.impl.SimpleRange;
97  import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable;
98  import com.gargoylesoftware.htmlunit.javascript.configuration.CanSetReadOnly;
99  import com.gargoylesoftware.htmlunit.javascript.configuration.CanSetReadOnlyStatus;
100 import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass;
101 import com.gargoylesoftware.htmlunit.javascript.configuration.JsxConstructor;
102 import com.gargoylesoftware.htmlunit.javascript.configuration.JsxFunction;
103 import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter;
104 import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter;
105 import com.gargoylesoftware.htmlunit.javascript.host.Element;
106 import com.gargoylesoftware.htmlunit.javascript.host.Location;
107 import com.gargoylesoftware.htmlunit.javascript.host.NativeFunctionPrefixResolver;
108 import com.gargoylesoftware.htmlunit.javascript.host.Window;
109 import com.gargoylesoftware.htmlunit.javascript.host.css.StyleSheetList;
110 import com.gargoylesoftware.htmlunit.javascript.host.event.BeforeUnloadEvent;
111 import com.gargoylesoftware.htmlunit.javascript.host.event.CloseEvent;
112 import com.gargoylesoftware.htmlunit.javascript.host.event.CustomEvent;
113 import com.gargoylesoftware.htmlunit.javascript.host.event.Event;
114 import com.gargoylesoftware.htmlunit.javascript.host.event.HashChangeEvent;
115 import com.gargoylesoftware.htmlunit.javascript.host.event.KeyboardEvent;
116 import com.gargoylesoftware.htmlunit.javascript.host.event.MessageEvent;
117 import com.gargoylesoftware.htmlunit.javascript.host.event.MouseEvent;
118 import com.gargoylesoftware.htmlunit.javascript.host.event.MutationEvent;
119 import com.gargoylesoftware.htmlunit.javascript.host.event.PointerEvent;
120 import com.gargoylesoftware.htmlunit.javascript.host.event.PopStateEvent;
121 import com.gargoylesoftware.htmlunit.javascript.host.event.ProgressEvent;
122 import com.gargoylesoftware.htmlunit.javascript.host.event.UIEvent;
123 import com.gargoylesoftware.htmlunit.javascript.host.html.DocumentProxy;
124 import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLAnchorElement;
125 import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLCollection;
126 import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDocument;
127 import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement;
128 import com.gargoylesoftware.htmlunit.util.EncodingSniffer;
129 
130 import net.sourceforge.htmlunit.corejs.javascript.Callable;
131 import net.sourceforge.htmlunit.corejs.javascript.Context;
132 import net.sourceforge.htmlunit.corejs.javascript.Function;
133 import net.sourceforge.htmlunit.corejs.javascript.FunctionObject;
134 import net.sourceforge.htmlunit.corejs.javascript.NativeFunction;
135 import net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime;
136 import net.sourceforge.htmlunit.corejs.javascript.Scriptable;
137 import net.sourceforge.htmlunit.corejs.javascript.ScriptableObject;
138 
139 /**
140  * A JavaScript object for {@code Document}.
141  *
142  * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
143  * @author David K. Taylor
144  * @author <a href="mailto:chen_jun@users.sourceforge.net">Chen Jun</a>
145  * @author <a href="mailto:cse@dynabean.de">Christian Sell</a>
146  * @author Chris Erskine
147  * @author Marc Guillemot
148  * @author Daniel Gredler
149  * @author Michael Ottati
150  * @author <a href="mailto:george@murnock.com">George Murnock</a>
151  * @author Ahmed Ashour
152  * @author Rob Di Marco
153  * @author Ronald Brill
154  * @author Chuck Dumont
155  * @author Frank Danek
156  * @author Madis Pärn
157  * @see <a href="http://msdn.microsoft.com/en-us/library/ms531073.aspx">MSDN documentation</a>
158  * @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-7068919">W3C Dom Level 1</a>
159  */
160 @JsxClass
161 public class Document extends Node {
162 
163     private static final Log LOG = LogFactory.getLog(Document.class);
164     private static final Pattern TAG_NAME_PATTERN = Pattern.compile("\\w+");
165     // all as lowercase for performance
166     private static final Set<String> EXECUTE_CMDS_IE = new HashSet<>();
167     /** https://developer.mozilla.org/en/Rich-Text_Editing_in_Mozilla#Executing_Commands */
168     private static final Set<String> EXECUTE_CMDS_FF = new HashSet<>();
169     private static final Set<String> EXECUTE_CMDS_CHROME = new HashSet<>();
170     /** The format to use for the <tt>lastModified</tt> attribute. */
171     private static final String LAST_MODIFIED_DATE_FORMAT = "MM/dd/yyyy HH:mm:ss";
172 
173     /**
174      * Map<String, Class> which maps strings a caller may use when calling into
175      * {@link #createEvent(String)} to the associated event class. To support a new
176      * event creation type, the event type and associated class need to be added into this map in
177      * the static initializer. The map is unmodifiable. Any class that is a value in this map MUST
178      * have a no-arg constructor.
179      */
180     /** Contains all supported DOM level 2 events. */
181     private static final Map<String, Class<? extends Event>> SUPPORTED_DOM2_EVENT_TYPE_MAP;
182     /** Contains all supported DOM level 3 events. DOM level 2 events are not included. */
183     private static final Map<String, Class<? extends Event>> SUPPORTED_DOM3_EVENT_TYPE_MAP;
184     /** Contains all supported vendor specific events. */
185     private static final Map<String, Class<? extends Event>> SUPPORTED_VENDOR_EVENT_TYPE_MAP;
186 
187     /** Initializes the supported event type map. */
188     static {
189         final Map<String, Class<? extends Event>> dom2EventMap = new HashMap<>();
190         dom2EventMap.put("HTMLEvents", Event.class);
191         dom2EventMap.put("MouseEvents", MouseEvent.class);
192         dom2EventMap.put("MutationEvents", MutationEvent.class);
193         dom2EventMap.put("UIEvents", UIEvent.class);
194         SUPPORTED_DOM2_EVENT_TYPE_MAP = Collections.unmodifiableMap(dom2EventMap);
195 
196         final Map<String, Class<? extends Event>> dom3EventMap = new HashMap<>();
197         dom3EventMap.put("Event", Event.class);
198         dom3EventMap.put("KeyboardEvent", KeyboardEvent.class);
199         dom3EventMap.put("MouseEvent", MouseEvent.class);
200         dom3EventMap.put("MessageEvent", MessageEvent.class);
201         dom3EventMap.put("MutationEvent", MutationEvent.class);
202         dom3EventMap.put("UIEvent", UIEvent.class);
203         dom3EventMap.put("CustomEvent", CustomEvent.class);
204         dom3EventMap.put("CloseEvent", CloseEvent.class);
205         SUPPORTED_DOM3_EVENT_TYPE_MAP = Collections.unmodifiableMap(dom3EventMap);
206 
207         final Map<String, Class<? extends Event>> additionalEventMap = new HashMap<>();
208         additionalEventMap.put("BeforeUnloadEvent", BeforeUnloadEvent.class);
209         additionalEventMap.put("Events", Event.class);
210         additionalEventMap.put("HashChangeEvent", HashChangeEvent.class);
211         additionalEventMap.put("KeyEvents", KeyboardEvent.class);
212         additionalEventMap.put("PointerEvent", PointerEvent.class);
213         additionalEventMap.put("PopStateEvent", PopStateEvent.class);
214         additionalEventMap.put("ProgressEvent", ProgressEvent.class);
215         SUPPORTED_VENDOR_EVENT_TYPE_MAP = Collections.unmodifiableMap(additionalEventMap);
216     }
217 
218     /**
219      * Static counter for {@link #uniqueID_}.
220      */
221     private static int UniqueID_Counter_ = 1;
222 
223     private Window window_;
224     private DOMImplementation implementation_;
225     private String designMode_;
226     private String compatMode_;
227     private int documentMode_ = -1;
228     private String uniqueID_;
229     private String domain_;
230     private String lastModified_;
231 
232     static {
233         // commands
234         List<String> cmds = Arrays.asList(
235             "2D-Position", "AbsolutePosition",
236             "BlockDirLTR", "BlockDirRTL", "BrowseMode",
237             "ClearAuthenticationCache", "CreateBookmark", "Copy", "Cut",
238             "DirLTR", "DirRTL",
239             "EditMode",
240             "InlineDirLTR", "InlineDirRTL", "InsertButton", "InsertFieldset",
241             "InsertIFrame", "InsertInputButton", "InsertInputCheckbox",
242             "InsertInputFileUpload", "InsertInputHidden", "InsertInputImage", "InsertInputPassword", "InsertInputRadio",
243             "InsertInputReset", "InsertInputSubmit", "InsertInputText", "InsertMarquee",
244             "InsertSelectDropdown", "InsertSelectListbox", "InsertTextArea",
245             "LiveResize", "MultipleSelection", "Open",
246             "OverWrite", "PlayImage",
247             "Refresh", "RemoveParaFormat", "SaveAs",
248             "SizeToControl", "SizeToControlHeight", "SizeToControlWidth", "Stop", "StopImage",
249             "UnBookmark",
250             "Paste"
251         );
252         for (final String cmd : cmds) {
253             EXECUTE_CMDS_IE.add(cmd.toLowerCase(Locale.ROOT));
254         }
255 
256         cmds = Arrays.asList(
257             "BackColor", "BackgroundImageCache" /* Undocumented */,
258             "Bold",
259             "CreateLink", "Delete",
260             "FontName", "FontSize", "ForeColor", "FormatBlock",
261             "Indent", "InsertHorizontalRule", "InsertImage",
262             "InsertOrderedList", "InsertParagraph", "InsertUnorderedList",
263             "Italic", "JustifyCenter", "JustifyFull", "JustifyLeft", "JustifyNone",
264             "JustifyRight",
265             "Outdent",
266             "Print",
267             "Redo", "RemoveFormat",
268             "SelectAll", "StrikeThrough", "Subscript", "Superscript",
269             "Underline", "Undo", "Unlink", "Unselect"
270         );
271         for (final String cmd : cmds) {
272             EXECUTE_CMDS_IE.add(cmd.toLowerCase(Locale.ROOT));
273             if (!"Bold".equals(cmd)) {
274                 EXECUTE_CMDS_CHROME.add(cmd.toLowerCase(Locale.ROOT));
275             }
276         }
277 
278         cmds = Arrays.asList(
279             "backColor", "bold", "contentReadOnly", "copy", "createLink", "cut", "decreaseFontSize", "delete",
280             "fontName", "fontSize", "foreColor", "formatBlock", "heading", "hiliteColor", "increaseFontSize",
281             "indent", "insertHorizontalRule", "insertHTML", "insertImage", "insertOrderedList", "insertUnorderedList",
282             "insertParagraph", "italic",
283             "justifyCenter", "JustifyFull", "justifyLeft", "justifyRight", "outdent", "paste", "redo",
284             "removeFormat", "selectAll", "strikeThrough", "subscript", "superscript", "underline", "undo", "unlink",
285             "useCSS", "styleWithCSS"
286         );
287         for (final String cmd : cmds) {
288             EXECUTE_CMDS_FF.add(cmd.toLowerCase(Locale.ROOT));
289             if (!"bold".equals(cmd)) {
290                 EXECUTE_CMDS_CHROME.add(cmd.toLowerCase(Locale.ROOT));
291             }
292         }
293     }
294 
295     /**
296      * Creates an instance.
297      */
298     @JsxConstructor({CHROME, FF, EDGE})
299     public Document() {
300     }
301 
302     /**
303      * Sets the Window JavaScript object that encloses this document.
304      * @param window the Window JavaScript object that encloses this document
305      */
306     public void setWindow(final Window window) {
307         window_ = window;
308     }
309 
310     /**
311      * Returns the value of the {@code location} property.
312      * @return the value of the {@code location} property
313      */
314     @JsxGetter
315     public Location getLocation() {
316         if (window_ == null) {
317             return null;
318         }
319         return window_.getLocation();
320     }
321 
322     /**
323      * Sets the value of the {@code location} property. The location's default property is "href",
324      * so setting "document.location='http://www.sf.net'" is equivalent to setting
325      * "document.location.href='http://www.sf.net'".
326      * @see <a href="http://msdn.microsoft.com/en-us/library/ms535866.aspx">MSDN documentation</a>
327      * @param location the location to navigate to
328      * @throws IOException when location loading fails
329      */
330     @JsxSetter
331     public void setLocation(final String location) throws IOException {
332         final Object event = getWindow().getEvent();
333         boolean setLocation = true;
334         if (event instanceof UIEvent) {
335             final Object target = ((UIEvent) event).getTarget();
336             if (target instanceof HTMLAnchorElement) {
337                 final String href = ((HTMLAnchorElement) target).getHref();
338                 if (!href.isEmpty()
339                         && !getBrowserVersion().hasFeature(JS_DOCUMENT_SET_LOCATION_EXECUTED_IN_ANCHOR)) {
340                     setLocation = false;
341                 }
342             }
343         }
344         if (setLocation) {
345             window_.setLocation(location);
346         }
347     }
348 
349     /**
350      * Returns the value of the {@code referrer} property.
351      * @return the value of the {@code referrer} property
352      */
353     @JsxGetter
354     public String getReferrer() {
355         String referrer = "";
356         final WebResponse webResponse = getPage().getWebResponse();
357         if (webResponse != null) {
358             referrer = webResponse.getWebRequest().getAdditionalHeaders().get("Referer");
359             if (referrer == null) {
360                 referrer = "";
361             }
362         }
363         return referrer;
364     }
365 
366     /**
367      * Gets the JavaScript property {@code documentElement} for the document.
368      * @return the root node for the document
369      */
370     @JsxGetter
371     public Element getDocumentElement() {
372         final Object documentElement = getPage().getDocumentElement();
373         if (documentElement == null) {
374             // for instance with an XML document with parsing error
375             return null;
376         }
377         return (Element) getScriptableFor(documentElement);
378     }
379 
380     /**
381      * Gets the JavaScript property {@code rootElement}.
382      * @return the root node for the document
383      */
384     @JsxGetter({CHROME, FF52, IE})
385     public Element getRootElement() {
386         return null;
387     }
388 
389     /**
390      * Gets the JavaScript property {@code doctype} for the document.
391      * @return the DocumentType of the document
392      */
393     @JsxGetter
394     public SimpleScriptable getDoctype() {
395         final Object documentType = getPage().getDoctype();
396         if (documentType == null) {
397             return null;
398         }
399         return getScriptableFor(documentType);
400     }
401 
402     /**
403      * Returns a value which indicates whether or not the document can be edited.
404      * @return a value which indicates whether or not the document can be edited
405      */
406     @JsxGetter({CHROME, IE})
407     public String getDesignMode() {
408         if (designMode_ == null) {
409             if (getBrowserVersion().hasFeature(JS_DOCUMENT_DESIGN_MODE_INHERIT)) {
410                 designMode_ = "inherit";
411             }
412             else {
413                 designMode_ = "off";
414             }
415         }
416         return designMode_;
417     }
418 
419     /**
420      * Sets a value which indicates whether or not the document can be edited.
421      * @param mode a value which indicates whether or not the document can be edited
422      */
423     @JsxSetter({CHROME, IE})
424     public void setDesignMode(final String mode) {
425         final BrowserVersion browserVersion = getBrowserVersion();
426         final boolean inherit = browserVersion.hasFeature(JS_DOCUMENT_DESIGN_MODE_INHERIT);
427         if (inherit) {
428             if (!"on".equalsIgnoreCase(mode) && !"off".equalsIgnoreCase(mode) && !"inherit".equalsIgnoreCase(mode)) {
429                 throw Context.reportRuntimeError("Invalid document.designMode value '" + mode + "'.");
430             }
431 
432             if ("on".equalsIgnoreCase(mode)) {
433                 designMode_ = "on";
434             }
435             else if ("off".equalsIgnoreCase(mode)) {
436                 designMode_ = "off";
437             }
438             else if ("inherit".equalsIgnoreCase(mode)) {
439                 designMode_ = "inherit";
440             }
441         }
442         else {
443             if ("on".equalsIgnoreCase(mode)) {
444                 designMode_ = "on";
445                 final SgmlPage page = getPage();
446                 if (page != null && page.isHtmlPage()
447                         && getBrowserVersion().hasFeature(JS_DOCUMENT_SELECTION_RANGE_COUNT)) {
448                     final HtmlPage htmlPage = (HtmlPage) page;
449                     final DomNode child = htmlPage.getBody().getFirstChild();
450                     final DomNode rangeNode = child == null ? htmlPage.getBody() : child;
451                     htmlPage.setSelectionRange(new SimpleRange(rangeNode, 0));
452                 }
453             }
454             else if ("off".equalsIgnoreCase(mode)) {
455                 designMode_ = "off";
456             }
457         }
458     }
459 
460     /**
461      * Returns the page that this document is modeling.
462      * @return the page that this document is modeling
463      */
464     public SgmlPage getPage() {
465         return (SgmlPage) getDomNodeOrDie();
466     }
467 
468     /**
469      * Gets the window in which this document is contained.
470      * @return the window
471      */
472     @JsxGetter
473     public Object getDefaultView() {
474         return getWindow();
475     }
476 
477     /**
478      * Creates a new document fragment.
479      * @return a newly created document fragment
480      */
481     @JsxFunction
482     public Object createDocumentFragment() {
483         final DomDocumentFragment fragment = getDomNodeOrDie().getPage().createDocumentFragment();
484         final DocumentFragment node = new DocumentFragment();
485         node.setParentScope(getParentScope());
486         node.setPrototype(getPrototype(node.getClass()));
487         node.setDomNode(fragment);
488         return getScriptableFor(fragment);
489     }
490 
491     /**
492      * Creates a new HTML attribute with the specified name.
493      *
494      * @param attributeName the name of the attribute to create
495      * @return an attribute with the specified name
496      */
497     @JsxFunction
498     public Attr createAttribute(final String attributeName) {
499         return (Attr) getPage().createAttribute(attributeName).getScriptableObject();
500     }
501 
502     /**
503      * Imports a node from another document to this document.
504      * The source node is not altered or removed from the original document;
505      * this method creates a new copy of the source node.
506      *
507      * @param importedNode the node to import
508      * @param deep Whether to recursively import the subtree under the specified node; or not
509      * @return the imported node that belongs to this Document
510      */
511     @JsxFunction
512     public Object importNode(final Node importedNode, final boolean deep) {
513         DomNode domNode = importedNode.getDomNodeOrDie();
514         domNode = domNode.cloneNode(deep);
515         domNode.processImportNode(this);
516         for (final DomNode childNode : domNode.getDescendants()) {
517             childNode.processImportNode(this);
518         }
519         return domNode.getScriptableObject();
520     }
521 
522     /**
523      * Adopts a node from an external document.
524      * The node and its subtree is removed from the document it's in (if any),
525      * and its ownerDocument is changed to the current document.
526      * The node can then be inserted into the current document.
527      *
528      * @param externalNode the node from another document to be adopted
529      * @return the adopted node that can be used in the current document
530      */
531     @JsxFunction
532     public Object adoptNode(final Node externalNode) {
533         externalNode.remove();
534         return importNode(externalNode, true);
535     }
536 
537     /**
538      * Returns the implementation object of the current document.
539      * @return implementation-specific object
540      */
541     @JsxGetter
542     public DOMImplementation getImplementation() {
543         if (implementation_ == null) {
544             implementation_ = new DOMImplementation();
545             implementation_.setParentScope(getWindow());
546             implementation_.setPrototype(getPrototype(implementation_.getClass()));
547         }
548         return implementation_;
549     }
550 
551     /**
552      * Adapts any DOM node to resolve namespaces so that an XPath expression can be easily
553      * evaluated relative to the context of the node where it appeared within the document.
554      * @param nodeResolver the node to be used as a context for namespace resolution
555      * @return an XPathNSResolver which resolves namespaces with respect to the definitions
556      *         in scope for a specified node
557      */
558     @JsxFunction({CHROME, FF})
559     public XPathNSResolver createNSResolver(final Node nodeResolver) {
560         final XPathNSResolver resolver = new XPathNSResolver();
561         resolver.setElement(nodeResolver);
562         resolver.setParentScope(getWindow());
563         resolver.setPrototype(getPrototype(resolver.getClass()));
564         return resolver;
565     }
566 
567     /**
568      * Create a new DOM text node with the given data.
569      *
570      * @param newData the string value for the text node
571      * @return the new text node or NOT_FOUND if there is an error
572      */
573     @JsxFunction
574     public Object createTextNode(final String newData) {
575         Object result = NOT_FOUND;
576         try {
577             final DomNode domNode = new DomText(getDomNodeOrDie().getPage(), newData);
578             final Object jsElement = getScriptableFor(domNode);
579 
580             if (jsElement == NOT_FOUND) {
581                 if (LOG.isDebugEnabled()) {
582                     LOG.debug("createTextNode(" + newData
583                             + ") cannot return a result as there isn't a JavaScript object for the DOM node "
584                             + domNode.getClass().getName());
585                 }
586             }
587             else {
588                 result = jsElement;
589             }
590         }
591         catch (final ElementNotFoundException e) {
592             // Just fall through - result is already set to NOT_FOUND
593         }
594         return result;
595     }
596 
597     /**
598      * Creates a new Comment.
599      * @param comment the comment text
600      * @return the new Comment
601      */
602     @JsxFunction
603     public Object createComment(final String comment) {
604         final DomNode domNode = new DomComment(getDomNodeOrDie().getPage(), comment);
605         return getScriptableFor(domNode);
606     }
607 
608     /**
609      * Evaluates an XPath expression string and returns a result of the specified type if possible.
610      * @param expression the XPath expression string to be parsed and evaluated
611      * @param contextNode the context node for the evaluation of this XPath expression
612      * @param resolver the resolver permits translation of all prefixes, including the XML namespace prefix,
613      *        within the XPath expression into appropriate namespace URIs.
614      * @param type If a specific type is specified, then the result will be returned as the corresponding type
615      * @param result the result object which may be reused and returned by this method
616      * @return the result of the evaluation of the XPath expression
617      */
618     @JsxFunction({CHROME, FF})
619     public XPathResult evaluate(final String expression, final Node contextNode,
620             final Object resolver, final int type, final Object result) {
621         XPathResult xPathResult = (XPathResult) result;
622         if (xPathResult == null) {
623             xPathResult = new XPathResult();
624             xPathResult.setParentScope(getParentScope());
625             xPathResult.setPrototype(getPrototype(xPathResult.getClass()));
626         }
627 
628         PrefixResolver prefixResolver = null;
629         if (resolver instanceof NativeFunction) {
630             prefixResolver = new NativeFunctionPrefixResolver((NativeFunction) resolver, contextNode.getParentScope());
631         }
632         else if (resolver instanceof PrefixResolver) {
633             prefixResolver = (PrefixResolver) resolver;
634         }
635         xPathResult.init(contextNode.getDomNodeOrDie().getByXPath(expression, prefixResolver), type);
636         return xPathResult;
637     }
638 
639     /**
640      * Creates a new element with the given tag name.
641      *
642      * @param tagName the tag name
643      * @return the new HTML element, or NOT_FOUND if the tag is not supported
644      */
645     @JsxFunction
646     public Object createElement(String tagName) {
647         Object result = NOT_FOUND;
648         try {
649             final BrowserVersion browserVersion = getBrowserVersion();
650 
651             if (browserVersion.hasFeature(JS_DOCUMENT_CREATE_ELEMENT_STRICT)
652                   && (tagName.contains("<") || tagName.contains(">"))) {
653                 LOG.info("createElement: Provided string '"
654                             + tagName + "' contains an invalid character; '<' and '>' are not allowed");
655                 throw Context.reportRuntimeError("String contains an invalid character");
656             }
657             else if (tagName.startsWith("<") && tagName.endsWith(">")) {
658                 tagName = tagName.substring(1, tagName.length() - 1);
659 
660                 final Matcher matcher = TAG_NAME_PATTERN.matcher(tagName);
661                 if (!matcher.matches()) {
662                     LOG.info("createElement: Provided string '" + tagName + "' contains an invalid character");
663                     throw Context.reportRuntimeError("String contains an invalid character");
664                 }
665             }
666 
667             final SgmlPage page = getPage();
668             org.w3c.dom.Node element = page.createElement(tagName);
669 
670             if (element instanceof BaseFrameElement) {
671                 ((BaseFrameElement) element).markAsCreatedByJavascript();
672             }
673             else if (element instanceof HtmlInput) {
674                 ((HtmlInput) element).markAsCreatedByJavascript();
675             }
676             else if (element instanceof HtmlImage) {
677                 ((HtmlImage) element).markAsCreatedByJavascript();
678             }
679             else if (element instanceof HtmlRp) {
680                 ((HtmlRp) element).markAsCreatedByJavascript();
681             }
682             else if (element instanceof HtmlRt) {
683                 ((HtmlRt) element).markAsCreatedByJavascript();
684             }
685             else if (element instanceof HtmlScript) {
686                 ((HtmlScript) element).markAsCreatedByJavascript();
687             }
688             else if (element instanceof HtmlUnknownElement) {
689                 ((HtmlUnknownElement) element).markAsCreatedByJavascript();
690             }
691             else if (element instanceof HtmlSvg) {
692                 element = UnknownElementFactory.instance.createElementNS(page, "", "svg", null);
693                 ((HtmlUnknownElement) element).markAsCreatedByJavascript();
694             }
695             final Object jsElement = getScriptableFor(element);
696 
697             if (jsElement == NOT_FOUND) {
698                 if (LOG.isDebugEnabled()) {
699                     LOG.debug("createElement(" + tagName
700                         + ") cannot return a result as there isn't a JavaScript object for the element "
701                         + element.getClass().getName());
702                 }
703             }
704             else {
705                 result = jsElement;
706             }
707         }
708         catch (final ElementNotFoundException e) {
709             // Just fall through - result is already set to NOT_FOUND
710         }
711         return result;
712     }
713 
714     /**
715      * Creates a new HTML element with the given tag name, and name.
716      *
717      * @param namespaceURI the URI that identifies an XML namespace
718      * @param qualifiedName the qualified name of the element type to instantiate
719      * @return the new HTML element, or NOT_FOUND if the tag is not supported
720      */
721     @JsxFunction
722     public Object createElementNS(final String namespaceURI, final String qualifiedName) {
723         final org.w3c.dom.Element element;
724         if ("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul".equals(namespaceURI)) {
725             throw Context.reportRuntimeError("XUL not available");
726         }
727 
728         if (HTMLParser.XHTML_NAMESPACE.equals(namespaceURI)
729                 || HTMLParser.SVG_NAMESPACE.equals(namespaceURI)) {
730             element = getPage().createElementNS(namespaceURI, qualifiedName);
731         }
732         else {
733             element = new DomElement(namespaceURI, qualifiedName, getPage(), null);
734         }
735         return getScriptableFor(element);
736     }
737 
738     /**
739      * Returns all the descendant elements with the specified tag name.
740      * @param tagName the name to search for
741      * @return all the descendant elements with the specified tag name
742      */
743     @JsxFunction
744     public HTMLCollection getElementsByTagName(final String tagName) {
745         final HTMLCollection collection;
746         if ("*".equals(tagName)) {
747             collection = new HTMLCollection(getDomNodeOrDie(), false) {
748                 @Override
749                 protected boolean isMatching(final DomNode node) {
750                     return true;
751                 }
752             };
753         }
754         else {
755             collection = new HTMLCollection(getDomNodeOrDie(), false) {
756                 @Override
757                 protected boolean isMatching(final DomNode node) {
758                     return tagName.equalsIgnoreCase(node.getNodeName());
759                 }
760             };
761         }
762 
763         return collection;
764     }
765 
766     /**
767      * Returns a list of elements with the given tag name belonging to the given namespace.
768      * @param namespaceURI the namespace URI of elements to look for
769      * @param localName is either the local name of elements to look for or the special value "*",
770      *                  which matches all elements.
771      * @return a live NodeList of found elements in the order they appear in the tree
772      */
773     @JsxFunction
774     public Object getElementsByTagNameNS(final Object namespaceURI, final String localName) {
775         final HTMLCollection collection = new HTMLCollection(getDomNodeOrDie(), false) {
776             @Override
777             protected boolean isMatching(final DomNode node) {
778                 return localName.equals(node.getLocalName());
779             }
780         };
781 
782         return collection;
783     }
784 
785     /**
786      * Returns the value of the {@code activeElement} property.
787      * @see <a href="http://msdn.microsoft.com/en-us/library/ms533065.aspx">MSDN documentation</a>
788      * @return the value of the {@code activeElement} property
789      */
790     @JsxGetter
791     public Object getActiveElement() {
792         return null;
793     }
794 
795     /**
796      * Returns the character encoding of the current document.
797      * @return the character encoding of the current document
798      */
799     @JsxGetter
800     public String getCharacterSet() {
801         if (!(getPage() instanceof HtmlPage)) {
802             // TODO: implement XmlPage.getCharset
803             return "";
804         }
805         final Charset charset = getPage().getCharset();
806         if (charset != null && getBrowserVersion().hasFeature(HTMLDOCUMENT_CHARSET_LOWERCASE)) {
807             return charset.name().toLowerCase(Locale.ROOT);
808         }
809         return EncodingSniffer.translateEncodingLabel(charset);
810     }
811 
812     /**
813      * Retrieves the character set used to encode the document.
814      * @return the character set used to encode the document
815      */
816     @JsxGetter
817     public String getCharset() {
818         if (!(getPage() instanceof HtmlPage)) {
819             // TODO: implement XmlPage.getCharset
820             return "";
821         }
822         final Charset charset = getPage().getCharset();
823         if (getBrowserVersion().hasFeature(HTMLDOCUMENT_CHARSET_LOWERCASE)) {
824             return charset.name().toLowerCase(Locale.ROOT);
825         }
826         return EncodingSniffer.translateEncodingLabel(charset);
827     }
828 
829     /**
830      * Gets the default character set from the current regional language settings.
831      * @return the default character set from the current regional language settings
832      */
833     @JsxGetter(IE)
834     public String getDefaultCharset() {
835         return "windows-1252";
836     }
837 
838     /**
839      * Returns the value of the JavaScript property {@code anchors}.
840      * @see <a href="http://msdn.microsoft.com/en-us/library/ms537435.aspx">MSDN documentation</a>
841      * @see <a href="http://www.mozilla.org/docs/dom/domref/dom_doc_ref4.html#1024543">
842      * Gecko DOM reference</a>
843      * @return the value of this property
844      */
845     @JsxGetter({CHROME, IE})
846     public Object getAnchors() {
847         return new HTMLCollection(getDomNodeOrDie(), true) {
848             @Override
849             protected boolean isMatching(final DomNode node) {
850                 if (!(node instanceof HtmlAnchor)) {
851                     return false;
852                 }
853                 final HtmlAnchor anchor = (HtmlAnchor) node;
854                 if (getBrowserVersion().hasFeature(JS_ANCHORS_REQUIRES_NAME_OR_ID)) {
855                     return anchor.hasAttribute("name") || anchor.hasAttribute("id");
856                 }
857                 return anchor.hasAttribute("name");
858             }
859 
860             @Override
861             protected EffectOnCache getEffectOnCache(final HtmlAttributeChangeEvent event) {
862                 final HtmlElement node = event.getHtmlElement();
863                 if (!(node instanceof HtmlAnchor)) {
864                     return EffectOnCache.NONE;
865                 }
866                 if ("name".equals(event.getName()) || "id".equals(event.getName())) {
867                     return EffectOnCache.RESET;
868                 }
869                 return EffectOnCache.NONE;
870             }
871         };
872     }
873 
874     /**
875      * Returns the value of the JavaScript property {@code applets}.
876      * @see <a href="http://msdn.microsoft.com/en-us/library/ms537436.aspx">
877      * MSDN documentation</a>
878      * @see <a href="https://developer.mozilla.org/En/DOM:document.applets">
879      * Gecko DOM reference</a>
880      * @return the value of this property
881      */
882     @JsxGetter({CHROME, IE})
883     public Object getApplets() {
884         return new HTMLCollection(getDomNodeOrDie(), false) {
885             @Override
886             protected boolean isMatching(final DomNode node) {
887                 return node instanceof HtmlApplet;
888             }
889         };
890     }
891 
892     /**
893      * Returns this document's {@code body} element.
894      * @return this document's {@code body} element
895      */
896     @JsxGetter({CHROME, IE})
897     @CanSetReadOnly(CanSetReadOnlyStatus.EXCEPTION)
898     public HTMLElement getBody() {
899         final Page page = getPage();
900         if (page instanceof HtmlPage) {
901             final HtmlElement body = ((HtmlPage) page).getBody();
902             if (body != null) {
903                 return (HTMLElement) body.getScriptableObject();
904             }
905         }
906         return null;
907     }
908 
909     /**
910      * JavaScript function {@code close}.
911      *
912      * See http://www.whatwg.org/specs/web-apps/current-work/multipage/section-dynamic.html for
913      * a good description of the semantics of open(), write(), writeln() and close().
914      *
915      * @throws IOException if an IO problem occurs
916      */
917     @JsxFunction({CHROME, IE})
918     public void close() throws IOException {
919     }
920 
921     /**
922      * Returns the {@code compatMode} property.
923      * @return the {@code compatMode} property
924      */
925     @JsxGetter
926     public String getCompatMode() {
927         // initialize the modes
928         getDocumentMode();
929         return compatMode_;
930     }
931 
932     /**
933      * Returns the {@code documentMode} property.
934      * @return the {@code documentMode} property
935      */
936     @JsxGetter(IE)
937     public int getDocumentMode() {
938         if (documentMode_ != -1) {
939             return documentMode_;
940         }
941 
942         compatMode_ = "CSS1Compat";
943 
944         final BrowserVersion browserVersion = getBrowserVersion();
945         if (isQuirksDocType()) {
946             compatMode_ = "BackCompat";
947         }
948 
949         final float version = browserVersion.getBrowserVersionNumeric();
950         documentMode_ = (int) Math.floor(version);
951         return documentMode_;
952     }
953 
954     private boolean isQuirksDocType() {
955         final DocumentType docType = getPage().getDoctype();
956         if (docType != null) {
957             final String systemId = docType.getSystemId();
958             if (systemId != null) {
959                 if ("http://www.w3.org/TR/html4/strict.dtd".equals(systemId)) {
960                     return false;
961                 }
962 
963                 if ("http://www.w3.org/TR/html4/loose.dtd".equals(systemId)) {
964                     final String publicId = docType.getPublicId();
965                     if ("-//W3C//DTD HTML 4.01 Transitional//EN".equals(publicId)) {
966                         return false;
967                     }
968                 }
969 
970                 if ("http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd".equals(systemId)
971                     || "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd".equals(systemId)) {
972                     return false;
973                 }
974             }
975             else if (docType.getPublicId() == null) {
976                 if (docType.getName() != null) {
977                     return false;
978                 }
979                 return true;
980             }
981         }
982         return true;
983     }
984 
985     /**
986      * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br>
987      *
988      * Called from the HTMLParser if a 'X-UA-Compatible' meta tag found.
989      * @param documentMode the mode forced by the meta tag
990      */
991     public void forceDocumentMode(final int documentMode) {
992         documentMode_ = documentMode;
993         compatMode_ = documentMode == 5 ? "BackCompat" : "CSS1Compat";
994     }
995 
996     /**
997      * Returns the first element within the document that matches the specified group of selectors.
998      * @param selectors the selectors
999      * @return null if no matches are found; otherwise, it returns the first matching element
1000      */
1001     @JsxFunction
1002     public Node querySelector(final String selectors) {
1003         try {
1004             final DomNode node = getDomNodeOrDie().querySelector(selectors);
1005             if (node != null) {
1006                 return (Node) node.getScriptableObject();
1007             }
1008             return null;
1009         }
1010         catch (final CSSException e) {
1011             throw Context.reportRuntimeError("An invalid or illegal selector was specified (selector: '"
1012                     + selectors + "' error: " + e.getMessage() + ").");
1013         }
1014     }
1015 
1016     /**
1017      * Retrieves all element nodes from descendants of the starting element node that match any selector
1018      * within the supplied selector strings.
1019      * The NodeList object returned by the querySelectorAll() method must be static, not live.
1020      * @param selectors the selectors
1021      * @return the static node list
1022      */
1023     @JsxFunction
1024     public NodeList querySelectorAll(final String selectors) {
1025         try {
1026             return NodeList.staticNodeList(this, getDomNodeOrDie().querySelectorAll(selectors));
1027         }
1028         catch (final CSSException e) {
1029             throw Context.reportRuntimeError("An invalid or illegal selector was specified (selector: '"
1030                     + selectors + "' error: " + e.getMessage() + ").");
1031         }
1032     }
1033 
1034     /**
1035      * Indicates if the command is supported.
1036      * @see <a href="http://msdn2.microsoft.com/en-us/library/ms536681.aspx">MSDN documentation</a>
1037      * @param cmd the command identifier
1038      * @return {@code true} if the command is supported
1039      */
1040     @JsxFunction({CHROME, IE})
1041     public boolean queryCommandSupported(final String cmd) {
1042         return hasCommand(cmd, true);
1043     }
1044 
1045     private boolean hasCommand(final String cmd, final boolean includeBold) {
1046         if (null == cmd) {
1047             return false;
1048         }
1049 
1050         final String cmdLC = cmd.toLowerCase(Locale.ROOT);
1051         if (getBrowserVersion().isIE()) {
1052             return EXECUTE_CMDS_IE.contains(cmdLC);
1053         }
1054         if (getBrowserVersion().isChrome()) {
1055             return EXECUTE_CMDS_CHROME.contains(cmdLC) || (includeBold && "bold".equalsIgnoreCase(cmd));
1056         }
1057         return EXECUTE_CMDS_FF.contains(cmdLC);
1058     }
1059 
1060     /**
1061      * Indicates if the command can be successfully executed using <tt>execCommand</tt>, given
1062      * the current state of the document.
1063      * @param cmd the command identifier
1064      * @return {@code true} if the command can be successfully executed
1065      */
1066     @JsxFunction({CHROME, IE})
1067     public boolean queryCommandEnabled(final String cmd) {
1068         return hasCommand(cmd, true);
1069     }
1070 
1071     /**
1072      * Executes a command.
1073      * @see <a href="http://msdn2.microsoft.com/en-us/library/ms536419.aspx">MSDN documentation</a>
1074      * @param cmd the command identifier
1075      * @param userInterface display a user interface if the command supports one
1076      * @param value the string, number, or other value to assign (possible values depend on the command)
1077      * @return {@code true} if the command was successful, {@code false} otherwise
1078      */
1079     @JsxFunction({CHROME, IE})
1080     public boolean execCommand(final String cmd, final boolean userInterface, final Object value) {
1081         if (!hasCommand(cmd, false)) {
1082             return false;
1083         }
1084         LOG.warn("Nothing done for execCommand(" + cmd + ", ...) (feature not implemented)");
1085         return true;
1086     }
1087 
1088     /**
1089      * Retrieves an auto-generated, unique identifier for the object.
1090      * <b>Note</b> The unique ID generated is not guaranteed to be the same every time the page is loaded.
1091      * @return an auto-generated, unique identifier for the object
1092      */
1093     @JsxGetter(IE)
1094     public String getUniqueID() {
1095         if (uniqueID_ == null) {
1096             uniqueID_ = "ms__id" + UniqueID_Counter_++;
1097         }
1098         return uniqueID_;
1099     }
1100 
1101     /**
1102      * Returns the value of the {@code URL} property.
1103      * @return the value of the {@code URL} property
1104      */
1105     @JsxGetter(propertyName = "URL")
1106     public String getURL() {
1107         if (!(getPage() instanceof HtmlPage)) {
1108             // TODO: implement XmlPage.getUrl
1109             return "";
1110         }
1111         return getPage().getUrl().toExternalForm();
1112     }
1113 
1114     /**
1115      * Returns the value of the {@code documentURI} property.
1116      * @return the value of the {@code documentURI} property
1117      */
1118     @JsxGetter({CHROME, FF})
1119     public String getDocumentURI() {
1120         return getURL();
1121     }
1122 
1123     /**
1124      * Returns the value of the {@code URLUnencoded} property.
1125      * @return the value of the {@code URLUnencoded} property
1126      */
1127     @JsxGetter(value = IE, propertyName = "URLUnencoded")
1128     public String getURLUnencoded() {
1129         return getURL();
1130     }
1131 
1132     /**
1133      * {@inheritDoc}
1134      */
1135     @Override
1136     public Object get(final String name, final Scriptable start) {
1137         final Object response = super.get(name, start);
1138 
1139         // IE support .querySelector(All) but not in quirks mode
1140         // => TODO: find a better way to handle this!
1141         if (response instanceof FunctionObject
1142             && ("querySelectorAll".equals(name) || "querySelector".equals(name))
1143             && getBrowserVersion().hasFeature(QUERYSELECTORALL_NOT_IN_QUIRKS)) {
1144             Document document = null;
1145             if (start instanceof DocumentProxy) {
1146                 // if in prototype no domNode is set -> use start
1147                 document = ((DocumentProxy) start).getDelegee();
1148             }
1149             else if (start instanceof HTMLDocument) {
1150                 final DomNode page = ((HTMLDocument) start).getDomNodeOrNull();
1151                 if (page != null) {
1152                     document = (Document) page.getScriptableObject();
1153                 }
1154             }
1155             if (document != null && document instanceof HTMLDocument
1156                 && ((HTMLDocument) document).getDocumentMode() < 8) {
1157                 return NOT_FOUND;
1158             }
1159         }
1160 
1161         return response;
1162     }
1163 
1164     /**
1165      * Returns the {@code cookie} property.
1166      * @return the {@code cookie} property
1167      */
1168     @JsxGetter({CHROME, IE})
1169     public String getCookie() {
1170         return "";
1171     }
1172 
1173     /**
1174      * Implementation of the {@link org.w3c.dom.events.DocumentEvent} interface's
1175      * {@link org.w3c.dom.events.DocumentEvent#createEvent(String)} method. The method creates an
1176      * uninitialized event of the specified type.
1177      *
1178      * @see <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-DocumentEvent">DocumentEvent</a>
1179      * @param eventType the event type to create
1180      * @return an event object for the specified type
1181      * @throws DOMException if the event type is not supported (will have a type of
1182      *         DOMException.NOT_SUPPORTED_ERR)
1183      */
1184     @JsxFunction
1185     public Event createEvent(final String eventType) throws DOMException {
1186         Class<? extends Event> clazz = null;
1187         clazz = SUPPORTED_DOM2_EVENT_TYPE_MAP.get(eventType);
1188         if (clazz == null) {
1189             clazz = SUPPORTED_DOM3_EVENT_TYPE_MAP.get(eventType);
1190             if (CloseEvent.class == clazz
1191                     && getBrowserVersion().hasFeature(EVENT_ONCLOSE_DOCUMENT_CREATE_NOT_SUPPORTED)) {
1192                 clazz = null;
1193             }
1194         }
1195         if (clazz == null
1196                 && ("Events".equals(eventType)
1197                 || "KeyEvents".equals(eventType) && getBrowserVersion().hasFeature(EVENT_TYPE_KEY_EVENTS)
1198                 || "HashChangeEvent".equals(eventType)
1199                 && getBrowserVersion().hasFeature(EVENT_TYPE_HASHCHANGEEVENT)
1200                 || "BeforeUnloadEvent".equals(eventType)
1201                 && getBrowserVersion().hasFeature(EVENT_TYPE_BEFOREUNLOADEVENT)
1202                 || "PointerEvent".equals(eventType)
1203                 && getBrowserVersion().hasFeature(EVENT_TYPE_POINTEREVENT)
1204                 || "PopStateEvent".equals(eventType)
1205                 || "ProgressEvent".equals(eventType)
1206                 && getBrowserVersion().hasFeature(EVENT_TYPE_PROGRESSEVENT))) {
1207             clazz = SUPPORTED_VENDOR_EVENT_TYPE_MAP.get(eventType);
1208         }
1209         if (clazz == null) {
1210             Context.throwAsScriptRuntimeEx(new DOMException(DOMException.NOT_SUPPORTED_ERR,
1211                 "Event Type is not supported: " + eventType));
1212             return null; // to stop eclipse warning
1213         }
1214         try {
1215             final Event event = clazz.newInstance();
1216             event.setParentScope(getWindow());
1217             event.setPrototype(getPrototype(clazz));
1218             event.eventCreated();
1219             return event;
1220         }
1221         catch (final InstantiationException e) {
1222             throw Context.reportRuntimeError("Failed to instantiate event: class ='" + clazz.getName()
1223                             + "' for event type of '" + eventType + "': " + e.getMessage());
1224         }
1225         catch (final IllegalAccessException e) {
1226             throw Context.reportRuntimeError("Failed to instantiate event: class ='" + clazz.getName()
1227                             + "' for event type of '" + eventType + "': " + e.getMessage());
1228         }
1229     }
1230 
1231     /**
1232      * Returns a new NodeIterator object.
1233      *
1234      * @param root The root node at which to begin the NodeIterator's traversal.
1235      * @param whatToShow an optional long representing a bitmask created by combining
1236      * the constant properties of {@link NodeFilter}
1237      * @param filter an object implementing the {@link NodeFilter} interface
1238      * @return a new NodeIterator object
1239      */
1240     @JsxFunction
1241     public NodeIterator createNodeIterator(final Node root, final int whatToShow, final Scriptable filter) {
1242         final org.w3c.dom.traversal.NodeFilter filterWrapper = createFilterWrapper(filter, false);
1243         final NodeIterator iterator = new NodeIterator(getPage(), root, whatToShow, filterWrapper);
1244         iterator.setParentScope(getParentScope());
1245         iterator.setPrototype(getPrototype(iterator.getClass()));
1246         return iterator;
1247     }
1248 
1249     private static org.w3c.dom.traversal.NodeFilter createFilterWrapper(final Scriptable filter,
1250             final boolean filterFunctionOnly) {
1251         org.w3c.dom.traversal.NodeFilter filterWrapper = null;
1252         if (filter != null) {
1253             filterWrapper = new org.w3c.dom.traversal.NodeFilter() {
1254                 @Override
1255                 public short acceptNode(final org.w3c.dom.Node n) {
1256                     final Object[] args = new Object[] {((DomNode) n).getScriptableObject()};
1257                     final Object response;
1258                     if (filter instanceof Callable) {
1259                         response = ((Callable) filter).call(Context.getCurrentContext(), filter, filter, args);
1260                     }
1261                     else {
1262                         if (filterFunctionOnly) {
1263                             throw Context.reportRuntimeError("only a function is allowed as filter");
1264                         }
1265                         response = ScriptableObject.callMethod(filter, "acceptNode", args);
1266                     }
1267                     return (short) Context.toNumber(response);
1268                 }
1269             };
1270         }
1271         return filterWrapper;
1272     }
1273 
1274     /**
1275      * Creates and returns a new TreeWalker. The following JavaScript parameters are passed into this method:
1276      * <ul>
1277      *   <li>JavaScript param 1: The root node of the TreeWalker. Must not be {@code null}.</li>
1278      *   <li>JavaScript param 2: Flag specifying which types of nodes appear in the logical view of the TreeWalker.
1279      *       See {@link NodeFilter} for the set of possible Show_ values.</li>
1280      *   <li>JavaScript param 3: The {@link NodeFilter} to be used with this TreeWalker, or {@code null}
1281      *       to indicate no filter.</li>
1282      *   <li>JavaScript param 4: If {@code false}, the contents of EntityReference nodes are not present
1283      *       in the logical view.</li>
1284      * </ul>
1285      *
1286      * @see <a href="http://www.w3.org/TR/DOM-Level-2-Traversal-Range/traversal.html">DOM-Level-2-Traversal-Range</a>
1287      * @param root the node which will serve as the root for the TreeWalker
1288      * @param whatToShow specifies which node types may appear in the logical view of the tree presented
1289      * @param filter the NodeFilter to be used with this TreeWalker, or null to indicate no filter
1290      * @param expandEntityReferences If false,
1291      *        the contents of EntityReference nodes are not presented in the logical view
1292      * @throws DOMException on attempt to create a TreeWalker with a root that is {@code null}
1293      * @return a new TreeWalker
1294      */
1295     @JsxFunction
1296     public Object createTreeWalker(final Node root, final double whatToShow, final Scriptable filter,
1297             boolean expandEntityReferences) throws DOMException {
1298 
1299         // seems that Rhino doesn't like long as parameter type
1300         final int whatToShowI = (int) Double.valueOf(whatToShow).longValue();
1301 
1302         if (getBrowserVersion().hasFeature(JS_TREEWALKER_EXPAND_ENTITY_REFERENCES_FALSE)) {
1303             expandEntityReferences = false;
1304         }
1305 
1306         final boolean filterFunctionOnly = getBrowserVersion().hasFeature(JS_TREEWALKER_FILTER_FUNCTION_ONLY);
1307         final org.w3c.dom.traversal.NodeFilter filterWrapper = createFilterWrapper(filter, filterFunctionOnly);
1308         final TreeWalker t = new TreeWalker(getPage(), root, whatToShowI, filterWrapper, expandEntityReferences);
1309         t.setParentScope(getWindow(this));
1310         t.setPrototype(staticGetPrototype(getWindow(this), TreeWalker.class));
1311         return t;
1312     }
1313 
1314     @SuppressWarnings("unchecked")
1315     private static Scriptable staticGetPrototype(final Window window,
1316             final Class<? extends SimpleScriptable> javaScriptClass) {
1317         final Scriptable prototype = window.getPrototype(javaScriptClass);
1318         if (prototype == null && javaScriptClass != SimpleScriptable.class) {
1319             return staticGetPrototype(window, (Class<? extends SimpleScriptable>) javaScriptClass.getSuperclass());
1320         }
1321         return prototype;
1322     }
1323 
1324     /**
1325      * Creates and returns a new range.
1326      * @return a new range
1327      * @see <a href="http://www.xulplanet.com/references/objref/HTMLDocument.html#method_createRange">XUL Planet</a>
1328      */
1329     @JsxFunction
1330     public Range createRange() {
1331         final Range r = new Range(this);
1332         r.setParentScope(getWindow());
1333         r.setPrototype(getPrototype(Range.class));
1334         return r;
1335     }
1336 
1337     /**
1338      * Returns the domain name of the server that served the document, or {@code null} if the server
1339      * cannot be identified by a domain name.
1340      * @return the domain name of the server that served the document
1341      * @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-2250147">
1342      * W3C documentation</a>
1343      */
1344     @JsxGetter({CHROME, IE})
1345     public String getDomain() {
1346         if (domain_ == null && getPage().getWebResponse() != null) {
1347             URL url = getPage().getUrl();
1348             if (url == WebClient.URL_ABOUT_BLANK) {
1349                 final WebWindow w = getWindow().getWebWindow();
1350                 if (w instanceof FrameWindow) {
1351                     url = ((FrameWindow) w).getEnclosingPage().getUrl();
1352                 }
1353                 else {
1354                     return null;
1355                 }
1356             }
1357             domain_ = url.getHost().toLowerCase(Locale.ROOT);
1358         }
1359 
1360         return domain_;
1361     }
1362 
1363     /**
1364      * Sets the domain of this document.
1365      *
1366      * Domains can only be set to suffixes of the existing domain
1367      * with the exception of setting the domain to itself.
1368      * <p>
1369      * The domain will be set according to the following rules:
1370      * <ol>
1371      * <li>If the newDomain.equalsIgnoreCase(currentDomain) the method returns with no error.</li>
1372      * <li>If the browser version is netscape, the newDomain is downshifted.</li>
1373      * <li>The change will take place if and only if the suffixes of the
1374      *       current domain and the new domain match AND there are at least
1375      *       two domain qualifiers e.g. the following transformations are legal
1376      *       d1.d2.d3.gargoylesoftware.com may be transformed to itself or:
1377      *          d2.d3.gargoylesoftware.com
1378      *             d3.gargoylesoftware.com
1379      *                gargoylesoftware.com
1380      *
1381      *        transformation to:        com
1382      *        will fail
1383      * </li>
1384      * </ol>
1385      * <p>
1386      * TODO This code could be modified to understand country domain suffixes.
1387      * The domain www.bbc.co.uk should be trimmable only down to bbc.co.uk
1388      * trimming to co.uk should not be possible.
1389      * @param newDomain the new domain to set
1390      */
1391     @JsxSetter({CHROME, IE})
1392     public void setDomain(String newDomain) {
1393         final BrowserVersion browserVersion = getBrowserVersion();
1394 
1395         // IE (at least 6) doesn't allow to set domain of about:blank
1396         if (WebClient.URL_ABOUT_BLANK == getPage().getUrl()
1397             && browserVersion.hasFeature(JS_DOCUMENT_SETTING_DOMAIN_THROWS_FOR_ABOUT_BLANK)) {
1398             throw Context.reportRuntimeError("Illegal domain value, cannot set domain from \""
1399                     + WebClient.URL_ABOUT_BLANK + "\" to: \""
1400                     + newDomain + "\".");
1401         }
1402 
1403         newDomain = newDomain.toLowerCase(Locale.ROOT);
1404 
1405         final String currentDomain = getDomain();
1406         if (currentDomain.equalsIgnoreCase(newDomain)) {
1407             return;
1408         }
1409 
1410         if (newDomain.indexOf('.') == -1) {
1411             throw Context.reportRuntimeError("Illegal domain value, cannot set domain from: \""
1412                     + currentDomain + "\" to: \"" + newDomain + "\" (new domain has to contain a dot).");
1413         }
1414 
1415         if (currentDomain.indexOf('.') > -1
1416                 && !currentDomain.toLowerCase(Locale.ROOT).endsWith("." + newDomain.toLowerCase(Locale.ROOT))) {
1417             throw Context.reportRuntimeError("Illegal domain value, cannot set domain from: \""
1418                     + currentDomain + "\" to: \"" + newDomain + "\"");
1419         }
1420 
1421         domain_ = newDomain;
1422     }
1423 
1424     /**
1425      * Sets the {@code onclick} event handler for this element.
1426      * @param handler the {@code onclick} event handler for this element
1427      */
1428     @JsxSetter
1429     public void setOnclick(final Object handler) {
1430         setEventHandler("click", handler);
1431     }
1432 
1433     /**
1434      * Returns the {@code onclick} event handler for this element.
1435      * @return the {@code onclick} event handler for this element
1436      */
1437     @JsxGetter
1438     public Object getOnclick() {
1439         return getEventHandler("click");
1440     }
1441 
1442     /**
1443      * Sets the {@code ondblclick} event handler for this element.
1444      * @param handler the {@code ondblclick} event handler for this element
1445      */
1446     @JsxSetter
1447     public void setOndblclick(final Object handler) {
1448         setEventHandler("dblclick", handler);
1449     }
1450 
1451     /**
1452      * Returns the {@code ondblclick} event handler for this element.
1453      * @return the {@code ondblclick} event handler for this element
1454      */
1455     @JsxGetter
1456     public Object getOndblclick() {
1457         return getEventHandler("dblclick");
1458     }
1459 
1460     /**
1461      * Sets the {@code onblur} event handler for this element.
1462      * @param handler the {@code onblur} event handler for this element
1463      */
1464     @JsxSetter
1465     public void setOnblur(final Object handler) {
1466         setEventHandler("blur", handler);
1467     }
1468 
1469     /**
1470      * Returns the {@code onblur} event handler for this element.
1471      * @return the {@code onblur} event handler for this element
1472      */
1473     @JsxGetter
1474     public Object getOnblur() {
1475         return getEventHandler("blur");
1476     }
1477 
1478     /**
1479      * Sets the {@code onfocus} event handler for this element.
1480      * @param handler the {@code onfocus} event handler for this element
1481      */
1482     @JsxSetter
1483     public void setOnfocus(final Object handler) {
1484         setEventHandler("focus", handler);
1485     }
1486 
1487     /**
1488      * Returns the {@code onfocus} event handler for this element.
1489      * @return the {@code onfocus} event handler for this element
1490      */
1491     @JsxGetter
1492     public Object getOnfocus() {
1493         return getEventHandler("focus");
1494     }
1495 
1496     /**
1497      * Sets the {@code onfocusin} event handler for this element.
1498      * @param handler the {@code onfocusin} event handler for this element
1499      */
1500     @JsxSetter(IE)
1501     public void setOnfocusin(final Object handler) {
1502         setEventHandler("focusin", handler);
1503     }
1504 
1505     /**
1506      * Returns the {@code onfocusin} event handler for this element.
1507      * @return the {@code onfocusin} event handler for this element
1508      */
1509     @JsxGetter(IE)
1510     public Object getOnfocusin() {
1511         return getEventHandler("focusin");
1512     }
1513 
1514     /**
1515      * Sets the {@code onfocusout} event handler for this element.
1516      * @param handler the {@code onfocusout} event handler for this element
1517      */
1518     @JsxSetter(IE)
1519     public void setOnfocusout(final Object handler) {
1520         setEventHandler("focusout", handler);
1521     }
1522 
1523     /**
1524      * Returns the {@code onfocusout} event handler for this element.
1525      * @return the {@code onfocusout} event handler for this element
1526      */
1527     @JsxGetter(IE)
1528     public Object getOnfocusout() {
1529         return getEventHandler("focusout");
1530     }
1531 
1532     /**
1533      * Sets the {@code onkeydown} event handler for this element.
1534      * @param handler the {@code onkeydown} event handler for this element
1535      */
1536     @JsxSetter
1537     public void setOnkeydown(final Object handler) {
1538         setEventHandler("keydown", handler);
1539     }
1540 
1541     /**
1542      * Returns the {@code onkeydown} event handler for this element.
1543      * @return the {@code onkeydown} event handler for this element
1544      */
1545     @JsxGetter
1546     public Object getOnkeydown() {
1547         return getEventHandler("keydown");
1548     }
1549 
1550     /**
1551      * Sets the {@code onkeypress} event handler for this element.
1552      * @param handler the {@code onkeypress} event handler for this element
1553      */
1554     @JsxSetter
1555     public void setOnkeypress(final Object handler) {
1556         setEventHandler("keypress", handler);
1557     }
1558 
1559     /**
1560      * Returns the {@code onkeypress} event handler for this element.
1561      * @return the {@code onkeypress} event handler for this element
1562      */
1563     @JsxGetter
1564     public Object getOnkeypress() {
1565         return getEventHandler("keypress");
1566     }
1567 
1568     /**
1569      * Sets the {@code onkeyup} event handler for this element.
1570      * @param handler the {@code onkeyup} event handler for this element
1571      */
1572     @JsxSetter
1573     public void setOnkeyup(final Object handler) {
1574         setEventHandler("keyup", handler);
1575     }
1576 
1577     /**
1578      * Returns the {@code onkeyup} event handler for this element.
1579      * @return the {@code onkeyup} event handler for this element
1580      */
1581     @JsxGetter
1582     public Object getOnkeyup() {
1583         return getEventHandler("keyup");
1584     }
1585 
1586     /**
1587      * Sets the {@code onmousedown} event handler for this element.
1588      * @param handler the {@code onmousedown} event handler for this element
1589      */
1590     @JsxSetter
1591     public void setOnmousedown(final Object handler) {
1592         setEventHandler("mousedown", handler);
1593     }
1594 
1595     /**
1596      * Returns the {@code onmousedown} event handler for this element.
1597      * @return the {@code onmousedown} event handler for this element
1598      */
1599     @JsxGetter
1600     public Object getOnmousedown() {
1601         return getEventHandler("mousedown");
1602     }
1603 
1604     /**
1605      * Sets the {@code onmousemove} event handler for this element.
1606      * @param handler the {@code onmousemove} event handler for this element
1607      */
1608     @JsxSetter
1609     public void setOnmousemove(final Object handler) {
1610         setEventHandler("mousemove", handler);
1611     }
1612 
1613     /**
1614      * Returns the {@code onmousemove} event handler for this element.
1615      * @return the {@code onmousemove} event handler for this element
1616      */
1617     @JsxGetter
1618     public Object getOnmousemove() {
1619         return getEventHandler("mousemove");
1620     }
1621 
1622     /**
1623      * Sets the {@code onmouseout} event handler for this element.
1624      * @param handler the {@code onmouseout} event handler for this element
1625      */
1626     @JsxSetter
1627     public void setOnmouseout(final Object handler) {
1628         setEventHandler("mouseout", handler);
1629     }
1630 
1631     /**
1632      * Returns the {@code onmouseout} event handler for this element.
1633      * @return the {@code onmouseout} event handler for this element
1634      */
1635     @JsxGetter
1636     public Object getOnmouseout() {
1637         return getEventHandler("mouseout");
1638     }
1639 
1640     /**
1641      * Sets the {@code onmouseover} event handler for this element.
1642      * @param handler the {@code onmouseover} event handler for this element
1643      */
1644     @JsxSetter
1645     public void setOnmouseover(final Object handler) {
1646         setEventHandler("mouseover", handler);
1647     }
1648 
1649     /**
1650      * Returns the {@code onmouseover} event handler for this element.
1651      * @return the {@code onmouseover} event handler for this element
1652      */
1653     @JsxGetter
1654     public Object getOnmouseover() {
1655         return getEventHandler("mouseover");
1656     }
1657 
1658     /**
1659      * Sets the {@code onmouseup} event handler for this element.
1660      * @param handler the {@code onmouseup} event handler for this element
1661      */
1662     @JsxSetter
1663     public void setOnmouseup(final Object handler) {
1664         setEventHandler("mouseup", handler);
1665     }
1666 
1667     /**
1668      * Returns the {@code onmouseup} event handler for this element.
1669      * @return the {@code onmouseup} event handler for this element
1670      */
1671     @JsxGetter
1672     public Object getOnmouseup() {
1673         return getEventHandler("mouseup");
1674     }
1675 
1676     /**
1677      * Sets the {@code oncontextmenu} event handler for this element.
1678      * @param handler the {@code oncontextmenu} event handler for this element
1679      */
1680     @JsxSetter
1681     public void setOncontextmenu(final Object handler) {
1682         setEventHandler("contextmenu", handler);
1683     }
1684 
1685     /**
1686      * Returns the {@code oncontextmenu} event handler for this element.
1687      * @return the {@code oncontextmenu} event handler for this element
1688      */
1689     @JsxGetter
1690     public Object getOncontextmenu() {
1691         return getEventHandler("contextmenu");
1692     }
1693 
1694     /**
1695      * Sets the {@code onresize} event handler for this element.
1696      * @param handler the {@code onresize} event handler for this element
1697      */
1698     @JsxSetter({CHROME, FF})
1699     public void setOnresize(final Object handler) {
1700         setEventHandler("resize", handler);
1701     }
1702 
1703     /**
1704      * Returns the {@code onresize} event handler for this element.
1705      * @return the {@code onresize} event handler for this element
1706      */
1707     @JsxGetter({CHROME, FF})
1708     public Object getOnresize() {
1709         return getEventHandler("resize");
1710     }
1711 
1712     /**
1713      * Sets the {@code onerror} event handler for this element.
1714      * @param handler the {@code onerror} event handler for this element
1715      */
1716     @JsxSetter
1717     public void setOnerror(final Object handler) {
1718         setEventHandler("error", handler);
1719     }
1720 
1721     /**
1722      * Returns the {@code onerror} event handler for this element.
1723      * @return the {@code onerror} event handler for this element
1724      */
1725     @JsxGetter
1726     public Object getOnerror() {
1727         return getEventHandler("error");
1728     }
1729 
1730     /**
1731      * Returns the {@code oninput} event handler for this element.
1732      * @return the {@code oninput} event handler for this element
1733      */
1734     @JsxGetter
1735     public Function getOninput() {
1736         return getEventHandler("input");
1737     }
1738 
1739     /**
1740      * Sets the {@code oninput} event handler for this element.
1741      * @param oninput the {@code oninput} event handler for this element
1742      */
1743     @JsxSetter
1744     public void setOninput(final Object oninput) {
1745         setEventHandler("input", oninput);
1746     }
1747 
1748     /**
1749      * Returns the {@code hidden} property.
1750      * @return the {@code hidden} property
1751      */
1752     @JsxGetter
1753     public boolean getHidden() {
1754         return false;
1755     }
1756 
1757     /**
1758      * {@inheritDoc}
1759      */
1760     @Override
1761     @JsxGetter({CHROME, FF})
1762     public int getChildElementCount() {
1763         int counter = 0;
1764         if (getPage().getDocumentElement() != null) {
1765             counter++;
1766         }
1767         return counter;
1768     }
1769 
1770     /**
1771      * Returns the element for the specified x coordinate and the specified y coordinate.
1772      * The current implementation always returns the &lt;body&gt; element.
1773      *
1774      * @param x the x offset, in pixels
1775      * @param y the y offset, in pixels
1776      * @return the element for the specified x coordinate and the specified y coordinate
1777      */
1778     @JsxFunction
1779     public Object elementFromPoint(final int x, final int y) {
1780         return null;
1781     }
1782 
1783     /**
1784      * Returns the value of the {@code forms} property.
1785      * @return the value of the {@code forms} property
1786      */
1787     @JsxGetter({CHROME, IE})
1788     public Object getForms() {
1789         return new HTMLCollection(getDomNodeOrDie(), false) {
1790             @Override
1791             protected boolean isMatching(final DomNode node) {
1792                 return node instanceof HtmlForm && node.getPrefix() == null;
1793             }
1794 
1795             @Override
1796             public Object call(final Context cx, final Scriptable scope,
1797                     final Scriptable thisObj, final Object[] args) {
1798                 if (getBrowserVersion().hasFeature(JS_DOCUMENT_FORMS_FUNCTION_SUPPORTED)) {
1799                     return super.call(cx, scope, thisObj, args);
1800                 }
1801                 throw Context.reportRuntimeError("TypeError: document.forms is not a function");
1802             }
1803         };
1804     }
1805 
1806     /**
1807      * Returns the value of the {@code embeds} property.
1808      * @return the value of the {@code embeds} property
1809      */
1810     @JsxGetter({CHROME, IE})
1811     public Object getEmbeds() {
1812         return new HTMLCollection(getDomNodeOrDie(), false) {
1813             @Override
1814             protected boolean isMatching(final DomNode node) {
1815                 return node instanceof HtmlEmbed;
1816             }
1817 
1818             @Override
1819             public Object call(final Context cx, final Scriptable scope,
1820                     final Scriptable thisObj, final Object[] args) {
1821                 if (getBrowserVersion().hasFeature(JS_DOCUMENT_FORMS_FUNCTION_SUPPORTED)) {
1822                     return super.call(cx, scope, thisObj, args);
1823                 }
1824                 throw Context.reportRuntimeError("TypeError: document.embeds is not a function");
1825             }
1826         };
1827     }
1828 
1829     /**
1830      * Returns the value of the {@code embeds} property.
1831      * @return the value of the {@code embeds} property
1832      */
1833     @JsxGetter({CHROME, IE})
1834     public Object getImages() {
1835         return new HTMLCollection(getDomNodeOrDie(), false) {
1836             @Override
1837             protected boolean isMatching(final DomNode node) {
1838                 return node instanceof HtmlImage;
1839             }
1840 
1841             @Override
1842             public Object call(final Context cx, final Scriptable scope,
1843                     final Scriptable thisObj, final Object[] args) {
1844                 if (getBrowserVersion().hasFeature(JS_DOCUMENT_FORMS_FUNCTION_SUPPORTED)) {
1845                     return super.call(cx, scope, thisObj, args);
1846                 }
1847                 throw Context.reportRuntimeError("TypeError: document.images is not a function");
1848             }
1849         };
1850     }
1851 
1852     /**
1853      * Returns the value of the {@code scripts} property.
1854      * @return the value of the {@code scripts} property
1855      */
1856     @JsxGetter({CHROME, IE})
1857     public Object getScripts() {
1858         return new HTMLCollection(getDomNodeOrDie(), false) {
1859             @Override
1860             protected boolean isMatching(final DomNode node) {
1861                 return node instanceof HtmlScript;
1862             }
1863 
1864             @Override
1865             public Object call(final Context cx, final Scriptable scope,
1866                     final Scriptable thisObj, final Object[] args) {
1867                 if (getBrowserVersion().hasFeature(JS_DOCUMENT_FORMS_FUNCTION_SUPPORTED)) {
1868                     return super.call(cx, scope, thisObj, args);
1869                 }
1870                 throw Context.reportRuntimeError("TypeError: document.scripts is not a function");
1871             }
1872         };
1873     }
1874 
1875     /**
1876      * Retrieves a collection of stylesheet objects representing the style sheets that correspond
1877      * to each instance of a Link or
1878      * {@link com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleDeclaration} object in the document.
1879      *
1880      * @return styleSheet collection
1881      */
1882     @JsxGetter
1883     public StyleSheetList getStyleSheets() {
1884         return new StyleSheetList(this);
1885     }
1886 
1887     /**
1888      * Returns the value of the {@code plugins} property.
1889      * @return the value of the {@code plugins} property
1890      */
1891     @JsxGetter({CHROME, IE})
1892     public Object getPlugins() {
1893         return getEmbeds();
1894     }
1895 
1896     /**
1897      * Returns the value of the JavaScript property {@code links}. Refer also to the
1898      * <a href="http://msdn.microsoft.com/en-us/library/ms537465.aspx">MSDN documentation</a>.
1899      * @return the value of this property
1900      */
1901     @JsxGetter({CHROME, IE})
1902     public Object getLinks() {
1903         return new HTMLCollection(getDomNodeOrDie(), true) {
1904             @Override
1905             protected boolean isMatching(final DomNode node) {
1906                 return (node instanceof HtmlAnchor || node instanceof HtmlArea)
1907                         && ((HtmlElement) node).hasAttribute("href");
1908             }
1909 
1910             @Override
1911             protected EffectOnCache getEffectOnCache(final HtmlAttributeChangeEvent event) {
1912                 final HtmlElement node = event.getHtmlElement();
1913                 if ((node instanceof HtmlAnchor || node instanceof HtmlArea) && "href".equals(event.getName())) {
1914                     return EffectOnCache.RESET;
1915                 }
1916                 return EffectOnCache.NONE;
1917             }
1918         };
1919     }
1920 
1921     /**
1922      * Returns all the descendant elements with the specified class name.
1923      * @param className the name to search for
1924      * @return all the descendant elements with the specified class name
1925      * @see <a href="https://developer.mozilla.org/en/DOM/document.getElementsByClassName">Mozilla doc</a>
1926      */
1927     @JsxFunction
1928     public HTMLCollection getElementsByClassName(final String className) {
1929         return null;
1930     }
1931 
1932     /**
1933      * Returns all HTML elements that have a {@code name} attribute with the specified value.
1934      *
1935      * Refer to <a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-71555259">
1936      * The DOM spec</a> for details.
1937      *
1938      * @param elementName - value of the {@code name} attribute to look for
1939      * @return all HTML elements that have a {@code name} attribute with the specified value
1940      */
1941     @JsxFunction({CHROME, IE})
1942     public HTMLCollection getElementsByName(final String elementName) {
1943         return null;
1944     }
1945 
1946     /**
1947      * Returns {@code false} if the active element in the document has no focus;
1948      * {@code true} if the active element in the document has focus.
1949      * @return whether the active element in the document has focus or not
1950      */
1951     @JsxFunction
1952     public boolean hasFocus() {
1953         return false;
1954     }
1955 
1956     /**
1957      * Returns this document's title.
1958      * @return this document's title
1959      */
1960     @JsxGetter
1961     public String getTitle() {
1962         return "";
1963     }
1964 
1965     /**
1966      * Sets this document's title.
1967      * @param title the new title
1968      */
1969     @JsxSetter
1970     public void setTitle(final String title) {
1971     }
1972 
1973     /**
1974      * {@inheritDoc}
1975      */
1976     @Override
1977     @JsxGetter({CHROME, FF})
1978     public HTMLCollection getChildren() {
1979         return super.getChildren();
1980     }
1981 
1982     /**
1983      * Returns the {@code contentType} property.
1984      * @return the {@code contentType} property
1985      */
1986     @JsxGetter({CHROME, FF})
1987     public String getContentType() {
1988         return getPage().getContentType();
1989     }
1990 
1991     /**
1992      * Returns the current selection.
1993      * @return the current selection
1994      */
1995     @JsxFunction(CHROME)
1996     public Selection getSelection() {
1997         return null;
1998     }
1999 
2000     /**
2001      * Returns this document's {@code head} element.
2002      * @return this document's {@code head} element
2003      */
2004     @JsxGetter({CHROME, IE})
2005     public Object getHead() {
2006         return null;
2007     }
2008 
2009     /**
2010      * Returns a string representing the encoding under which the document was parsed.
2011      * @return a string representing the encoding under which the document was parsed
2012      */
2013     @JsxGetter
2014     public String getInputEncoding() {
2015         final Charset encoding = getPage().getCharset();
2016         if (getBrowserVersion().hasFeature(HTMLDOCUMENT_CHARSET_LOWERCASE)) {
2017             return encoding.name();
2018         }
2019         return EncodingSniffer.translateEncodingLabel(encoding);
2020     }
2021 
2022     /**
2023      * Returns the last modification date of the document.
2024      * @see <a href="https://developer.mozilla.org/en/DOM/document.lastModified">Mozilla documentation</a>
2025      * @return the date as string
2026      */
2027     @JsxGetter
2028     public String getLastModified() {
2029         if (lastModified_ == null) {
2030             final WebResponse webResponse = getPage().getWebResponse();
2031             final Date lastModified;
2032             if (webResponse != null) {
2033                 String stringDate = webResponse.getResponseHeaderValue("Last-Modified");
2034                 if (stringDate == null) {
2035                     stringDate = webResponse.getResponseHeaderValue("Date");
2036                 }
2037                 lastModified = parseDateOrNow(stringDate);
2038             }
2039             else {
2040                 lastModified = new Date();
2041             }
2042             lastModified_ = new SimpleDateFormat(LAST_MODIFIED_DATE_FORMAT, Locale.ROOT).format(lastModified);
2043         }
2044         return lastModified_;
2045     }
2046 
2047     private static Date parseDateOrNow(final String stringDate) {
2048         final Date date = parseHttpDate(stringDate);
2049         if (date == null) {
2050             return new Date();
2051         }
2052         return date;
2053     }
2054 
2055     /**
2056      * Mock for the moment.
2057      * @return true for success
2058      */
2059     @JsxFunction({FF, IE})
2060     public boolean releaseCapture() {
2061         return true;
2062     }
2063 
2064     /**
2065      * Returns the ready state of the document.
2066      * @return the ready state of the document
2067      *
2068      * @see DomNode#READY_STATE_UNINITIALIZED
2069      * @see DomNode#READY_STATE_LOADING
2070      * @see DomNode#READY_STATE_LOADED
2071      * @see DomNode#READY_STATE_INTERACTIVE
2072      * @see DomNode#READY_STATE_COMPLETE
2073      */
2074     @JsxGetter
2075     public String getReadyState() {
2076         return getDomNodeOrDie().getReadyState();
2077     }
2078 
2079     /**
2080      * Does nothing special anymore.
2081      *
2082      * @param type the type of events to capture
2083      * @see Window#captureEvents(String)
2084      */
2085     @JsxFunction(IE)
2086     public void captureEvents(final String type) {
2087         // Empty.
2088     }
2089 
2090     /**
2091      * Does nothing special anymore.
2092      *
2093      * @param type the type of events to capture
2094      * @see Window#releaseEvents(String)
2095      */
2096     @JsxFunction(IE)
2097     public void releaseEvents(final String type) {
2098         // Empty.
2099     }
2100 
2101     /**
2102      * Returns the value of the {@code alinkColor} property.
2103      * @return the value of the {@code alinkColor} property
2104      */
2105     @JsxGetter(IE)
2106     public String getAlinkColor() {
2107         return "#0000ff";
2108     }
2109 
2110     /**
2111      * Sets the value of the {@code alinkColor} property.
2112      * @param color the value of the {@code alinkColor} property
2113      */
2114     @JsxSetter(IE)
2115     public void setAlinkColor(final String color) {
2116     }
2117 
2118     /**
2119      * Returns the value of the {@code bgColor} property.
2120      * @return the value of the {@code bgColor} property
2121      * @see <a href="http://msdn.microsoft.com/en-us/library/ms533505.aspx">MSDN Documentation</a>
2122      */
2123     @JsxGetter(IE)
2124     public String getBgColor() {
2125         return "#ffffff";
2126     }
2127 
2128     /**
2129      * Sets the value of the {@code bgColor} property.
2130      * @param color the value of the {@code bgColor} property
2131      * @see <a href="http://msdn.microsoft.com/en-us/library/ms533505.aspx">MSDN Documentation</a>
2132      */
2133     @JsxSetter(IE)
2134     public void setBgColor(final String color) {
2135     }
2136 
2137     /**
2138      * Returns the value of the {@code fgColor} property.
2139      * @return the value of the {@code fgColor} property
2140      */
2141     @JsxGetter(IE)
2142     public String getFgColor() {
2143         return "#000000";
2144     }
2145 
2146     /**
2147      * Sets the value of the {@code fgColor} property.
2148      * @param color the value of the {@code fgColor} property
2149      */
2150     @JsxSetter(IE)
2151     public void setFgColor(final String color) {
2152     }
2153 
2154     /**
2155      * Returns the value of the {@code linkColor} property.
2156      * @return the value of the {@code linkColor} property
2157      */
2158     @JsxGetter(IE)
2159     public String getLinkColor() {
2160         return "#0000ff";
2161     }
2162 
2163     /**
2164      * Sets the value of the {@code linkColor} property.
2165      * @param color the value of the {@code linkColor} property
2166      */
2167     @JsxSetter(IE)
2168     public void setLinkColor(final String color) {
2169     }
2170 
2171     /**
2172      * Returns the value of the {@code vlinkColor} property.
2173      * @return the value of the {@code vlinkColor} property
2174      */
2175     @JsxGetter(IE)
2176     public String getVlinkColor() {
2177         return "#800080";
2178     }
2179 
2180     /**
2181      * Sets the value of the {@code vlinkColor} property.
2182      * @param color the value of the {@code vlinkColor} property
2183      */
2184     @JsxSetter(IE)
2185     public void setVlinkColor(final String color) {
2186     }
2187 
2188     /**
2189      * Returns the value of the {@code frames} property.
2190      * @see <a href="http://msdn.microsoft.com/en-us/library/ms537459.aspx">MSDN documentation</a>
2191      * @return the live collection of frames contained by this document
2192      */
2193     @JsxGetter(IE)
2194     public Object getFrames() {
2195         if (ScriptableObject.getTopLevelScope(this) == null) {
2196             throw ScriptRuntime.constructError("Error", "Not implemented");
2197         }
2198         return getWindow().getFrames_js();
2199     }
2200 
2201     /**
2202      * {@inheritDoc}
2203      */
2204     @Override
2205     @JsxGetter({CHROME, FF})
2206     public Element getLastElementChild() {
2207         return super.getLastElementChild();
2208     }
2209 
2210     /**
2211      * {@inheritDoc}
2212      */
2213     @Override
2214     @JsxGetter({CHROME, FF})
2215     public Element getFirstElementChild() {
2216         return super.getFirstElementChild();
2217     }
2218 
2219     /**
2220      * Returns the {@code xmlEncoding} property.
2221      * @return the {@code xmlEncoding} property
2222      */
2223     @JsxGetter({CHROME, IE})
2224     public String getXmlEncoding() {
2225         String encoding = getPage().getXmlEncoding();
2226         if (encoding == null && getBrowserVersion().hasFeature(HTMLDOCUMENT_CHARSET_LOWERCASE)) {
2227             encoding = "";
2228         }
2229         return encoding;
2230     }
2231 
2232     /**
2233      * Returns the {@code xmlStandalone} property.
2234      * @return the {@code xmlStandalone} property
2235      */
2236     @JsxGetter({CHROME, IE})
2237     public boolean isXmlStandalone() {
2238         return getPage().getXmlStandalone();
2239     }
2240 
2241     /**
2242      * Returns the {@code xmlVersion} property.
2243      * @return the {@code xmlVersion} property
2244      */
2245     @JsxGetter({CHROME, IE})
2246     public String getXmlVersion() {
2247         String version = getPage().getXmlVersion();
2248         if (version == null && getBrowserVersion().hasFeature(HTMLDOCUMENT_CHARSET_LOWERCASE)) {
2249             version = "";
2250         }
2251         return version;
2252     }
2253 
2254     /**
2255      * Returns the {@code onabort} event handler for this element.
2256      * @return the {@code onabort} event handler for this element
2257      */
2258     @JsxGetter
2259     public Function getOnabort() {
2260         return getEventHandler("abort");
2261     }
2262 
2263     /**
2264      * Sets the {@code onabort} event handler for this element.
2265      * @param onabort the {@code onabort} event handler for this element
2266      */
2267     @JsxSetter
2268     public void setOnabort(final Object onabort) {
2269         setEventHandler("abort", onabort);
2270     }
2271 
2272     /**
2273      * Returns the {@code onauxclick} event handler for this element.
2274      * @return the {@code onauxclick} event handler for this element
2275      */
2276     @JsxGetter(CHROME)
2277     public Function getOnauxclick() {
2278         return getEventHandler("auxclick");
2279     }
2280 
2281     /**
2282      * Sets the {@code onauxclick} event handler for this element.
2283      * @param onauxclick the {@code onauxclick} event handler for this element
2284      */
2285     @JsxSetter(CHROME)
2286     public void setOnauxclick(final Object onauxclick) {
2287         setEventHandler("auxclick", onauxclick);
2288     }
2289 
2290     /**
2291      * Returns the {@code onbeforecopy} event handler for this element.
2292      * @return the {@code onbeforecopy} event handler for this element
2293      */
2294     @JsxGetter(CHROME)
2295     public Function getOnbeforecopy() {
2296         return getEventHandler("beforecopy");
2297     }
2298 
2299     /**
2300      * Sets the {@code onbeforecopy} event handler for this element.
2301      * @param onbeforecopy the {@code onbeforecopy} event handler for this element
2302      */
2303     @JsxSetter(CHROME)
2304     public void setOnbeforecopy(final Object onbeforecopy) {
2305         setEventHandler("beforecopy", onbeforecopy);
2306     }
2307 
2308     /**
2309      * Returns the {@code onbeforecut} event handler for this element.
2310      * @return the {@code onbeforecut} event handler for this element
2311      */
2312     @JsxGetter(CHROME)
2313     public Function getOnbeforecut() {
2314         return getEventHandler("beforecut");
2315     }
2316 
2317     /**
2318      * Sets the {@code onbeforecut} event handler for this element.
2319      * @param onbeforecut the {@code onbeforecut} event handler for this element
2320      */
2321     @JsxSetter(CHROME)
2322     public void setOnbeforecut(final Object onbeforecut) {
2323         setEventHandler("beforecut", onbeforecut);
2324     }
2325 
2326     /**
2327      * Returns the {@code onbeforepaste} event handler for this element.
2328      * @return the {@code onbeforepaste} event handler for this element
2329      */
2330     @JsxGetter(CHROME)
2331     public Function getOnbeforepaste() {
2332         return getEventHandler("beforepaste");
2333     }
2334 
2335     /**
2336      * Sets the {@code onbeforepaste} event handler for this element.
2337      * @param onbeforepaste the {@code onbeforepaste} event handler for this element
2338      */
2339     @JsxSetter(CHROME)
2340     public void setOnbeforepaste(final Object onbeforepaste) {
2341         setEventHandler("beforepaste", onbeforepaste);
2342     }
2343 
2344     /**
2345      * Returns the {@code oncancel} event handler for this element.
2346      * @return the {@code oncancel} event handler for this element
2347      */
2348     @JsxGetter(CHROME)
2349     public Function getOncancel() {
2350         return getEventHandler("cancel");
2351     }
2352 
2353     /**
2354      * Sets the {@code oncancel} event handler for this element.
2355      * @param oncancel the {@code oncancel} event handler for this element
2356      */
2357     @JsxSetter(CHROME)
2358     public void setOncancel(final Object oncancel) {
2359         setEventHandler("cancel", oncancel);
2360     }
2361 
2362     /**
2363      * Returns the {@code oncanplay} event handler for this element.
2364      * @return the {@code oncanplay} event handler for this element
2365      */
2366     @JsxGetter
2367     public Function getOncanplay() {
2368         return getEventHandler("canplay");
2369     }
2370 
2371     /**
2372      * Sets the {@code oncanplay} event handler for this element.
2373      * @param oncanplay the {@code oncanplay} event handler for this element
2374      */
2375     @JsxSetter
2376     public void setOncanplay(final Object oncanplay) {
2377         setEventHandler("canplay", oncanplay);
2378     }
2379 
2380     /**
2381      * Returns the {@code oncanplaythrough} event handler for this element.
2382      * @return the {@code oncanplaythrough} event handler for this element
2383      */
2384     @JsxGetter
2385     public Function getOncanplaythrough() {
2386         return getEventHandler("canplaythrough");
2387     }
2388 
2389     /**
2390      * Sets the {@code oncanplaythrough} event handler for this element.
2391      * @param oncanplaythrough the {@code oncanplaythrough} event handler for this element
2392      */
2393     @JsxSetter
2394     public void setOncanplaythrough(final Object oncanplaythrough) {
2395         setEventHandler("canplaythrough", oncanplaythrough);
2396     }
2397 
2398     /**
2399      * Returns the {@code onchange} event handler for this element.
2400      * @return the {@code onchange} event handler for this element
2401      */
2402     @JsxGetter
2403     public Function getOnchange() {
2404         return getEventHandler("change");
2405     }
2406 
2407     /**
2408      * Sets the {@code onchange} event handler for this element.
2409      * @param onchange the {@code onchange} event handler for this element
2410      */
2411     @JsxSetter
2412     public void setOnchange(final Object onchange) {
2413         setEventHandler("change", onchange);
2414     }
2415 
2416     /**
2417      * Returns the {@code onclose} event handler for this element.
2418      * @return the {@code onclose} event handler for this element
2419      */
2420     @JsxGetter(CHROME)
2421     public Function getOnclose() {
2422         return getEventHandler("close");
2423     }
2424 
2425     /**
2426      * Sets the {@code onclose} event handler for this element.
2427      * @param onclose the {@code onclose} event handler for this element
2428      */
2429     @JsxSetter(CHROME)
2430     public void setOnclose(final Object onclose) {
2431         setEventHandler("close", onclose);
2432     }
2433 
2434     /**
2435      * Returns the {@code oncopy} event handler for this element.
2436      * @return the {@code oncopy} event handler for this element
2437      */
2438     @JsxGetter({CHROME, FF})
2439     public Function getOncopy() {
2440         return getEventHandler("copy");
2441     }
2442 
2443     /**
2444      * Sets the {@code oncopy} event handler for this element.
2445      * @param oncopy the {@code oncopy} event handler for this element
2446      */
2447     @JsxSetter({CHROME, FF})
2448     public void setOncopy(final Object oncopy) {
2449         setEventHandler("copy", oncopy);
2450     }
2451 
2452     /**
2453      * Returns the {@code oncuechange} event handler for this element.
2454      * @return the {@code oncuechange} event handler for this element
2455      */
2456     @JsxGetter(CHROME)
2457     public Function getOncuechange() {
2458         return getEventHandler("cuechange");
2459     }
2460 
2461     /**
2462      * Sets the {@code oncuechange} event handler for this element.
2463      * @param oncuechange the {@code oncuechange} event handler for this element
2464      */
2465     @JsxSetter(CHROME)
2466     public void setOncuechange(final Object oncuechange) {
2467         setEventHandler("cuechange", oncuechange);
2468     }
2469 
2470     /**
2471      * Returns the {@code oncut} event handler for this element.
2472      * @return the {@code oncut} event handler for this element
2473      */
2474     @JsxGetter({CHROME, FF})
2475     public Function getOncut() {
2476         return getEventHandler("cut");
2477     }
2478 
2479     /**
2480      * Sets the {@code oncut} event handler for this element.
2481      * @param oncut the {@code oncut} event handler for this element
2482      */
2483     @JsxSetter({CHROME, FF})
2484     public void setOncut(final Object oncut) {
2485         setEventHandler("cut", oncut);
2486     }
2487 
2488     /**
2489      * Returns the {@code ondrag} event handler for this element.
2490      * @return the {@code ondrag} event handler for this element
2491      */
2492     @JsxGetter
2493     public Function getOndrag() {
2494         return getEventHandler("drag");
2495     }
2496 
2497     /**
2498      * Sets the {@code ondrag} event handler for this element.
2499      * @param ondrag the {@code ondrag} event handler for this element
2500      */
2501     @JsxSetter
2502     public void setOndrag(final Object ondrag) {
2503         setEventHandler("drag", ondrag);
2504     }
2505 
2506     /**
2507      * Returns the {@code ondragend} event handler for this element.
2508      * @return the {@code ondragend} event handler for this element
2509      */
2510     @JsxGetter
2511     public Function getOndragend() {
2512         return getEventHandler("dragend");
2513     }
2514 
2515     /**
2516      * Sets the {@code ondragend} event handler for this element.
2517      * @param ondragend the {@code ondragend} event handler for this element
2518      */
2519     @JsxSetter
2520     public void setOndragend(final Object ondragend) {
2521         setEventHandler("dragend", ondragend);
2522     }
2523 
2524     /**
2525      * Returns the {@code ondragenter} event handler for this element.
2526      * @return the {@code ondragenter} event handler for this element
2527      */
2528     @JsxGetter
2529     public Function getOndragenter() {
2530         return getEventHandler("dragenter");
2531     }
2532 
2533     /**
2534      * Sets the {@code ondragenter} event handler for this element.
2535      * @param ondragenter the {@code ondragenter} event handler for this element
2536      */
2537     @JsxSetter
2538     public void setOndragenter(final Object ondragenter) {
2539         setEventHandler("dragenter", ondragenter);
2540     }
2541 
2542     /**
2543      * Returns the {@code ondragleave} event handler for this element.
2544      * @return the {@code ondragleave} event handler for this element
2545      */
2546     @JsxGetter
2547     public Function getOndragleave() {
2548         return getEventHandler("dragleave");
2549     }
2550 
2551     /**
2552      * Sets the {@code ondragleave} event handler for this element.
2553      * @param ondragleave the {@code ondragleave} event handler for this element
2554      */
2555     @JsxSetter
2556     public void setOndragleave(final Object ondragleave) {
2557         setEventHandler("dragleave", ondragleave);
2558     }
2559 
2560     /**
2561      * Returns the {@code ondragover} event handler for this element.
2562      * @return the {@code ondragover} event handler for this element
2563      */
2564     @JsxGetter
2565     public Function getOndragover() {
2566         return getEventHandler("dragover");
2567     }
2568 
2569     /**
2570      * Sets the {@code ondragover} event handler for this element.
2571      * @param ondragover the {@code ondragover} event handler for this element
2572      */
2573     @JsxSetter
2574     public void setOndragover(final Object ondragover) {
2575         setEventHandler("dragover", ondragover);
2576     }
2577 
2578     /**
2579      * Returns the {@code ondragstart} event handler for this element.
2580      * @return the {@code ondragstart} event handler for this element
2581      */
2582     @JsxGetter
2583     public Function getOndragstart() {
2584         return getEventHandler("dragstart");
2585     }
2586 
2587     /**
2588      * Sets the {@code ondragstart} event handler for this element.
2589      * @param ondragstart the {@code ondragstart} event handler for this element
2590      */
2591     @JsxSetter
2592     public void setOndragstart(final Object ondragstart) {
2593         setEventHandler("dragstart", ondragstart);
2594     }
2595 
2596     /**
2597      * Returns the {@code ondrop} event handler for this element.
2598      * @return the {@code ondrop} event handler for this element
2599      */
2600     @JsxGetter
2601     public Function getOndrop() {
2602         return getEventHandler("drop");
2603     }
2604 
2605     /**
2606      * Sets the {@code ondrop} event handler for this element.
2607      * @param ondrop the {@code ondrop} event handler for this element
2608      */
2609     @JsxSetter
2610     public void setOndrop(final Object ondrop) {
2611         setEventHandler("drop", ondrop);
2612     }
2613 
2614     /**
2615      * Returns the {@code ondurationchange} event handler for this element.
2616      * @return the {@code ondurationchange} event handler for this element
2617      */
2618     @JsxGetter
2619     public Function getOndurationchange() {
2620         return getEventHandler("durationchange");
2621     }
2622 
2623     /**
2624      * Sets the {@code ondurationchange} event handler for this element.
2625      * @param ondurationchange the {@code ondurationchange} event handler for this element
2626      */
2627     @JsxSetter
2628     public void setOndurationchange(final Object ondurationchange) {
2629         setEventHandler("durationchange", ondurationchange);
2630     }
2631 
2632     /**
2633      * Returns the {@code onemptied} event handler for this element.
2634      * @return the {@code onemptied} event handler for this element
2635      */
2636     @JsxGetter
2637     public Function getOnemptied() {
2638         return getEventHandler("emptied");
2639     }
2640 
2641     /**
2642      * Sets the {@code onemptied} event handler for this element.
2643      * @param onemptied the {@code onemptied} event handler for this element
2644      */
2645     @JsxSetter
2646     public void setOnemptied(final Object onemptied) {
2647         setEventHandler("emptied", onemptied);
2648     }
2649 
2650     /**
2651      * Returns the {@code onended} event handler for this element.
2652      * @return the {@code onended} event handler for this element
2653      */
2654     @JsxGetter
2655     public Function getOnended() {
2656         return getEventHandler("ended");
2657     }
2658 
2659     /**
2660      * Sets the {@code onended} event handler for this element.
2661      * @param onended the {@code onended} event handler for this element
2662      */
2663     @JsxSetter
2664     public void setOnended(final Object onended) {
2665         setEventHandler("ended", onended);
2666     }
2667 
2668     /**
2669      * Returns the {@code ongotpointercapture} event handler for this element.
2670      * @return the {@code ongotpointercapture} event handler for this element
2671      */
2672     @JsxGetter(CHROME)
2673     public Function getOngotpointercapture() {
2674         return getEventHandler("gotpointercapture");
2675     }
2676 
2677     /**
2678      * Sets the {@code ongotpointercapture} event handler for this element.
2679      * @param ongotpointercapture the {@code ongotpointercapture} event handler for this element
2680      */
2681     @JsxSetter(CHROME)
2682     public void setOngotpointercapture(final Object ongotpointercapture) {
2683         setEventHandler("gotpointercapture", ongotpointercapture);
2684     }
2685 
2686     /**
2687      * Returns the {@code oninvalid} event handler for this element.
2688      * @return the {@code oninvalid} event handler for this element
2689      */
2690     @JsxGetter({CHROME, FF})
2691     public Function getOninvalid() {
2692         return getEventHandler("invalid");
2693     }
2694 
2695     /**
2696      * Sets the {@code oninvalid} event handler for this element.
2697      * @param oninvalid the {@code oninvalid} event handler for this element
2698      */
2699     @JsxSetter({CHROME, FF})
2700     public void setOninvalid(final Object oninvalid) {
2701         setEventHandler("invalid", oninvalid);
2702     }
2703 
2704     /**
2705      * Returns the {@code onload} event handler for this element.
2706      * @return the {@code onload} event handler for this element
2707      */
2708     @JsxGetter
2709     public Function getOnload() {
2710         return getEventHandler("load");
2711     }
2712 
2713     /**
2714      * Sets the {@code onload} event handler for this element.
2715      * @param onload the {@code onload} event handler for this element
2716      */
2717     @JsxSetter
2718     public void setOnload(final Object onload) {
2719         setEventHandler("load", onload);
2720     }
2721 
2722     /**
2723      * Returns the {@code onloadeddata} event handler for this element.
2724      * @return the {@code onloadeddata} event handler for this element
2725      */
2726     @JsxGetter
2727     public Function getOnloadeddata() {
2728         return getEventHandler("loadeddata");
2729     }
2730 
2731     /**
2732      * Sets the {@code onloadeddata} event handler for this element.
2733      * @param onloadeddata the {@code onloadeddata} event handler for this element
2734      */
2735     @JsxSetter
2736     public void setOnloadeddata(final Object onloadeddata) {
2737         setEventHandler("loadeddata", onloadeddata);
2738     }
2739 
2740     /**
2741      * Returns the {@code onloadedmetadata} event handler for this element.
2742      * @return the {@code onloadedmetadata} event handler for this element
2743      */
2744     @JsxGetter
2745     public Function getOnloadedmetadata() {
2746         return getEventHandler("loadedmetadata");
2747     }
2748 
2749     /**
2750      * Sets the {@code onloadedmetadata} event handler for this element.
2751      * @param onloadedmetadata the {@code onloadedmetadata} event handler for this element
2752      */
2753     @JsxSetter
2754     public void setOnloadedmetadata(final Object onloadedmetadata) {
2755         setEventHandler("loadedmetadata", onloadedmetadata);
2756     }
2757 
2758     /**
2759      * Returns the {@code onloadstart} event handler for this element.
2760      * @return the {@code onloadstart} event handler for this element
2761      */
2762     @JsxGetter
2763     public Function getOnloadstart() {
2764         return getEventHandler("loadstart");
2765     }
2766 
2767     /**
2768      * Sets the {@code onloadstart} event handler for this element.
2769      * @param onloadstart the {@code onloadstart} event handler for this element
2770      */
2771     @JsxSetter
2772     public void setOnloadstart(final Object onloadstart) {
2773         setEventHandler("loadstart", onloadstart);
2774     }
2775 
2776     /**
2777      * Returns the {@code onlostpointercapture} event handler for this element.
2778      * @return the {@code onlostpointercapture} event handler for this element
2779      */
2780     @JsxGetter(CHROME)
2781     public Function getOnlostpointercapture() {
2782         return getEventHandler("lostpointercapture");
2783     }
2784 
2785     /**
2786      * Sets the {@code onlostpointercapture} event handler for this element.
2787      * @param onlostpointercapture the {@code onlostpointercapture} event handler for this element
2788      */
2789     @JsxSetter(CHROME)
2790     public void setOnlostpointercapture(final Object onlostpointercapture) {
2791         setEventHandler("lostpointercapture", onlostpointercapture);
2792     }
2793 
2794     /**
2795      * Returns the {@code onmouseenter} event handler for this element.
2796      * @return the {@code onmouseenter} event handler for this element
2797      */
2798     @JsxGetter({CHROME, FF})
2799     public Function getOnmouseenter() {
2800         return getEventHandler("mouseenter");
2801     }
2802 
2803     /**
2804      * Sets the {@code onmouseenter} event handler for this element.
2805      * @param onmouseenter the {@code onmouseenter} event handler for this element
2806      */
2807     @JsxSetter({CHROME, FF})
2808     public void setOnmouseenter(final Object onmouseenter) {
2809         setEventHandler("mouseenter", onmouseenter);
2810     }
2811 
2812     /**
2813      * Returns the {@code onmouseleave} event handler for this element.
2814      * @return the {@code onmouseleave} event handler for this element
2815      */
2816     @JsxGetter({CHROME, FF})
2817     public Function getOnmouseleave() {
2818         return getEventHandler("mouseleave");
2819     }
2820 
2821     /**
2822      * Sets the {@code onmouseleave} event handler for this element.
2823      * @param onmouseleave the {@code onmouseleave} event handler for this element
2824      */
2825     @JsxSetter({CHROME, FF})
2826     public void setOnmouseleave(final Object onmouseleave) {
2827         setEventHandler("mouseleave", onmouseleave);
2828     }
2829 
2830     /**
2831      * Returns the {@code onmousewheel} event handler for this element.
2832      * @return the {@code onmousewheel} event handler for this element
2833      */
2834     @JsxGetter({CHROME, IE})
2835     public Function getOnmousewheel() {
2836         return getEventHandler("mousewheel");
2837     }
2838 
2839     /**
2840      * Sets the {@code onmousewheel} event handler for this element.
2841      * @param onmousewheel the {@code onmousewheel} event handler for this element
2842      */
2843     @JsxSetter({CHROME, IE})
2844     public void setOnmousewheel(final Object onmousewheel) {
2845         setEventHandler("mousewheel", onmousewheel);
2846     }
2847 
2848     /**
2849      * Returns the {@code onpaste} event handler for this element.
2850      * @return the {@code onpaste} event handler for this element
2851      */
2852     @JsxGetter({CHROME, FF})
2853     public Function getOnpaste() {
2854         return getEventHandler("paste");
2855     }
2856 
2857     /**
2858      * Sets the {@code onpaste} event handler for this element.
2859      * @param onpaste the {@code onpaste} event handler for this element
2860      */
2861     @JsxSetter({CHROME, FF})
2862     public void setOnpaste(final Object onpaste) {
2863         setEventHandler("paste", onpaste);
2864     }
2865 
2866     /**
2867      * Returns the {@code onpause} event handler for this element.
2868      * @return the {@code onpause} event handler for this element
2869      */
2870     @JsxGetter
2871     public Function getOnpause() {
2872         return getEventHandler("pause");
2873     }
2874 
2875     /**
2876      * Sets the {@code onpause} event handler for this element.
2877      * @param onpause the {@code onpause} event handler for this element
2878      */
2879     @JsxSetter
2880     public void setOnpause(final Object onpause) {
2881         setEventHandler("pause", onpause);
2882     }
2883 
2884     /**
2885      * Returns the {@code onplay} event handler for this element.
2886      * @return the {@code onplay} event handler for this element
2887      */
2888     @JsxGetter
2889     public Function getOnplay() {
2890         return getEventHandler("play");
2891     }
2892 
2893     /**
2894      * Sets the {@code onplay} event handler for this element.
2895      * @param onplay the {@code onplay} event handler for this element
2896      */
2897     @JsxSetter
2898     public void setOnplay(final Object onplay) {
2899         setEventHandler("play", onplay);
2900     }
2901 
2902     /**
2903      * Returns the {@code onplaying} event handler for this element.
2904      * @return the {@code onplaying} event handler for this element
2905      */
2906     @JsxGetter
2907     public Function getOnplaying() {
2908         return getEventHandler("playing");
2909     }
2910 
2911     /**
2912      * Sets the {@code onplaying} event handler for this element.
2913      * @param onplaying the {@code onplaying} event handler for this element
2914      */
2915     @JsxSetter
2916     public void setOnplaying(final Object onplaying) {
2917         setEventHandler("playing", onplaying);
2918     }
2919 
2920     /**
2921      * Returns the {@code onpointercancel} event handler for this element.
2922      * @return the {@code onpointercancel} event handler for this element
2923      */
2924     @JsxGetter({CHROME, IE})
2925     public Function getOnpointercancel() {
2926         return getEventHandler("pointercancel");
2927     }
2928 
2929     /**
2930      * Sets the {@code onpointercancel} event handler for this element.
2931      * @param onpointercancel the {@code onpointercancel} event handler for this element
2932      */
2933     @JsxSetter({CHROME, IE})
2934     public void setOnpointercancel(final Object onpointercancel) {
2935         setEventHandler("pointercancel", onpointercancel);
2936     }
2937 
2938     /**
2939      * Returns the {@code onpointerdown} event handler for this element.
2940      * @return the {@code onpointerdown} event handler for this element
2941      */
2942     @JsxGetter({CHROME, IE})
2943     public Function getOnpointerdown() {
2944         return getEventHandler("pointerdown");
2945     }
2946 
2947     /**
2948      * Sets the {@code onpointerdown} event handler for this element.
2949      * @param onpointerdown the {@code onpointerdown} event handler for this element
2950      */
2951     @JsxSetter({CHROME, IE})
2952     public void setOnpointerdown(final Object onpointerdown) {
2953         setEventHandler("pointerdown", onpointerdown);
2954     }
2955 
2956     /**
2957      * Returns the {@code onpointerenter} event handler for this element.
2958      * @return the {@code onpointerenter} event handler for this element
2959      */
2960     @JsxGetter({CHROME, IE})
2961     public Function getOnpointerenter() {
2962         return getEventHandler("pointerenter");
2963     }
2964 
2965     /**
2966      * Sets the {@code onpointerenter} event handler for this element.
2967      * @param onpointerenter the {@code onpointerenter} event handler for this element
2968      */
2969     @JsxSetter({CHROME, IE})
2970     public void setOnpointerenter(final Object onpointerenter) {
2971         setEventHandler("pointerenter", onpointerenter);
2972     }
2973 
2974     /**
2975      * Returns the {@code onpointerleave} event handler for this element.
2976      * @return the {@code onpointerleave} event handler for this element
2977      */
2978     @JsxGetter({CHROME, IE})
2979     public Function getOnpointerleave() {
2980         return getEventHandler("pointerleave");
2981     }
2982 
2983     /**
2984      * Sets the {@code onpointerleave} event handler for this element.
2985      * @param onpointerleave the {@code onpointerleave} event handler for this element
2986      */
2987     @JsxSetter({CHROME, IE})
2988     public void setOnpointerleave(final Object onpointerleave) {
2989         setEventHandler("pointerleave", onpointerleave);
2990     }
2991 
2992     /**
2993      * Returns the {@code onpointerlockchange} event handler for this element.
2994      * @return the {@code onpointerlockchange} event handler for this element
2995      */
2996     @JsxGetter({CHROME, FF52})
2997     public Function getOnpointerlockchange() {
2998         return getEventHandler("pointerlockchange");
2999     }
3000 
3001     /**
3002      * Sets the {@code onpointerlockchange} event handler for this element.
3003      * @param onpointerlockchange the {@code onpointerlockchange} event handler for this element
3004      */
3005     @JsxSetter({CHROME, FF52})
3006     public void setOnpointerlockchange(final Object onpointerlockchange) {
3007         setEventHandler("pointerlockchange", onpointerlockchange);
3008     }
3009 
3010     /**
3011      * Returns the {@code onpointerlockerror} event handler for this element.
3012      * @return the {@code onpointerlockerror} event handler for this element
3013      */
3014     @JsxGetter({CHROME, FF52})
3015     public Function getOnpointerlockerror() {
3016         return getEventHandler("pointerlockerror");
3017     }
3018 
3019     /**
3020      * Sets the {@code onpointerlockerror} event handler for this element.
3021      * @param onpointerlockerror the {@code onpointerlockerror} event handler for this element
3022      */
3023     @JsxSetter({CHROME, FF52})
3024     public void setOnpointerlockerror(final Object onpointerlockerror) {
3025         setEventHandler("pointerlockerror", onpointerlockerror);
3026     }
3027 
3028     /**
3029      * Returns the {@code onpointermove} event handler for this element.
3030      * @return the {@code onpointermove} event handler for this element
3031      */
3032     @JsxGetter({CHROME, IE})
3033     public Function getOnpointermove() {
3034         return getEventHandler("pointermove");
3035     }
3036 
3037     /**
3038      * Sets the {@code onpointermove} event handler for this element.
3039      * @param onpointermove the {@code onpointermove} event handler for this element
3040      */
3041     @JsxSetter({CHROME, IE})
3042     public void setOnpointermove(final Object onpointermove) {
3043         setEventHandler("pointermove", onpointermove);
3044     }
3045 
3046     /**
3047      * Returns the {@code onpointerout} event handler for this element.
3048      * @return the {@code onpointerout} event handler for this element
3049      */
3050     @JsxGetter({CHROME, IE})
3051     public Function getOnpointerout() {
3052         return getEventHandler("pointerout");
3053     }
3054 
3055     /**
3056      * Sets the {@code onpointerout} event handler for this element.
3057      * @param onpointerout the {@code onpointerout} event handler for this element
3058      */
3059     @JsxSetter({CHROME, IE})
3060     public void setOnpointerout(final Object onpointerout) {
3061         setEventHandler("pointerout", onpointerout);
3062     }
3063 
3064     /**
3065      * Returns the {@code onpointerover} event handler for this element.
3066      * @return the {@code onpointerover} event handler for this element
3067      */
3068     @JsxGetter({CHROME, IE})
3069     public Function getOnpointerover() {
3070         return getEventHandler("pointerover");
3071     }
3072 
3073     /**
3074      * Sets the {@code onpointerover} event handler for this element.
3075      * @param onpointerover the {@code onpointerover} event handler for this element
3076      */
3077     @JsxSetter({CHROME, IE})
3078     public void setOnpointerover(final Object onpointerover) {
3079         setEventHandler("pointerover", onpointerover);
3080     }
3081 
3082     /**
3083      * Returns the {@code onpointerup} event handler for this element.
3084      * @return the {@code onpointerup} event handler for this element
3085      */
3086     @JsxGetter({CHROME, IE})
3087     public Function getOnpointerup() {
3088         return getEventHandler("pointerup");
3089     }
3090 
3091     /**
3092      * Sets the {@code onpointerup} event handler for this element.
3093      * @param onpointerup the {@code onpointerup} event handler for this element
3094      */
3095     @JsxSetter({CHROME, IE})
3096     public void setOnpointerup(final Object onpointerup) {
3097         setEventHandler("pointerup", onpointerup);
3098     }
3099 
3100     /**
3101      * Returns the {@code onprogress} event handler for this element.
3102      * @return the {@code onprogress} event handler for this element
3103      */
3104     @JsxGetter
3105     public Function getOnprogress() {
3106         return getEventHandler("progress");
3107     }
3108 
3109     /**
3110      * Sets the {@code onprogress} event handler for this element.
3111      * @param onprogress the {@code onprogress} event handler for this element
3112      */
3113     @JsxSetter
3114     public void setOnprogress(final Object onprogress) {
3115         setEventHandler("progress", onprogress);
3116     }
3117 
3118     /**
3119      * Returns the {@code onratechange} event handler for this element.
3120      * @return the {@code onratechange} event handler for this element
3121      */
3122     @JsxGetter
3123     public Function getOnratechange() {
3124         return getEventHandler("ratechange");
3125     }
3126 
3127     /**
3128      * Sets the {@code onratechange} event handler for this element.
3129      * @param onratechange the {@code onratechange} event handler for this element
3130      */
3131     @JsxSetter
3132     public void setOnratechange(final Object onratechange) {
3133         setEventHandler("ratechange", onratechange);
3134     }
3135 
3136     /**
3137      * Returns the {@code onreadystatechange} event handler for this element.
3138      * @return the {@code onreadystatechange} event handler for this element
3139      */
3140     @JsxGetter
3141     public Function getOnreadystatechange() {
3142         return getEventHandler("readystatechange");
3143     }
3144 
3145     /**
3146      * Sets the {@code onreadystatechange} event handler for this element.
3147      * @param onreadystatechange the {@code onreadystatechange} event handler for this element
3148      */
3149     @JsxSetter
3150     public void setOnreadystatechange(final Object onreadystatechange) {
3151         setEventHandler("readystatechange", onreadystatechange);
3152     }
3153 
3154     /**
3155      * Returns the {@code onreset} event handler for this element.
3156      * @return the {@code onreset} event handler for this element
3157      */
3158     @JsxGetter
3159     public Function getOnreset() {
3160         return getEventHandler("reset");
3161     }
3162 
3163     /**
3164      * Sets the {@code onreset} event handler for this element.
3165      * @param onreset the {@code onreset} event handler for this element
3166      */
3167     @JsxSetter
3168     public void setOnreset(final Object onreset) {
3169         setEventHandler("reset", onreset);
3170     }
3171 
3172     /**
3173      * Returns the {@code onscroll} event handler for this element.
3174      * @return the {@code onscroll} event handler for this element
3175      */
3176     @JsxGetter
3177     public Function getOnscroll() {
3178         return getEventHandler("scroll");
3179     }
3180 
3181     /**
3182      * Sets the {@code onscroll} event handler for this element.
3183      * @param onscroll the {@code onscroll} event handler for this element
3184      */
3185     @JsxSetter
3186     public void setOnscroll(final Object onscroll) {
3187         setEventHandler("scroll", onscroll);
3188     }
3189 
3190     /**
3191      * Returns the {@code onsearch} event handler for this element.
3192      * @return the {@code onsearch} event handler for this element
3193      */
3194     @JsxGetter(CHROME)
3195     public Function getOnsearch() {
3196         return getEventHandler("search");
3197     }
3198 
3199     /**
3200      * Sets the {@code onsearch} event handler for this element.
3201      * @param onsearch the {@code onsearch} event handler for this element
3202      */
3203     @JsxSetter(CHROME)
3204     public void setOnsearch(final Object onsearch) {
3205         setEventHandler("search", onsearch);
3206     }
3207 
3208     /**
3209      * Returns the {@code onseeked} event handler for this element.
3210      * @return the {@code onseeked} event handler for this element
3211      */
3212     @JsxGetter
3213     public Function getOnseeked() {
3214         return getEventHandler("seeked");
3215     }
3216 
3217     /**
3218      * Sets the {@code onseeked} event handler for this element.
3219      * @param onseeked the {@code onseeked} event handler for this element
3220      */
3221     @JsxSetter
3222     public void setOnseeked(final Object onseeked) {
3223         setEventHandler("seeked", onseeked);
3224     }
3225 
3226     /**
3227      * Returns the {@code onseeking} event handler for this element.
3228      * @return the {@code onseeking} event handler for this element
3229      */
3230     @JsxGetter
3231     public Function getOnseeking() {
3232         return getEventHandler("seeking");
3233     }
3234 
3235     /**
3236      * Sets the {@code onseeking} event handler for this element.
3237      * @param onseeking the {@code onseeking} event handler for this element
3238      */
3239     @JsxSetter
3240     public void setOnseeking(final Object onseeking) {
3241         setEventHandler("seeking", onseeking);
3242     }
3243 
3244     /**
3245      * Returns the {@code onselect} event handler for this element.
3246      * @return the {@code onselect} event handler for this element
3247      */
3248     @JsxGetter
3249     public Function getOnselect() {
3250         return getEventHandler("select");
3251     }
3252 
3253     /**
3254      * Sets the {@code onselect} event handler for this element.
3255      * @param onselect the {@code onselect} event handler for this element
3256      */
3257     @JsxSetter
3258     public void setOnselect(final Object onselect) {
3259         setEventHandler("select", onselect);
3260     }
3261 
3262     /**
3263      * Returns the {@code onselectionchange} event handler for this element.
3264      * @return the {@code onselectionchange} event handler for this element
3265      */
3266     @JsxGetter({CHROME, IE, FF52})
3267     public Function getOnselectionchange() {
3268         return getEventHandler("selectionchange");
3269     }
3270 
3271     /**
3272      * Sets the {@code onselectionchange} event handler for this element.
3273      * @param onselectionchange the {@code onselectionchange} event handler for this element
3274      */
3275     @JsxSetter({CHROME, IE, FF52})
3276     public void setOnselectionchange(final Object onselectionchange) {
3277         setEventHandler("selectionchange", onselectionchange);
3278     }
3279 
3280     /**
3281      * Returns the {@code onselectstart} event handler for this element.
3282      * @return the {@code onselectstart} event handler for this element
3283      */
3284     @JsxGetter({CHROME, IE, FF52})
3285     public Function getOnselectstart() {
3286         return getEventHandler("selectstart");
3287     }
3288 
3289     /**
3290      * Sets the {@code onselectstart} event handler for this element.
3291      * @param onselectstart the {@code onselectstart} event handler for this element
3292      */
3293     @JsxSetter({CHROME, IE, FF52})
3294     public void setOnselectstart(final Object onselectstart) {
3295         setEventHandler("selectstart", onselectstart);
3296     }
3297 
3298     /**
3299      * Returns the {@code onshow} event handler for this element.
3300      * @return the {@code onshow} event handler for this element
3301      */
3302     @JsxGetter({CHROME, FF})
3303     public Function getOnshow() {
3304         return getEventHandler("show");
3305     }
3306 
3307     /**
3308      * Sets the {@code onshow} event handler for this element.
3309      * @param onshow the {@code onshow} event handler for this element
3310      */
3311     @JsxSetter({CHROME, FF})
3312     public void setOnshow(final Object onshow) {
3313         setEventHandler("show", onshow);
3314     }
3315 
3316     /**
3317      * Returns the {@code onstalled} event handler for this element.
3318      * @return the {@code onstalled} event handler for this element
3319      */
3320     @JsxGetter
3321     public Function getOnstalled() {
3322         return getEventHandler("stalled");
3323     }
3324 
3325     /**
3326      * Sets the {@code onstalled} event handler for this element.
3327      * @param onstalled the {@code onstalled} event handler for this element
3328      */
3329     @JsxSetter
3330     public void setOnstalled(final Object onstalled) {
3331         setEventHandler("stalled", onstalled);
3332     }
3333 
3334     /**
3335      * Returns the {@code onsubmit} event handler for this element.
3336      * @return the {@code onsubmit} event handler for this element
3337      */
3338     @JsxGetter
3339     public Function getOnsubmit() {
3340         return getEventHandler("submit");
3341     }
3342 
3343     /**
3344      * Sets the {@code onsubmit} event handler for this element.
3345      * @param onsubmit the {@code onsubmit} event handler for this element
3346      */
3347     @JsxSetter
3348     public void setOnsubmit(final Object onsubmit) {
3349         setEventHandler("submit", onsubmit);
3350     }
3351 
3352     /**
3353      * Returns the {@code onsuspend} event handler for this element.
3354      * @return the {@code onsuspend} event handler for this element
3355      */
3356     @JsxGetter
3357     public Function getOnsuspend() {
3358         return getEventHandler("suspend");
3359     }
3360 
3361     /**
3362      * Sets the {@code onsuspend} event handler for this element.
3363      * @param onsuspend the {@code onsuspend} event handler for this element
3364      */
3365     @JsxSetter
3366     public void setOnsuspend(final Object onsuspend) {
3367         setEventHandler("suspend", onsuspend);
3368     }
3369 
3370     /**
3371      * Returns the {@code ontimeupdate} event handler for this element.
3372      * @return the {@code ontimeupdate} event handler for this element
3373      */
3374     @JsxGetter
3375     public Function getOntimeupdate() {
3376         return getEventHandler("timeupdate");
3377     }
3378 
3379     /**
3380      * Sets the {@code ontimeupdate} event handler for this element.
3381      * @param ontimeupdate the {@code ontimeupdate} event handler for this element
3382      */
3383     @JsxSetter
3384     public void setOntimeupdate(final Object ontimeupdate) {
3385         setEventHandler("timeupdate", ontimeupdate);
3386     }
3387 
3388     /**
3389      * Returns the {@code ontoggle} event handler for this element.
3390      * @return the {@code ontoggle} event handler for this element
3391      */
3392     @JsxGetter({CHROME, FF52})
3393     public Function getOntoggle() {
3394         return getEventHandler("toggle");
3395     }
3396 
3397     /**
3398      * Sets the {@code ontoggle} event handler for this element.
3399      * @param ontoggle the {@code ontoggle} event handler for this element
3400      */
3401     @JsxSetter({CHROME, FF52})
3402     public void setOntoggle(final Object ontoggle) {
3403         setEventHandler("toggle", ontoggle);
3404     }
3405 
3406     /**
3407      * Returns the {@code onvolumechange} event handler for this element.
3408      * @return the {@code onvolumechange} event handler for this element
3409      */
3410     @JsxGetter
3411     public Function getOnvolumechange() {
3412         return getEventHandler("volumechange");
3413     }
3414 
3415     /**
3416      * Sets the {@code onvolumechange} event handler for this element.
3417      * @param onvolumechange the {@code onvolumechange} event handler for this element
3418      */
3419     @JsxSetter
3420     public void setOnvolumechange(final Object onvolumechange) {
3421         setEventHandler("volumechange", onvolumechange);
3422     }
3423 
3424     /**
3425      * Returns the {@code onwaiting} event handler for this element.
3426      * @return the {@code onwaiting} event handler for this element
3427      */
3428     @JsxGetter
3429     public Function getOnwaiting() {
3430         return getEventHandler("waiting");
3431     }
3432 
3433     /**
3434      * Sets the {@code onwaiting} event handler for this element.
3435      * @param onwaiting the {@code onwaiting} event handler for this element
3436      */
3437     @JsxSetter
3438     public void setOnwaiting(final Object onwaiting) {
3439         setEventHandler("waiting", onwaiting);
3440     }
3441 
3442     /**
3443      * Returns the {@code onwebkitfullscreenchange} event handler for this element.
3444      * @return the {@code onwebkitfullscreenchange} event handler for this element
3445      */
3446     @JsxGetter(CHROME)
3447     public Function getOnwebkitfullscreenchange() {
3448         return getEventHandler("webkitfullscreenchange");
3449     }
3450 
3451     /**
3452      * Sets the {@code onwebkitfullscreenchange} event handler for this element.
3453      * @param onwebkitfullscreenchange the {@code onwebkitfullscreenchange} event handler for this element
3454      */
3455     @JsxSetter(CHROME)
3456     public void setOnwebkitfullscreenchange(final Object onwebkitfullscreenchange) {
3457         setEventHandler("webkitfullscreenchange", onwebkitfullscreenchange);
3458     }
3459 
3460     /**
3461      * Returns the {@code onwebkitfullscreenerror} event handler for this element.
3462      * @return the {@code onwebkitfullscreenerror} event handler for this element
3463      */
3464     @JsxGetter(CHROME)
3465     public Function getOnwebkitfullscreenerror() {
3466         return getEventHandler("webkitfullscreenerror");
3467     }
3468 
3469     /**
3470      * Sets the {@code onwebkitfullscreenerror} event handler for this element.
3471      * @param onwebkitfullscreenerror the {@code onwebkitfullscreenerror} event handler for this element
3472      */
3473     @JsxSetter
3474     public void setOnwebkitfullscreenerror(final Object onwebkitfullscreenerror) {
3475         setEventHandler("webkitfullscreenerror", onwebkitfullscreenerror);
3476     }
3477 
3478     /**
3479      * Returns the {@code onwheel} event handler for this element.
3480      * @return the {@code onwheel} event handler for this element
3481      */
3482     @JsxGetter({CHROME, FF})
3483     public Function getOnwheel() {
3484         return getEventHandler("wheel");
3485     }
3486 
3487     /**
3488      * Sets the {@code onwheel} event handler for this element.
3489      * @param onwheel the {@code onwheel} event handler for this element
3490      */
3491     @JsxSetter({CHROME, FF})
3492     public void setOnwheel(final Object onwheel) {
3493         setEventHandler("wheel", onwheel);
3494     }
3495 
3496     /**
3497      * Returns the {@code onafterscriptexecute} event handler for this element.
3498      * @return the {@code onafterscriptexecute} event handler for this element
3499      */
3500     @JsxGetter(FF)
3501     public Function getOnafterscriptexecute() {
3502         return getEventHandler("afterscriptexecute");
3503     }
3504 
3505     /**
3506      * Sets the {@code onafterscriptexecute} event handler for this element.
3507      * @param onafterscriptexecute the {@code onafterscriptexecute} event handler for this element
3508      */
3509     @JsxSetter(FF)
3510     public void setOnafterscriptexecute(final Object onafterscriptexecute) {
3511         setEventHandler("afterscriptexecute", onafterscriptexecute);
3512     }
3513 
3514     /**
3515      * Returns the {@code onbeforescriptexecute} event handler for this element.
3516      * @return the {@code onbeforescriptexecute} event handler for this element
3517      */
3518     @JsxGetter(FF)
3519     public Function getOnbeforescriptexecute() {
3520         return getEventHandler("beforescriptexecute");
3521     }
3522 
3523     /**
3524      * Sets the {@code onbeforescriptexecute} event handler for this element.
3525      * @param onbeforescriptexecute the {@code onbeforescriptexecute} event handler for this element
3526      */
3527     @JsxSetter(FF)
3528     public void setOnbeforescriptexecute(final Object onbeforescriptexecute) {
3529         setEventHandler("beforescriptexecute", onbeforescriptexecute);
3530     }
3531 
3532     /**
3533      * Returns the {@code onmozfullscreenchange} event handler for this element.
3534      * @return the {@code onmozfullscreenchange} event handler for this element
3535      */
3536     @JsxGetter(FF)
3537     public Function getOnmozfullscreenchange() {
3538         return getEventHandler("mozfullscreenchange");
3539     }
3540 
3541     /**
3542      * Sets the {@code onmozfullscreenchange} event handler for this element.
3543      * @param onmozfullscreenchange the {@code onmozfullscreenchange} event handler for this element
3544      */
3545     @JsxSetter(FF)
3546     public void setOnmozfullscreenchange(final Object onmozfullscreenchange) {
3547         setEventHandler("mozfullscreenchange", onmozfullscreenchange);
3548     }
3549 
3550     /**
3551      * Returns the {@code onmozfullscreenerror} event handler for this element.
3552      * @return the {@code onmozfullscreenerror} event handler for this element
3553      */
3554     @JsxGetter(FF)
3555     public Function getOnmozfullscreenerror() {
3556         return getEventHandler("mozfullscreenerror");
3557     }
3558 
3559     /**
3560      * Sets the {@code onmozfullscreenerror} event handler for this element.
3561      * @param onmozfullscreenerror the {@code onmozfullscreenerror} event handler for this element
3562      */
3563     @JsxSetter(FF)
3564     public void setOnmozfullscreenerror(final Object onmozfullscreenerror) {
3565         setEventHandler("mozfullscreenerror", onmozfullscreenerror);
3566     }
3567 
3568     /**
3569      * Returns the {@code onmozpointerlockchange} event handler for this element.
3570      * @return the {@code onmozpointerlockchange} event handler for this element
3571      */
3572     @JsxGetter(FF45)
3573     public Function getOnmozpointerlockchange() {
3574         return getEventHandler("mozpointerlockchange");
3575     }
3576 
3577     /**
3578      * Sets the {@code onmozpointerlockchange} event handler for this element.
3579      * @param onmozpointerlockchange the {@code onmozpointerlockchange} event handler for this element
3580      */
3581     @JsxSetter(FF45)
3582     public void setOnmozpointerlockchange(final Object onmozpointerlockchange) {
3583         setEventHandler("mozpointerlockchange", onmozpointerlockchange);
3584     }
3585 
3586     /**
3587      * Returns the {@code onmozpointerlockerror} event handler for this element.
3588      * @return the {@code onmozpointerlockerror} event handler for this element
3589      */
3590     @JsxGetter(FF45)
3591     public Function getOnmozpointerlockerror() {
3592         return getEventHandler("mozpointerlockerror");
3593     }
3594 
3595     /**
3596      * Sets the {@code onmozpointerlockerror} event handler for this element.
3597      * @param onmozpointerlockerror the {@code onmozpointerlockerror} event handler for this element
3598      */
3599     @JsxSetter(FF45)
3600     public void setOnmozpointerlockerror(final Object onmozpointerlockerror) {
3601         setEventHandler("mozpointerlockerror", onmozpointerlockerror);
3602     }
3603 
3604     /**
3605      * Returns the {@code onhelp} event handler for this element.
3606      * @return the {@code onhelp} event handler for this element
3607      */
3608     @JsxGetter(IE)
3609     public Function getOnhelp() {
3610         return getEventHandler("help");
3611     }
3612 
3613     /**
3614      * Sets the {@code onhelp} event handler for this element.
3615      * @param onhelp the {@code onhelp} event handler for this element
3616      */
3617     @JsxSetter(IE)
3618     public void setOnhelp(final Object onhelp) {
3619         setEventHandler("help", onhelp);
3620     }
3621 
3622     /**
3623      * Returns the {@code onmscontentzoom} event handler for this element.
3624      * @return the {@code onmscontentzoom} event handler for this element
3625      */
3626     @JsxGetter(IE)
3627     public Function getOnmscontentzoom() {
3628         return getEventHandler("mscontentzoom");
3629     }
3630 
3631     /**
3632      * Sets the {@code onmscontentzoom} event handler for this element.
3633      * @param onmscontentzoom the {@code onmscontentzoom} event handler for this element
3634      */
3635     @JsxSetter(IE)
3636     public void setOnmscontentzoom(final Object onmscontentzoom) {
3637         setEventHandler("mscontentzoom", onmscontentzoom);
3638     }
3639 
3640     /**
3641      * Returns the {@code onmsfullscreenchange} event handler for this element.
3642      * @return the {@code onmsfullscreenchange} event handler for this element
3643      */
3644     @JsxGetter(IE)
3645     public Function getOnmsfullscreenchange() {
3646         return getEventHandler("msfullscreenchange");
3647     }
3648 
3649     /**
3650      * Sets the {@code onmsfullscreenchange} event handler for this element.
3651      * @param onmsfullscreenchange the {@code onmsfullscreenchange} event handler for this element
3652      */
3653     @JsxSetter(IE)
3654     public void setOnmsfullscreenchange(final Object onmsfullscreenchange) {
3655         setEventHandler("msfullscreenchange", onmsfullscreenchange);
3656     }
3657 
3658     /**
3659      * Returns the {@code onmsfullscreenerror} event handler for this element.
3660      * @return the {@code onmsfullscreenerror} event handler for this element
3661      */
3662     @JsxGetter(IE)
3663     public Function getOnmsfullscreenerror() {
3664         return getEventHandler("msfullscreenerror");
3665     }
3666 
3667     /**
3668      * Sets the {@code onmsfullscreenerror} event handler for this element.
3669      * @param onmsfullscreenerror the {@code onmsfullscreenerror} event handler for this element
3670      */
3671     @JsxSetter(IE)
3672     public void setOnmsfullscreenerror(final Object onmsfullscreenerror) {
3673         setEventHandler("msfullscreenerror", onmsfullscreenerror);
3674     }
3675 
3676     /**
3677      * Returns the {@code onmsgesturechange} event handler for this element.
3678      * @return the {@code onmsgesturechange} event handler for this element
3679      */
3680     @JsxGetter(IE)
3681     public Function getOnmsgesturechange() {
3682         return getEventHandler("msgesturechange");
3683     }
3684 
3685     /**
3686      * Sets the {@code onmsgesturechange} event handler for this element.
3687      * @param onmsgesturechange the {@code onmsgesturechange} event handler for this element
3688      */
3689     @JsxSetter(IE)
3690     public void setOnmsgesturechange(final Object onmsgesturechange) {
3691         setEventHandler("msgesturechange", onmsgesturechange);
3692     }
3693 
3694     /**
3695      * Returns the {@code onmsgesturedoubletap} event handler for this element.
3696      * @return the {@code onmsgesturedoubletap} event handler for this element
3697      */
3698     @JsxGetter(IE)
3699     public Function getOnmsgesturedoubletap() {
3700         return getEventHandler("msgesturedoubletap");
3701     }
3702 
3703     /**
3704      * Sets the {@code onmsgesturedoubletap} event handler for this element.
3705      * @param onmsgesturedoubletap the {@code onmsgesturedoubletap} event handler for this element
3706      */
3707     @JsxSetter(IE)
3708     public void setOnmsgesturedoubletap(final Object onmsgesturedoubletap) {
3709         setEventHandler("msgesturedoubletap", onmsgesturedoubletap);
3710     }
3711 
3712     /**
3713      * Returns the {@code onmsgestureend} event handler for this element.
3714      * @return the {@code onmsgestureend} event handler for this element
3715      */
3716     @JsxGetter(IE)
3717     public Function getOnmsgestureend() {
3718         return getEventHandler("msgestureend");
3719     }
3720 
3721     /**
3722      * Sets the {@code onmsgestureend} event handler for this element.
3723      * @param onmsgestureend the {@code onmsgestureend} event handler for this element
3724      */
3725     @JsxSetter(IE)
3726     public void setOnmsgestureend(final Object onmsgestureend) {
3727         setEventHandler("msgestureend", onmsgestureend);
3728     }
3729 
3730     /**
3731      * Returns the {@code onmsgesturehold} event handler for this element.
3732      * @return the {@code onmsgesturehold} event handler for this element
3733      */
3734     @JsxGetter(IE)
3735     public Function getOnmsgesturehold() {
3736         return getEventHandler("msgesturehold");
3737     }
3738 
3739     /**
3740      * Sets the {@code onmsgesturehold} event handler for this element.
3741      * @param onmsgesturehold the {@code onmsgesturehold} event handler for this element
3742      */
3743     @JsxSetter(IE)
3744     public void setOnmsgesturehold(final Object onmsgesturehold) {
3745         setEventHandler("msgesturehold", onmsgesturehold);
3746     }
3747 
3748     /**
3749      * Returns the {@code onmsgesturestart} event handler for this element.
3750      * @return the {@code onmsgesturestart} event handler for this element
3751      */
3752     @JsxGetter(IE)
3753     public Function getOnmsgesturestart() {
3754         return getEventHandler("msgesturestart");
3755     }
3756 
3757     /**
3758      * Sets the {@code onmsgesturestart} event handler for this element.
3759      * @param onmsgesturestart the {@code onmsgesturestart} event handler for this element
3760      */
3761     @JsxSetter(IE)
3762     public void setOnmsgesturestart(final Object onmsgesturestart) {
3763         setEventHandler("msgesturestart", onmsgesturestart);
3764     }
3765 
3766     /**
3767      * Returns the {@code onmsgesturetap} event handler for this element.
3768      * @return the {@code onmsgesturetap} event handler for this element
3769      */
3770     @JsxGetter(IE)
3771     public Function getOnmsgesturetap() {
3772         return getEventHandler("msgesturetap");
3773     }
3774 
3775     /**
3776      * Sets the {@code onmsgesturetap} event handler for this element.
3777      * @param onmsgesturetap the {@code onmsgesturetap} event handler for this element
3778      */
3779     @JsxSetter(IE)
3780     public void setOnmsgesturetap(final Object onmsgesturetap) {
3781         setEventHandler("msgesturetap", onmsgesturetap);
3782     }
3783 
3784     /**
3785      * Returns the {@code onmsinertiastart} event handler for this element.
3786      * @return the {@code onmsinertiastart} event handler for this element
3787      */
3788     @JsxGetter(IE)
3789     public Function getOnmsinertiastart() {
3790         return getEventHandler("msinertiastart");
3791     }
3792 
3793     /**
3794      * Sets the {@code onmsinertiastart} event handler for this element.
3795      * @param onmsinertiastart the {@code onmsinertiastart} event handler for this element
3796      */
3797     @JsxSetter(IE)
3798     public void setOnmsinertiastart(final Object onmsinertiastart) {
3799         setEventHandler("msinertiastart", onmsinertiastart);
3800     }
3801 
3802     /**
3803      * Returns the {@code onmsmanipulationstatechanged} event handler for this element.
3804      * @return the {@code onmsmanipulationstatechanged} event handler for this element
3805      */
3806     @JsxGetter(IE)
3807     public Function getOnmsmanipulationstatechanged() {
3808         return getEventHandler("msmanipulationstatechanged");
3809     }
3810 
3811     /**
3812      * Sets the {@code onmsmanipulationstatechanged} event handler for this element.
3813      * @param onmsmanipulationstatechanged the {@code onmsmanipulationstatechanged} event handler for this element
3814      */
3815     @JsxSetter(IE)
3816     public void setOnmsmanipulationstatechanged(final Object onmsmanipulationstatechanged) {
3817         setEventHandler("msmanipulationstatechanged", onmsmanipulationstatechanged);
3818     }
3819 
3820     /**
3821      * Returns the {@code onmspointercancel} event handler for this element.
3822      * @return the {@code onmspointercancel} event handler for this element
3823      */
3824     @JsxGetter(IE)
3825     public Function getOnmspointercancel() {
3826         return getEventHandler("mspointercancel");
3827     }
3828 
3829     /**
3830      * Sets the {@code onmspointercancel} event handler for this element.
3831      * @param onmspointercancel the {@code onmspointercancel} event handler for this element
3832      */
3833     @JsxSetter(IE)
3834     public void setOnmspointercancel(final Object onmspointercancel) {
3835         setEventHandler("mspointercancel", onmspointercancel);
3836     }
3837 
3838     /**
3839      * Returns the {@code onmspointerdown} event handler for this element.
3840      * @return the {@code onmspointerdown} event handler for this element
3841      */
3842     @JsxGetter(IE)
3843     public Function getOnmspointerdown() {
3844         return getEventHandler("mspointerdown");
3845     }
3846 
3847     /**
3848      * Sets the {@code onmspointerdown} event handler for this element.
3849      * @param onmspointerdown the {@code onmspointerdown} event handler for this element
3850      */
3851     @JsxSetter(IE)
3852     public void setOnmspointerdown(final Object onmspointerdown) {
3853         setEventHandler("mspointerdown", onmspointerdown);
3854     }
3855 
3856     /**
3857      * Returns the {@code onmspointerenter} event handler for this element.
3858      * @return the {@code onmspointerenter} event handler for this element
3859      */
3860     @JsxGetter(IE)
3861     public Function getOnmspointerenter() {
3862         return getEventHandler("mspointerenter");
3863     }
3864 
3865     /**
3866      * Sets the {@code onmspointerenter} event handler for this element.
3867      * @param onmspointerenter the {@code onmspointerenter} event handler for this element
3868      */
3869     @JsxSetter(IE)
3870     public void setOnmspointerenter(final Object onmspointerenter) {
3871         setEventHandler("mspointerenter", onmspointerenter);
3872     }
3873 
3874     /**
3875      * Returns the {@code onmspointerleave} event handler for this element.
3876      * @return the {@code onmspointerleave} event handler for this element
3877      */
3878     @JsxGetter(IE)
3879     public Function getOnmspointerleave() {
3880         return getEventHandler("mspointerleave");
3881     }
3882 
3883     /**
3884      * Sets the {@code onmspointerleave} event handler for this element.
3885      * @param onmspointerleave the {@code onmspointerleave} event handler for this element
3886      */
3887     @JsxSetter(IE)
3888     public void setOnmspointerleave(final Object onmspointerleave) {
3889         setEventHandler("mspointerleave", onmspointerleave);
3890     }
3891 
3892     /**
3893      * Returns the {@code onmspointermove} event handler for this element.
3894      * @return the {@code onmspointermove} event handler for this element
3895      */
3896     @JsxGetter(IE)
3897     public Function getOnmspointermove() {
3898         return getEventHandler("mspointermove");
3899     }
3900 
3901     /**
3902      * Sets the {@code onmspointermove} event handler for this element.
3903      * @param onmspointermove the {@code onmspointermove} event handler for this element
3904      */
3905     @JsxSetter(IE)
3906     public void setOnmspointermove(final Object onmspointermove) {
3907         setEventHandler("mspointermove", onmspointermove);
3908     }
3909 
3910     /**
3911      * Returns the {@code onmspointerout} event handler for this element.
3912      * @return the {@code onmspointerout} event handler for this element
3913      */
3914     @JsxGetter(IE)
3915     public Function getOnmspointerout() {
3916         return getEventHandler("mspointerout");
3917     }
3918 
3919     /**
3920      * Sets the {@code onmspointerout} event handler for this element.
3921      * @param onmspointerout the {@code onmspointerout} event handler for this element
3922      */
3923     @JsxSetter(IE)
3924     public void setOnmspointerout(final Object onmspointerout) {
3925         setEventHandler("mspointerout", onmspointerout);
3926     }
3927 
3928     /**
3929      * Returns the {@code onmspointerover} event handler for this element.
3930      * @return the {@code onmspointerover} event handler for this element
3931      */
3932     @JsxGetter(IE)
3933     public Function getOnmspointerover() {
3934         return getEventHandler("mspointerover");
3935     }
3936 
3937     /**
3938      * Sets the {@code onmspointerover} event handler for this element.
3939      * @param onmspointerover the {@code onmspointerover} event handler for this element
3940      */
3941     @JsxSetter(IE)
3942     public void setOnmspointerover(final Object onmspointerover) {
3943         setEventHandler("mspointerover", onmspointerover);
3944     }
3945 
3946     /**
3947      * Returns the {@code onmspointerup} event handler for this element.
3948      * @return the {@code onmspointerup} event handler for this element
3949      */
3950     @JsxGetter(IE)
3951     public Function getOnmspointerup() {
3952         return getEventHandler("mspointerup");
3953     }
3954 
3955     /**
3956      * Sets the {@code onmspointerup} event handler for this element.
3957      * @param onmspointerup the {@code onmspointerup} event handler for this element
3958      */
3959     @JsxSetter(IE)
3960     public void setOnmspointerup(final Object onmspointerup) {
3961         setEventHandler("mspointerup", onmspointerup);
3962     }
3963 
3964     /**
3965      * Returns the {@code onmssitemodejumplistitemremoved} event handler for this element.
3966      * @return the {@code onmssitemodejumplistitemremoved} event handler for this element
3967      */
3968     @JsxGetter(IE)
3969     public Function getOnmssitemodejumplistitemremoved() {
3970         return getEventHandler("mssitemodejumplistitemremoved");
3971     }
3972 
3973     /**
3974      * Sets the {@code onmssitemodejumplistitemremoved} event handler for this element.
3975      * @param onmssitemodejumplistitemremoved the {@code onmssitemodejumplistitemremoved} event handler for this element
3976      */
3977     @JsxSetter(IE)
3978     public void setOnmssitemodejumplistitemremoved(final Object onmssitemodejumplistitemremoved) {
3979         setEventHandler("mssitemodejumplistitemremoved", onmssitemodejumplistitemremoved);
3980     }
3981 
3982     /**
3983      * Returns the {@code onmsthumbnailclick} event handler for this element.
3984      * @return the {@code onmsthumbnailclick} event handler for this element
3985      */
3986     @JsxGetter(IE)
3987     public Function getOnmsthumbnailclick() {
3988         return getEventHandler("msthumbnailclick");
3989     }
3990 
3991     /**
3992      * Sets the {@code onmsthumbnailclick} event handler for this element.
3993      * @param onmsthumbnailclick the {@code onmsthumbnailclick} event handler for this element
3994      */
3995     @JsxSetter(IE)
3996     public void setOnmsthumbnailclick(final Object onmsthumbnailclick) {
3997         setEventHandler("msthumbnailclick", onmsthumbnailclick);
3998     }
3999 
4000     /**
4001      * Returns the {@code onstop} event handler for this element.
4002      * @return the {@code onstop} event handler for this element
4003      */
4004     @JsxGetter(IE)
4005     public Function getOnstop() {
4006         return getEventHandler("stop");
4007     }
4008 
4009     /**
4010      * Sets the {@code onstop} event handler for this element.
4011      * @param onstop the {@code onstop} event handler for this element
4012      */
4013     @JsxSetter(IE)
4014     public void setOnstop(final Object onstop) {
4015         setEventHandler("stop", onstop);
4016     }
4017 
4018     /**
4019      * Returns the {@code onstoragecommit} event handler for this element.
4020      * @return the {@code onstoragecommit} event handler for this element
4021      */
4022     @JsxGetter(IE)
4023     public Function getOnstoragecommit() {
4024         return getEventHandler("storagecommit");
4025     }
4026 
4027     /**
4028      * Sets the {@code onstoragecommit} event handler for this element.
4029      * @param onstoragecommit the {@code onstoragecommit} event handler for this element
4030      */
4031     @JsxSetter(IE)
4032     public void setOnstoragecommit(final Object onstoragecommit) {
4033         setEventHandler("storagecommit", onstoragecommit);
4034     }
4035 
4036     /**
4037      * Returns the {@code onactivate} event handler for this element.
4038      * @return the {@code onactivate} event handler for this element
4039      */
4040     @JsxGetter(IE)
4041     public Function getOnactivate() {
4042         return getEventHandler("activate");
4043     }
4044 
4045     /**
4046      * Sets the {@code onactivate} event handler for this element.
4047      * @param onactivate the {@code onactivate} event handler for this element
4048      */
4049     @JsxSetter(IE)
4050     public void setOnactivate(final Object onactivate) {
4051         setEventHandler("activate", onactivate);
4052     }
4053 
4054     /**
4055      * Returns the {@code onbeforeactivate} event handler for this element.
4056      * @return the {@code onbeforeactivate} event handler for this element
4057      */
4058     @JsxGetter(IE)
4059     public Function getOnbeforeactivate() {
4060         return getEventHandler("beforeactivate");
4061     }
4062 
4063     /**
4064      * Sets the {@code onbeforeactivate} event handler for this element.
4065      * @param onbeforeactivate the {@code onbeforeactivate} event handler for this element
4066      */
4067     @JsxSetter(IE)
4068     public void setOnbeforeactivate(final Object onbeforeactivate) {
4069         setEventHandler("beforeactivate", onbeforeactivate);
4070     }
4071 
4072     /**
4073      * Returns the {@code onbeforedeactivate} event handler for this element.
4074      * @return the {@code onbeforedeactivate} event handler for this element
4075      */
4076     @JsxGetter(IE)
4077     public Function getOnbeforedeactivate() {
4078         return getEventHandler("beforedeactivate");
4079     }
4080 
4081     /**
4082      * Sets the {@code onbeforedeactivate} event handler for this element.
4083      * @param onbeforedeactivate the {@code onbeforedeactivate} event handler for this element
4084      */
4085     @JsxSetter(IE)
4086     public void setOnbeforedeactivate(final Object onbeforedeactivate) {
4087         setEventHandler("beforedeactivate", onbeforedeactivate);
4088     }
4089 
4090     /**
4091      * Returns the {@code ondeactivate} event handler for this element.
4092      * @return the {@code ondeactivate} event handler for this element
4093      */
4094     @JsxGetter(IE)
4095     public Function getOndeactivate() {
4096         return getEventHandler("deactivate");
4097     }
4098 
4099     /**
4100      * Sets the {@code ondeactivate} event handler for this element.
4101      * @param ondeactivate the {@code ondeactivate} event handler for this element
4102      */
4103     @JsxSetter(IE)
4104     public void setOndeactivate(final Object ondeactivate) {
4105         setEventHandler("deactivate", ondeactivate);
4106     }
4107 
4108     /**
4109      * Returns the {@code onanimationend} event handler.
4110      * @return the {@code onanimationend} event handler
4111      */
4112     @JsxGetter(FF52)
4113     public Function getOnanimationend() {
4114         return getEventHandler("animationend");
4115     }
4116 
4117     /**
4118      * Sets the {@code onanimationend} event handler.
4119      * @param animationend the {@code onanimationend} event handler
4120      */
4121     @JsxSetter(FF52)
4122     public void setOnanimationend(final Object animationend) {
4123         setEventHandler("animationend", animationend);
4124     }
4125 
4126     /**
4127      * Returns the {@code onanimationiteration} event handler.
4128      * @return the {@code onanimationiteration} event handler
4129      */
4130     @JsxGetter(FF52)
4131     public Function getOnanimationiteration() {
4132         return getEventHandler("animationiteration");
4133     }
4134 
4135     /**
4136      * Sets the {@code onanimationiteration} event handler.
4137      * @param animationiteration the {@code onanimationiteration} event handler
4138      */
4139     @JsxSetter(FF52)
4140     public void setOnanimationiteration(final Object animationiteration) {
4141         setEventHandler("animationiteration", animationiteration);
4142     }
4143 
4144     /**
4145      * Returns the {@code onanimationstart} event handler.
4146      * @return the {@code onanimationstart} event handler
4147      */
4148     @JsxGetter(FF52)
4149     public Function getOnanimationstart() {
4150         return getEventHandler("animationstart");
4151     }
4152 
4153     /**
4154      * Sets the {@code onanimationstart} event handler.
4155      * @param animationstart the {@code onanimationstart} event handler
4156      */
4157     @JsxSetter(FF52)
4158     public void setOnanimationstart(final Object animationstart) {
4159         setEventHandler("animationstart", animationstart);
4160     }
4161 
4162     /**
4163      * Returns the {@code ondragexit} event handler.
4164      * @return the {@code ondragexit} event handler
4165      */
4166     @JsxGetter(FF52)
4167     public Function getOndragexit() {
4168         return getEventHandler("dragexit");
4169     }
4170 
4171     /**
4172      * Sets the {@code ondragexit} event handler.
4173      * @param dragexit the {@code ondragexit} event handler
4174      */
4175     @JsxSetter(FF52)
4176     public void setOndragexit(final Object dragexit) {
4177         setEventHandler("dragexit", dragexit);
4178     }
4179 
4180     /**
4181      * Returns the {@code onloadend} event handler.
4182      * @return the {@code onloadend} event handler
4183      */
4184     @JsxGetter(FF52)
4185     public Function getOnloadend() {
4186         return getEventHandler("loadend");
4187     }
4188 
4189     /**
4190      * Sets the {@code onloadend} event handler.
4191      * @param loadend the {@code onloadend} event handler
4192      */
4193     @JsxSetter(FF52)
4194     public void setOnloadend(final Object loadend) {
4195         setEventHandler("loadend", loadend);
4196     }
4197 
4198     /**
4199      * Returns the {@code ontransitionend} event handler.
4200      * @return the {@code ontransitionend} event handler
4201      */
4202     @JsxGetter(FF52)
4203     public Function getOntransitionend() {
4204         return getEventHandler("transitionend");
4205     }
4206 
4207     /**
4208      * Sets the {@code ontransitionend} event handler.
4209      * @param transitionend the {@code ontransitionend} event handler
4210      */
4211     @JsxSetter(FF52)
4212     public void setOntransitionend(final Object transitionend) {
4213         setEventHandler("transitionend", transitionend);
4214     }
4215 
4216     /**
4217      * Returns the {@code onwebkitanimationend} event handler.
4218      * @return the {@code onwebkitanimationend} event handler
4219      */
4220     @JsxGetter(FF52)
4221     public Function getOnwebkitanimationend() {
4222         return getEventHandler("webkitanimationend");
4223     }
4224 
4225     /**
4226      * Sets the {@code onwebkitanimationend} event handler.
4227      * @param webkitanimationend the {@code onwebkitanimationend} event handler
4228      */
4229     @JsxSetter(FF52)
4230     public void setOnwebkitanimationend(final Object webkitanimationend) {
4231         setEventHandler("webkitanimationend", webkitanimationend);
4232     }
4233 
4234     /**
4235      * Returns the {@code onwebkitanimationiteration} event handler.
4236      * @return the {@code onwebkitanimationiteration} event handler
4237      */
4238     @JsxGetter(FF52)
4239     public Function getOnwebkitanimationiteration() {
4240         return getEventHandler("webkitanimationiteration");
4241     }
4242 
4243     /**
4244      * Sets the {@code onwebkitanimationiteration} event handler.
4245      * @param webkitanimationiteration the {@code onwebkitanimationiteration} event handler
4246      */
4247     @JsxSetter(FF52)
4248     public void setOnwebkitanimationiteration(final Object webkitanimationiteration) {
4249         setEventHandler("webkitanimationiteration", webkitanimationiteration);
4250     }
4251 
4252     /**
4253      * Returns the {@code onwebkitanimationstart} event handler.
4254      * @return the {@code onwebkitanimationstart} event handler
4255      */
4256     @JsxGetter(FF52)
4257     public Function getOnwebkitanimationstart() {
4258         return getEventHandler("webkitanimationstart");
4259     }
4260 
4261     /**
4262      * Sets the {@code onwebkitanimationstart} event handler.
4263      * @param webkitanimationstart the {@code onwebkitanimationstart} event handler
4264      */
4265     @JsxSetter(FF52)
4266     public void setOnwebkitanimationstart(final Object webkitanimationstart) {
4267         setEventHandler("webkitanimationstart", webkitanimationstart);
4268     }
4269 
4270     /**
4271      * Returns the {@code onwebkittransitionend} event handler.
4272      * @return the {@code onwebkittransitionend} event handler
4273      */
4274     @JsxGetter(FF52)
4275     public Function getOnwebkittransitionend() {
4276         return getEventHandler("webkittransitionend");
4277     }
4278 
4279     /**
4280      * Sets the {@code onwebkittransitionend} event handler.
4281      * @param webkittransitionend the {@code onwebkittransitionend} event handler
4282      */
4283     @JsxSetter(FF52)
4284     public void setOnwebkittransitionend(final Object webkittransitionend) {
4285         setEventHandler("webkittransitionend", webkittransitionend);
4286     }
4287 
4288 }