Bug 1441019 - Migrate dom module docs to RST. r?whimboo
MozReview-Commit-ID: FAgW1K0pIJs
--- a/testing/marionette/dom.js
+++ b/testing/marionette/dom.js
@@ -5,34 +5,32 @@
"use strict";
this.EXPORTED_SYMBOLS = [
"ContentEventObserverService",
"WebElementEventTarget",
];
/**
- * The {@link EventTarget} for web elements can be used to observe DOM
+ * The ``EventTarget`` for web elements can be used to observe DOM
* events in the content document.
*
* A caveat of the current implementation is that it is only possible
- * to listen for top-level <code>window</code> global events.
+ * to listen for top-level ``window`` global events.
*
- * It needs to be backed by a {@link ContentEventObserverService} in a
- * content frame script.
+ * It needs to be backed by a :js:class:`ContentEventObserverService`
+ * in a content frame script.
*
- * Usage:
+ * Usage::
*
- * <pre><code>
* let observer = new WebElementEventTarget(messageManager);
* await new Promise(resolve => {
* observer.addEventListener("visibilitychange", resolve, {once: true});
* chromeWindow.minimize();
* });
- * </code></pre>
*/
class WebElementEventTarget {
/**
* @param {function(): nsIMessageListenerManager} messageManagerFn
* Message manager to the current browser.
*/
constructor(messageManager) {
this.mm = messageManager;
@@ -42,23 +40,23 @@ class WebElementEventTarget {
/**
* Register an event handler of a specific event type from the content
* frame.
*
* @param {string} type
* Event type to listen for.
* @param {EventListener} listener
- * Object which receives a notification (a {@link BareEvent})
+ * Object which receives a notification (a ``BareEvent``)
* when an event of the specified type occurs. This must be
- * an object implementing the {@link EventListener} interface,
+ * an object implementing the ``EventListener`` interface,
* or a JavaScript function.
* @param {boolean=} once
- * Indicates that the <var>listener</var> should be invoked at
- * most once after being added. If true, the <var>listener</var>
+ * Indicates that the ``listener`` should be invoked at
+ * most once after being added. If true, the ``listener``
* would automatically be removed when invoked.
*/
addEventListener(type, listener, {once = false} = {}) {
if (!(type in this.listeners)) {
this.listeners[type] = [];
}
if (!this.listeners[type].includes(listener)) {
@@ -122,17 +120,17 @@ class WebElementEventTarget {
};
this.dispatchEvent(ev);
}
}
this.WebElementEventTarget = WebElementEventTarget;
/**
* Provides the frame script backend for the
- * {@link WebElementEventTarget}.
+ * :js:class:`WebElementEventTarget`.
*
* This service receives requests for new DOM events to listen for and
* to cease listening for, and despatches IPC messages to the browser
* when they fire.
*/
class ContentEventObserverService {
/**
* @param {WindowProxy} windowGlobal
@@ -144,18 +142,18 @@ class ContentEventObserverService {
this.window = windowGlobal;
this.sendAsyncMessage = sendAsyncMessage;
this.events = new Set();
}
/**
* Observe a new DOM event.
*
- * When the DOM event of <var>type</var> fires, a message is passed
- * to the parent browser's event observer.
+ * When the DOM event of ``type`` fires, a message is passed to
+ * the parent browser's event observer.
*
* If event type is already being observed, only a single message
* is sent. E.g. multiple registration for events will only ever emit
* a maximum of one message.
*
* @param {string} type
* DOM event to listen for.
*/