Skip to content
Permalink
Browse files

Editorial: define Event attribute defaults through IDL

Fixes https://www.w3.org/Bugs/Public/show_bug.cgi?id=25099.

The argument Ian puts forward no longer holds water. All events are to
be created through their constructor. (There is probably some cleanup
to be done here down the road, but this is a good first step.)
  • Loading branch information...
annevk committed Mar 22, 2016
1 parent 6152327 commit 0be02299f128cbb7c65a7ce259fdd838fd44a4b5
Showing with 79 additions and 100 deletions.
  1. +79 −100 source
179 source
};

dictionary <dfn>TrackEventInit</dfn> : <span>EventInit</span> {
(<span>VideoTrack</span> or <span>AudioTrack</span> or <span>TextTrack</span>)? track;
(<span>VideoTrack</span> or <span>AudioTrack</span> or <span>TextTrack</span>)? track = null;
};</pre>

<dl class="domintro">
<div w-nodev>

<p>The <dfn><code data-x="dom-TrackEvent-track">track</code></dfn> attribute must return the value
it was initialised to. When the object is created, this attribute must be initialised to null. It
represents the context information for the event.</p>
it was initialised to. It represents the context information for the event.</p>

</div>

};

dictionary <dfn>AutocompleteErrorEventInit</dfn> : <span>EventInit</span> {
<span>AutocompleteErrorReason</span> reason;
<span>AutocompleteErrorReason</span> reason = "";

This comment has been minimized.

Copy link
@domenic

domenic Mar 22, 2016

Member

Link to dom-AutocompleteErrorReason-none like the removed text does?

This comment has been minimized.

Copy link
@annevk

annevk Mar 22, 2016

Author Member

That does not seem feasible. As it would be inside the quotes per convention.

This comment has been minimized.

Copy link
@domenic

domenic Mar 22, 2016

Member

Hmm I guess so.

};</pre>

<dl class="domintro">
<div w-nodev>

<p>The <dfn><code data-x="dom-AutocompleteErrorEvent-reason">reason</code></dfn> attribute must
return the value it was initialised to. When the object is created, this attribute must be
initialised to the <span data-x="dom-AutocompleteErrorReason-none">empty string</span>. It
represents the context information for the event.</p>
return the value it was initialised to. It represents the context information for the event.</p>

</div>

};

dictionary <dfn>RelatedEventInit</dfn> : <span>EventInit</span> {
<span>EventTarget</span>? relatedTarget;
<span>EventTarget</span>? relatedTarget = null;
};</pre>

<dl class="domintro">

<div w-nodev>

<p>The <dfn><code data-x="dom-RelatedEvent-relatedTarget">relatedTarget</code></dfn> attribute must
return the value it was initialised to. When the object is created, this attribute must be
initialised to null. It represents the other event target that is related to the event.</p>
<p>The <dfn><code data-x="dom-RelatedEvent-relatedTarget">relatedTarget</code></dfn> attribute
must return the value it was initialised to. It represents the other event target that is related
to the event.</p>

</div>

};

partial dictionary <span>MouseEventInit</span> {
DOMString? region;
DOMString? region = null;
};</pre>

<dl class="domintro">
<div w-nodev>

<p>The <dfn><code data-x="dom-MouseEvent-region">region</code></dfn> attribute on
<code>MouseEvent</code> objects must return the value it was initialised to. When the object is
created, this attribute must be initialised to null. It represents the <span>hit region's
ID</span> if the mouse was over a hit region when the event was fired.</p>
<code>MouseEvent</code> objects must return the value it was initialised to. It represents the
<span>hit region's ID</span> if the mouse was over a hit region when the event was fired.</p>

<p>When a <code>MouseEvent</code> is to be fired at a <code>canvas</code> element by the user
agent in response to a pointing device action other than a click (e.g. a <code
};

dictionary <dfn>PopStateEventInit</dfn> : <span>EventInit</span> {
any state;
any state = null;
};</pre>

<dl class="domintro">
<div w-nodev>

<p>The <dfn><code data-x="dom-PopStateEvent-state">state</code></dfn> attribute must return the
value it was initialised to. When the object is created, this attribute must be initialised to
null. It represents the context information for the event, or null, if the state represented is
the initial state of the <code>Document</code>.</p>
value it was initialised to. It represents the context information for the event, or null, if the
state represented is the initial state of the <code>Document</code>.</p>

</div>

};

dictionary <dfn>HashChangeEventInit</dfn> : <span>EventInit</span> {
DOMString oldURL;
DOMString newURL;
DOMString oldURL = null;

This comment has been minimized.

Copy link
@domenic

domenic Mar 22, 2016

Member

USVString these, or no?

This comment has been minimized.

Copy link
@annevk

annevk Mar 22, 2016

Author Member

Yeah. I'll file a PR.

DOMString newURL = null;
};</pre>

<dl class="domintro">

<div w-nodev>

<p>The <dfn><code data-x="dom-HashChangeEvent-oldURL">oldURL</code></dfn> attribute must return the
value it was initialised to. When the object is created, this attribute must be initialised to
null. It represents context information for the event, specifically the URL of the <span>session
history entry</span> that was traversed from.</p>
<p>The <dfn><code data-x="dom-HashChangeEvent-oldURL">oldURL</code></dfn> attribute must return
the value it was initialised to. It represents context information for the event, specifically the
URL of the <span>session history entry</span> that was traversed from.</p>

<p>The <dfn><code data-x="dom-HashChangeEvent-newURL">newURL</code></dfn> attribute must return the
value it was initialised to. When the object is created, this attribute must be initialised to
null. It represents context information for the event, specifically the URL of the <span>session
history entry</span> that was traversed to.</p>
<p>The <dfn><code data-x="dom-HashChangeEvent-newURL">newURL</code></dfn> attribute must return
the value it was initialised to. It represents context information for the event, specifically the
URL of the <span>session history entry</span> that was traversed to.</p>

</div>

};

dictionary <dfn>PageTransitionEventInit</dfn> : <span>EventInit</span> {
boolean persisted;
boolean persisted = false;
};</pre>

<dl class="domintro">
<div w-nodev>

<p>The <dfn><code data-x="dom-PageTransitionEvent-persisted">persisted</code></dfn> attribute must
return the value it was initialised to. When the object is created, this attribute must be
initialised to false. It represents the context information for the event.</p>
return the value it was initialised to. It represents the context information for the event.</p>

</div>

};

dictionary <dfn>ErrorEventInit</dfn> : <span>EventInit</span> {
DOMString message;
DOMString filename;
unsigned long lineno;
unsigned long colno;
any error;
DOMString message = "";
DOMString filename = "";
unsigned long lineno = 0;
unsigned long colno = 0;
any error = null;
};</pre>

<p>The <dfn><code data-x="dom-ErrorEvent-message">message</code></dfn> attribute must return the
value it was initialised to. When the object is created, this attribute must be initialised to the
empty string. It represents the error message.</p>
value it was initialised to. It represents the error message.</p>

<p>The <dfn><code data-x="dom-ErrorEvent-filename">filename</code></dfn> attribute must return the
value it was initialised to. When the object is created, this attribute must be initialised to the
empty string. It represents the <span>absolute URL</span> of the script in which the error
originally occurred.</p>
value it was initialised to. It represents the <span>absolute URL</span> of the script in which
the error originally occurred.</p>

<p>The <dfn><code data-x="dom-ErrorEvent-lineno">lineno</code></dfn> attribute must return the
value it was initialised to. When the object is created, this attribute must be initialised to
zero. It represents the line number where the error occurred in the script.</p>
value it was initialised to. It represents the line number where the error occurred in the
script.</p>

<p>The <dfn><code data-x="dom-ErrorEvent-colno">colno</code></dfn> attribute must return the value
it was initialised to. When the object is created, this attribute must be initialised to zero. It
represents the column number where the error occurred in the script.</p>
it was initialised to. It represents the column number where the error occurred in the script.</p>

<p>The <dfn><code data-x="dom-ErrorEvent-error">error</code></dfn> attribute must return the value
it was initialised to. When the object is created, this attribute must be initialised to null.
Where appropriate, it is set to the object representing the error (e.g. the exception object in
the case of an uncaught DOM exception).</p>
it was initialised to. Where appropriate, it is set to the object representing the error (e.g.,
the exception object in the case of an uncaught DOM exception).</p>

<h5>Unhandled promise rejections</h5>

};

dictionary <dfn>MessageEventInit</dfn> : <span>EventInit</span> {
any data;
DOMString origin;
DOMString lastEventId;
(<span>WindowProxy</span> or <span>MessagePort</span>)? source;
sequence&lt;<span>MessagePort</span>&gt;? ports;
any data = null;
DOMString origin = "";

This comment has been minimized.

Copy link
@domenic

domenic Mar 22, 2016

Member

USVString?

This comment has been minimized.

Copy link
@annevk

annevk Mar 22, 2016

Author Member

Yeah, I guess.

DOMString lastEventId = "";
(<span>WindowProxy</span> or <span>MessagePort</span>)? source = null;
sequence&lt;<span>MessagePort</span>&gt;? ports = null;
};</pre>

<dl class="domintro">
<div w-nodev>

<p>The <dfn><code data-x="dom-MessageEvent-data">data</code></dfn> attribute must return the value
it was initialised to. When the object is created, this attribute must be initialised to null. It
represents the message being sent.</p>
it was initialised to. It represents the message being sent.</p>

<p>The <dfn><code data-x="dom-MessageEvent-origin">origin</code></dfn> attribute must return the
value it was initialised to. When the object is created, this attribute must be initialised to the
empty string. It represents, in <span>server-sent events</span> and <span>cross-document
messaging</span>, the <span>origin</span> of the document that sent the message (typically the
scheme, hostname, and port of the document, but not its path or <span
value it was initialised to. It represents, in <span>server-sent events</span> and
<span>cross-document messaging</span>, the <span>origin</span> of the document that sent the
message (typically the scheme, hostname, and port of the document, but not its path or <span
data-x="concept-url-fragment">fragment</span>).</p>

<p>The <dfn><code data-x="dom-MessageEvent-lastEventId">lastEventId</code></dfn> attribute must
return the value it was initialised to. When the object is created, this attribute must be
initialised to the empty string. It represents, in <span>server-sent events</span>, the <span
data-x="concept-event-stream-last-event-id">last event ID string</span> of the event source.</p>
return the value it was initialised to. It represents, in <span>server-sent events</span>, the
<span data-x="concept-event-stream-last-event-id">last event ID string</span> of the event
source.</p>

<p>The <dfn><code data-x="dom-MessageEvent-source">source</code></dfn> attribute must return the
value it was initialised to. When the object is created, this attribute must be initialised to
null. It represents, in <span>cross-document messaging</span>, the <code>WindowProxy</code> of the
<span>browsing context</span> of the <code>Window</code> object from which the message came; and
in the <code data-x="event-WorkerGlobalScope-connect">connect</code> events used by <span
value it was initialised to. It represents, in <span>cross-document messaging</span>, the
<code>WindowProxy</code> of the <span>browsing context</span> of the <code>Window</code> object
from which the message came; and in the <code
data-x="event-WorkerGlobalScope-connect">connect</code> events used by <span
data-x="SharedWorkerGlobalScope">shared workers</span>, the newly connecting
<code>MessagePort</code>.</p>

<p>The <dfn><code data-x="dom-MessageEvent-ports">ports</code></dfn> attribute must return the
value it was initialised to. When the object is created, this attribute must be initialised to
null<!-- a <span data-x="dfn-read-only-array">read only</span> empty array-->. It represents, in
<span>cross-document messaging</span> and <span>channel messaging</span>, the
<code>MessagePort</code> array being sent, if any.</p>
value it was initialised to. It represents, in <span>cross-document messaging</span> and
<span>channel messaging</span>, the <code>MessagePort</code> array being sent, if any.</p>

<!-- handwave this one since it's deprecated anyway... let me know if there's interop issues -->
<p>The <dfn><code data-x="dom-MessageEvent-initMessageEvent">initMessageEvent()</code></dfn>
interface <dfn>CloseEvent</dfn> : <span>Event</span> {
readonly attribute boolean <span data-x="dom-CloseEvent-wasClean">wasClean</span>;
readonly attribute unsigned short <span data-x="dom-CloseEvent-code">code</span>;
readonly attribute DOMString <span data-x="dom-CloseEvent-reason">reason</span>;
readonly attribute USVString <span data-x="dom-CloseEvent-reason">reason</span>;

This comment has been minimized.

Copy link
@domenic

domenic Mar 22, 2016

Member

Why is this one USVString?

This comment has been minimized.

Copy link
@annevk

annevk Mar 22, 2016

Author Member

The corresponding attribute on WebSocket is too.

};

dictionary <dfn>CloseEventInit</dfn> : <span>EventInit</span> {
boolean wasClean;
unsigned short code;
DOMString reason;
boolean wasClean = false;
unsigned short code = 0;
USVString reason = "";
};</pre>

<p>The <dfn><code data-x="dom-CloseEvent-wasClean">wasClean</code></dfn> attribute must return the
value it was initialised to. When the object is created, this attribute must be initialised to
false. It represents whether the connection closed cleanly or not.</p>
value it was initialised to. It represents whether the connection closed cleanly or not.</p>

<p>The <dfn><code data-x="dom-CloseEvent-code">code</code></dfn> attribute must return the value it
was initialised to. When the object is created, this attribute must be initialised to zero. It
represents the WebSocket connection close code provided by the server.</p>
<p>The <dfn><code data-x="dom-CloseEvent-code">code</code></dfn> attribute must return the value
it was initialised to. It represents the WebSocket connection close code provided by the
server.</p>

<p>The <dfn><code data-x="dom-CloseEvent-reason">reason</code></dfn> attribute must return the
value it was initialised to. When the object is created, this attribute must be initialised to
empty string. It represents the WebSocket connection close reason provided by the server.</p>
value it was initialised to. It represents the WebSocket connection close reason provided by the
server.</p>



readonly attribute DOMString? <span data-x="dom-StorageEvent-key">key</span>;
readonly attribute DOMString? <span data-x="dom-StorageEvent-oldValue">oldValue</span>;
readonly attribute DOMString? <span data-x="dom-StorageEvent-newValue">newValue</span>;
readonly attribute DOMString <span data-x="dom-StorageEvent-url">url</span>;
readonly attribute USVString <span data-x="dom-StorageEvent-url">url</span>;
readonly attribute <span>Storage</span>? <span data-x="dom-StorageEvent-storageArea">storageArea</span>;
};

dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
DOMString? key;
DOMString? oldValue;
DOMString? newValue;
DOMString url;
<span>Storage</span>? storageArea;
DOMString? key = null;
DOMString? oldValue = null;
DOMString? newValue = null;
USVString url = "";
<span>Storage</span>? storageArea = null;
};</pre>

<p>The <dfn><code data-x="dom-StorageEvent-key">key</code></dfn> attribute must return the value it
was initialised to. When the object is created, this attribute must be initialised to null. It
represents the key being changed.</p>
<p>The <dfn><code data-x="dom-StorageEvent-key">key</code></dfn> attribute must return the value
it was initialised to. It represents the key being changed.</p>

<p>The <dfn><code data-x="dom-StorageEvent-oldValue">oldValue</code></dfn> attribute must return
the value it was initialised to. When the object is created, this attribute must be initialised to
null. It represents the old value of the key being changed.</p>
the value it was initialised to. It represents the old value of the key being changed.</p>

<p>The <dfn><code data-x="dom-StorageEvent-newValue">newValue</code></dfn> attribute must return
the value it was initialised to. When the object is created, this attribute must be initialised to
null. It represents the new value of the key being changed.</p>
the value it was initialised to. It represents the new value of the key being changed.</p>

<p>The <dfn><code data-x="dom-StorageEvent-url">url</code></dfn> attribute must return the value it
was initialised to. When the object is created, this attribute must be initialised to the empty
string. It represents the address of the document whose key changed.</p>
<p>The <dfn><code data-x="dom-StorageEvent-url">url</code></dfn> attribute must return the value
it was initialised to. It represents the address of the document whose key changed.</p>

<p>The <dfn><code data-x="dom-StorageEvent-storageArea">storageArea</code></dfn> attribute must
return the value it was initialised to. When the object is created, this attribute must be
initialised to null. It represents the <code>Storage</code> object that was affected.</p>
return the value it was initialised to. It represents the <code>Storage</code> object that was
affected.</p>


<h3>Disk space</h3>

0 comments on commit 0be0229

Please sign in to comment.
You can’t perform that action at this time.