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

hazendaz / httpunit / 755

14 Feb 2026 07:14PM UTC coverage: 80.526%. Remained the same
755

push

github

hazendaz
[ci] Fix badge

3213 of 4105 branches covered (78.27%)

Branch coverage included in aggregate %.

8245 of 10124 relevant lines covered (81.44%)

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
 * SPDX-License-Identifier: MIT
3
 * See LICENSE file for details.
4
 *
5
 * Copyright 2000-2026 Russell Gold
6
 * Copyright 2021-2000 hazendaz
7
 */
8
package com.meterware.httpunit.javascript.events;
9

10
import org.mozilla.javascript.ScriptableObject;
11

12
/**
13
 * The Class Event.
14
 */
15
public abstract class Event extends ScriptableObject {
×
16
    // -- Scriptable interface ------------------------------------------------------------------
17

18
    /** The Constant serialVersionUID. */
19
    private static final long serialVersionUID = 1L;
20

21
    /** JavaScript class name. */
22
    private static final String JS_CLASS_NAME = "Event";
23

24
    /**
25
     * {@inheritDoc}
26
     */
27
    @Override
28
    public String getClassName() {
29
        return JS_CLASS_NAME;
×
30
    }
31

32
    // -- DOM2 Events specification -------------------------------------------------------------
33

34
    /**
35
     * The current event phase is the capturing phase.
36
     */
37
    public static final short CAPTURING_PHASE = 1;
38

39
    /**
40
     * The event is currently being evaluated at the target EventTarget.
41
     */
42
    public static final short AT_TARGET = 2;
43

44
    /**
45
     * The current event phase is the bubbling phase.
46
     */
47
    public static final short BUBBLING_PHASE = 3;
48

49
    /**
50
     * The name of the event (case-insensitive). The name must be an XML name.
51
     */
52
    private String type;
53

54
    /**
55
     * Used to indicate whether or not an event is a bubbling event. If the event can bubble the value is true, else the
56
     * value is false.
57
     */
58
    private boolean bubbles;
59

60
    /**
61
     * Used to indicate whether or not an event can have its default action prevented. If the default action can be
62
     * prevented the value is true, else the value is false.
63
     */
64
    private boolean cancelable;
65

66
    /**
67
     * Used to specify the time (in milliseconds relative to the epoch) at which the event was created. Due to the fact
68
     * that some systems may not provide this information the value of timeStamp may be not available for all events.
69
     * When not available, a value of 0 will be returned. Examples of epoch time are the time of the system start or
70
     * 0:0:0 UTC 1st January 1970.
71
     */
72
    private long timeStamp;
73

74
    /**
75
     * The name of the event (case-insensitive). The name must be an XML name.
76
     *
77
     * @return the string
78
     */
79
    public String jsGet_type() {
80
        return type;
×
81
    }
82

83
    /**
84
     * Used to indicate whether or not an event is a bubbling event. If the event can bubble the value is true, else the
85
     * value is false.
86
     *
87
     * @return true, if successful
88
     */
89
    public boolean jsGet_bubbles() {
90
        return bubbles;
×
91
    }
92

93
    /**
94
     * Used to specify the time (in milliseconds relative to the epoch) at which the event was created. Due to the fact
95
     * that some systems may not provide this information the value of timeStamp may be not available for all events.
96
     * When not available, a value of 0 will be returned. Examples of epoch time are the time of the system start or
97
     * 0:0:0 UTC 1st January 1970.
98
     *
99
     * @return true, if successful
100
     */
101
    public boolean jsGet_cancelable() {
102
        return cancelable;
×
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 the long
112
     */
113
    public long jsGet_timeStamp() {
114
        return timeStamp;
×
115
    }
116

117
    /**
118
     * Used to indicate the EventTarget to which the event was originally dispatched.
119
     *
120
     * @return the event target
121
     */
122
    public abstract EventTarget jsGet_target();
123

124
    /**
125
     * Used to indicate the EventTarget whose EventListeners are currently being processed. This is particularly useful
126
     * during capturing and bubbling.
127
     *
128
     * @return the event target
129
     */
130
    public abstract EventTarget jsGet_currentTarget();
131

132
    /**
133
     * Used to indicate which phase of event flow is currently being evaluated.
134
     *
135
     * @return the short
136
     */
137
    public abstract short jsGet_eventPhase();
138

139
    /**
140
     * The stopPropagation method is used prevent further propagation of an event during event flow. If this method is
141
     * called by any EventListener the event will cease propagating through the tree. The event will complete dispatch
142
     * to all listeners on the current EventTarget before event flow stops. This method may be used during any stage of
143
     * event flow.
144
     */
145
    public abstract void jsFunction_stopPropagation();
146

147
    /**
148
     * If an event is cancelable, the preventDefault method is used to signify that the event is to be canceled, meaning
149
     * any default action normally taken by the implementation as a result of the event will not occur. If, during any
150
     * stage of event flow, the preventDefault method is called the event is canceled. Any default action associated
151
     * with the event will not occur. Calling this method for a non-cancelable event has no effect. Once preventDefault
152
     * has been called it will remain in effect throughout the remainder of the event's propagation. This method may be
153
     * used during any stage of event flow.
154
     */
155
    public abstract void jsFunction_preventDefault();
156

157
    /**
158
     * The initEvent method is used to initialize the value of an Event created through the DocumentEvent interface.
159
     * This method may only be called before the Event has been dispatched via the dispatchEvent method, though it may
160
     * be called multiple times during that phase if necessary. If called multiple times the final invocation takes
161
     * precedence. If called from a subclass of Event interface only the values specified in the initEvent method are
162
     * modified, all other attributes are left unchanged.
163
     *
164
     * @param eventTypeArg
165
     *            Specifies the event type. This type may be any event type currently defined in this specification or a
166
     *            new event type.. The string must be an XML name. Any new event type must not begin with any upper,
167
     *            lower, or mixed case version of the string "DOM". This prefix is reserved for future DOM event sets.
168
     *            It is also strongly recommended that third parties adding their own events use their own prefix to
169
     *            avoid confusion and lessen the probability of conflicts with other new events.
170
     * @param canBubbleArg
171
     *            Specifies whether or not the event can bubble.
172
     * @param cancelableArg
173
     *            Specifies whether or not the event's default action can be prevented.
174
     */
175
    public void jsFunction_initEvent(String eventTypeArg, boolean canBubbleArg, boolean cancelableArg) {
176
        type = eventTypeArg;
×
177
        bubbles = canBubbleArg;
×
178
        cancelable = cancelableArg;
×
179
    }
×
180
}
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