• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hazendaz / httpunit / 639

05 Dec 2025 03:41AM UTC coverage: 80.509%. Remained the same
639

push

github

hazendaz
[jautodoc] All the source package

3213 of 4105 branches covered (78.27%)

Branch coverage included in aggregate %.

8249 of 10132 relevant lines covered (81.42%)

0.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/com/meterware/httpunit/javascript/events/Event.java
1
/*
2
 * MIT License
3
 *
4
 * Copyright 2011-2025 Russell Gold
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
7
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
8
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
9
 * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
 *
11
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions
12
 * of the Software.
13
 *
14
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
15
 * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
17
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18
 * DEALINGS IN THE SOFTWARE.
19
 */
20
package com.meterware.httpunit.javascript.events;
21

22
import org.mozilla.javascript.ScriptableObject;
23

24
/**
25
 * The Class Event.
26
 */
27
public abstract class Event extends ScriptableObject {
×
28
    // -- Scriptable interface ------------------------------------------------------------------
29

30
    /** The Constant serialVersionUID. */
31
    private static final long serialVersionUID = 1L;
32

33
    /** JavaScript class name. */
34
    private static final String JS_CLASS_NAME = "Event";
35

36
    /**
37
     * {@inheritDoc}
38
     */
39
    @Override
40
    public String getClassName() {
41
        return JS_CLASS_NAME;
×
42
    }
43

44
    // -- DOM2 Events specification -------------------------------------------------------------
45

46
    /**
47
     * The current event phase is the capturing phase.
48
     */
49
    public static final short CAPTURING_PHASE = 1;
50

51
    /**
52
     * The event is currently being evaluated at the target EventTarget.
53
     */
54
    public static final short AT_TARGET = 2;
55

56
    /**
57
     * The current event phase is the bubbling phase.
58
     */
59
    public static final short BUBBLING_PHASE = 3;
60

61
    /**
62
     * The name of the event (case-insensitive). The name must be an XML name.
63
     */
64
    private String type;
65

66
    /**
67
     * Used to indicate whether or not an event is a bubbling event. If the event can bubble the value is true, else the
68
     * value is false.
69
     */
70
    private boolean bubbles;
71

72
    /**
73
     * Used to indicate whether or not an event can have its default action prevented. If the default action can be
74
     * prevented the value is true, else the value is false.
75
     */
76
    private boolean cancelable;
77

78
    /**
79
     * Used to specify the time (in milliseconds relative to the epoch) at which the event was created. Due to the fact
80
     * that some systems may not provide this information the value of timeStamp may be not available for all events.
81
     * When not available, a value of 0 will be returned. Examples of epoch time are the time of the system start or
82
     * 0:0:0 UTC 1st January 1970.
83
     */
84
    private long timeStamp;
85

86
    /**
87
     * The name of the event (case-insensitive). The name must be an XML name.
88
     *
89
     * @return the string
90
     */
91
    public String jsGet_type() {
92
        return type;
×
93
    }
94

95
    /**
96
     * Used to indicate whether or not an event is a bubbling event. If the event can bubble the value is true, else the
97
     * value is false.
98
     *
99
     * @return true, if successful
100
     */
101
    public boolean jsGet_bubbles() {
102
        return bubbles;
×
103
    }
104

105
    /**
106
     * Used to specify the time (in milliseconds relative to the epoch) at which the event was created. Due to the fact
107
     * that some systems may not provide this information the value of timeStamp may be not available for all events.
108
     * When not available, a value of 0 will be returned. Examples of epoch time are the time of the system start or
109
     * 0:0:0 UTC 1st January 1970.
110
     *
111
     * @return true, if successful
112
     */
113
    public boolean jsGet_cancelable() {
114
        return cancelable;
×
115
    }
116

117
    /**
118
     * Used to specify the time (in milliseconds relative to the epoch) at which the event was created. Due to the fact
119
     * that some systems may not provide this information the value of timeStamp may be not available for all events.
120
     * When not available, a value of 0 will be returned. Examples of epoch time are the time of the system start or
121
     * 0:0:0 UTC 1st January 1970.
122
     *
123
     * @return the long
124
     */
125
    public long jsGet_timeStamp() {
126
        return timeStamp;
×
127
    }
128

129
    /**
130
     * Used to indicate the EventTarget to which the event was originally dispatched.
131
     *
132
     * @return the event target
133
     */
134
    public abstract EventTarget jsGet_target();
135

136
    /**
137
     * Used to indicate the EventTarget whose EventListeners are currently being processed. This is particularly useful
138
     * during capturing and bubbling.
139
     *
140
     * @return the event target
141
     */
142
    public abstract EventTarget jsGet_currentTarget();
143

144
    /**
145
     * Used to indicate which phase of event flow is currently being evaluated.
146
     *
147
     * @return the short
148
     */
149
    public abstract short jsGet_eventPhase();
150

151
    /**
152
     * The stopPropagation method is used prevent further propagation of an event during event flow. If this method is
153
     * called by any EventListener the event will cease propagating through the tree. The event will complete dispatch
154
     * to all listeners on the current EventTarget before event flow stops. This method may be used during any stage of
155
     * event flow.
156
     */
157
    public abstract void jsFunction_stopPropagation();
158

159
    /**
160
     * If an event is cancelable, the preventDefault method is used to signify that the event is to be canceled, meaning
161
     * any default action normally taken by the implementation as a result of the event will not occur. If, during any
162
     * stage of event flow, the preventDefault method is called the event is canceled. Any default action associated
163
     * with the event will not occur. Calling this method for a non-cancelable event has no effect. Once preventDefault
164
     * has been called it will remain in effect throughout the remainder of the event's propagation. This method may be
165
     * used during any stage of event flow.
166
     */
167
    public abstract void jsFunction_preventDefault();
168

169
    /**
170
     * The initEvent method is used to initialize the value of an Event created through the DocumentEvent interface.
171
     * This method may only be called before the Event has been dispatched via the dispatchEvent method, though it may
172
     * be called multiple times during that phase if necessary. If called multiple times the final invocation takes
173
     * precedence. If called from a subclass of Event interface only the values specified in the initEvent method are
174
     * modified, all other attributes are left unchanged.
175
     *
176
     * @param eventTypeArg
177
     *            Specifies the event type. This type may be any event type currently defined in this specification or a
178
     *            new event type.. The string must be an XML name. Any new event type must not begin with any upper,
179
     *            lower, or mixed case version of the string "DOM". This prefix is reserved for future DOM event sets.
180
     *            It is also strongly recommended that third parties adding their own events use their own prefix to
181
     *            avoid confusion and lessen the probability of conflicts with other new events.
182
     * @param canBubbleArg
183
     *            Specifies whether or not the event can bubble.
184
     * @param cancelableArg
185
     *            Specifies whether or not the event's default action can be prevented.
186
     */
187
    public void jsFunction_initEvent(String eventTypeArg, boolean canBubbleArg, boolean cancelableArg) {
188
        type = eventTypeArg;
×
189
        bubbles = canBubbleArg;
×
190
        cancelable = cancelableArg;
×
191
    }
×
192
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc