From 7e70412cc46f6a59386519255a23b0b820015df8 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Mon, 17 Feb 2014 15:34:38 -0800 Subject: [PATCH 1/4] Added more docstrings and converted js.Function[T, js.Any] to js.Function[T, _] --- src/main/scala/org/scalajs/dom/Html.scala | 78 ++--- src/main/scala/org/scalajs/dom/Idb.scala | 18 +- src/main/scala/org/scalajs/dom/Svg.scala | 32 +- src/main/scala/org/scalajs/dom/lib.scala | 394 ++++++++++++++-------- 4 files changed, 308 insertions(+), 214 deletions(-) diff --git a/src/main/scala/org/scalajs/dom/Html.scala b/src/main/scala/org/scalajs/dom/Html.scala index 993e29021..049313697 100644 --- a/src/main/scala/org/scalajs/dom/Html.scala +++ b/src/main/scala/org/scalajs/dom/Html.scala @@ -1263,10 +1263,10 @@ class HTMLFrameSetElement extends HTMLElement { var rows: js.String = ??? var cols: js.String = ??? var frameSpacing: js.Any = ??? - var onmessage: js.Function1[MessageEvent, js.Any] = ??? + var onmessage: js.Function1[MessageEvent, _] = ??? var onerror: js.Function1[Event, _] = ??? var frameBorder: js.String = ??? - var onresize: js.Function1[UIEvent, js.Any] = ??? + var onresize: js.Function1[UIEvent, _] = ??? var name: js.String = ??? var onafterprint: js.Function1[Event, _] = ??? var onbeforeprint: js.Function1[Event, _] = ??? @@ -1275,8 +1275,8 @@ class HTMLFrameSetElement extends HTMLElement { var onunload: js.Function1[Event, _] = ??? var onhashchange: js.Function1[Event, _] = ??? var onload: js.Function1[Event, _] = ??? - var onbeforeunload: js.Function1[BeforeUnloadEvent, js.Any] = ??? - var onstorage: js.Function1[StorageEvent, js.Any] = ??? + var onbeforeunload: js.Function1[BeforeUnloadEvent, _] = ??? + var onstorage: js.Function1[StorageEvent, _] = ??? } @@ -1425,7 +1425,7 @@ class HTMLBodyElement extends HTMLElement { * * MDN */ - var onmessage: js.Function1[MessageEvent, js.Any] = ??? + var onmessage: js.Function1[MessageEvent, _] = ??? var text: js.Any = ??? /** * Exposes the window.onerror event handler to call when the document fails to load @@ -1443,7 +1443,7 @@ class HTMLBodyElement extends HTMLElement { * * MDN */ - var onresize: js.Function1[UIEvent, js.Any] = ??? + var onresize: js.Function1[UIEvent, _] = ??? var link: js.Any = ??? var aLink: js.Any = ??? @@ -1498,7 +1498,7 @@ class HTMLBodyElement extends HTMLElement { * * MDN */ - var onbeforeunload: js.Function1[BeforeUnloadEvent, js.Any] = ??? + var onbeforeunload: js.Function1[BeforeUnloadEvent, _] = ??? var leftMargin: js.Any = ??? /** * Reflects the onpopstate HTML attribute value for a function to call when the @@ -1506,7 +1506,7 @@ class HTMLBodyElement extends HTMLElement { * * MDN */ - var onstorage: js.Function1[StorageEvent, js.Any] = ??? + var onstorage: js.Function1[StorageEvent, _] = ??? /** @@ -1515,7 +1515,7 @@ class HTMLBodyElement extends HTMLElement { * * MDN */ - var onpopstate: js.Function1[PopStateEvent, js.Any] = ??? + var onpopstate: js.Function1[PopStateEvent, _] = ??? } /** @@ -3000,16 +3000,16 @@ class HTMLElement extends Element { var onemptied: js.Function1[Event, _] = ??? var onseeking: js.Function1[Event, _] = ??? var oncanplay: js.Function1[Event, _] = ??? - var ondeactivate: js.Function1[UIEvent, js.Any] = ??? + var ondeactivate: js.Function1[UIEvent, _] = ??? var onloadstart: js.Function1[Event, _] = ??? - var ondragenter: js.Function1[DragEvent, js.Any] = ??? + var ondragenter: js.Function1[DragEvent, _] = ??? var onsubmit: js.Function1[Event, _] = ??? var onchange: js.Function1[Event, _] = ??? var id: js.String = ??? - var onbeforeactivate: js.Function1[UIEvent, js.Any] = ??? + var onbeforeactivate: js.Function1[UIEvent, _] = ??? var oncanplaythrough: js.Function1[Event, _] = ??? /** @@ -3026,11 +3026,11 @@ class HTMLElement extends Element { var onsuspend: js.Function1[Event, _] = ??? var readyState: js.Any = ??? - var onmouseenter: js.Function1[MouseEvent, js.Any] = ??? + var onmouseenter: js.Function1[MouseEvent, _] = ??? - var onmouseout: js.Function1[MouseEvent, js.Any] = ??? + var onmouseout: js.Function1[MouseEvent, _] = ??? var parentElement: HTMLElement = ??? - var onmousewheel: js.Function1[WheelEvent, js.Any] = ??? + var onmousewheel: js.Function1[WheelEvent, _] = ??? var onvolumechange: js.Function1[Event, _] = ??? var filters: Object = ??? /** @@ -3044,9 +3044,9 @@ class HTMLElement extends Element { * MDN */ - var ondragend: js.Function1[DragEvent, js.Any] = ??? - var onbeforepaste: js.Function1[DragEvent, js.Any] = ??? - var ondragover: js.Function1[DragEvent, js.Any] = ??? + var ondragend: js.Function1[DragEvent, _] = ??? + var onbeforepaste: js.Function1[DragEvent, _] = ??? + var ondragover: js.Function1[DragEvent, _] = ??? /** * offsetTop returns the distance of the current element relative to the top of @@ -3056,10 +3056,10 @@ class HTMLElement extends Element { */ def offsetTop: js.Number = ??? - var onmouseup: js.Function1[MouseEvent, js.Any] = ??? - var ondragstart: js.Function1[DragEvent, js.Any] = ??? - var onbeforecopy: js.Function1[DragEvent, js.Any] = ??? - var ondrag: js.Function1[DragEvent, js.Any] = ??? + var onmouseup: js.Function1[MouseEvent, _] = ??? + var ondragstart: js.Function1[DragEvent, _] = ??? + var onbeforecopy: js.Function1[DragEvent, _] = ??? + var ondrag: js.Function1[DragEvent, _] = ??? /** * innerHTML sets or gets the HTML syntax describing the element's descendants. * @@ -3069,7 +3069,7 @@ class HTMLElement extends Element { * text nodes' contents. */ var innerHTML: js.String = ??? - var onmouseover: js.Function1[MouseEvent, js.Any] = ??? + var onmouseover: js.Function1[MouseEvent, _] = ??? /** * This property gets or sets the base language of an element's attribute values and * text content. @@ -3080,8 +3080,8 @@ class HTMLElement extends Element { var onpause: js.Function1[Event, _] = ??? - var onmousedown: js.Function1[MouseEvent, js.Any] = ??? - var onclick: js.Function1[MouseEvent, js.Any] = ??? + var onmousedown: js.Function1[MouseEvent, _] = ??? + var onclick: js.Function1[MouseEvent, _] = ??? var onwaiting: js.Function1[Event, _] = ??? /** * Returns the number of pixels that the upper left corner of the current element is @@ -3091,10 +3091,10 @@ class HTMLElement extends Element { */ var offsetLeft: js.Number = ??? - var onpaste: js.Function1[DragEvent, js.Any] = ??? + var onpaste: js.Function1[DragEvent, _] = ??? var onstalled: js.Function1[Event, _] = ??? - var onmousemove: js.Function1[MouseEvent, js.Any] = ??? + var onmousemove: js.Function1[MouseEvent, _] = ??? /** * isContentEditable returns true if the contents of the element are editable; * otherwise it returns false. @@ -3117,29 +3117,29 @@ class HTMLElement extends Element { */ var tabIndex: js.Number = ??? - var onprogress: js.Function1[js.Any, js.Any] = ??? - var ondblclick: js.Function1[MouseEvent, js.Any] = ??? - var oncontextmenu: js.Function1[MouseEvent, js.Any] = ??? + var onprogress: js.Function1[js.Any, _] = ??? + var ondblclick: js.Function1[MouseEvent, _] = ??? + var oncontextmenu: js.Function1[MouseEvent, _] = ??? var onloadedmetadata: js.Function1[Event, _] = ??? var onplay: js.Function1[Event, _] = ??? var onplaying: js.Function1[Event, _] = ??? var onfocusout: js.Function1[FocusEvent, _] = ??? - var onabort: js.Function1[UIEvent, js.Any] = ??? + var onabort: js.Function1[UIEvent, _] = ??? var onreadystatechange: js.Function1[Event, _] = ??? - var onkeypress: js.Function1[KeyboardEvent, js.Any] = ??? + var onkeypress: js.Function1[KeyboardEvent, _] = ??? var onloadeddata: js.Function1[Event, _] = ??? - var onbeforedeactivate: js.Function1[UIEvent, js.Any] = ??? + var onbeforedeactivate: js.Function1[UIEvent, _] = ??? var disabled: js.Boolean = ??? - var onactivate: js.Function1[UIEvent, js.Any] = ??? + var onactivate: js.Function1[UIEvent, _] = ??? var accessKey: js.String = ??? var onselectstart: js.Function1[Event, _] = ??? var ontimeupdate: js.Function1[Event, _] = ??? - var oncut: js.Function1[DragEvent, js.Any] = ??? - var onselect: js.Function1[UIEvent, js.Any] = ??? - var ondrop: js.Function1[DragEvent, js.Any] = ??? + var oncut: js.Function1[DragEvent, _] = ??? + var onselect: js.Function1[UIEvent, _] = ??? + var ondrop: js.Function1[DragEvent, _] = ??? /** * Returns the layout width of an element. @@ -3148,9 +3148,9 @@ class HTMLElement extends Element { */ def offsetWidth: js.Number = ??? - var oncopy: js.Function1[DragEvent, js.Any] = ??? + var oncopy: js.Function1[DragEvent, _] = ??? var onended: js.Function1[Event, _] = ??? - var onscroll: js.Function1[UIEvent, js.Any] = ??? + var onscroll: js.Function1[UIEvent, _] = ??? var oninput: js.Function1[Event, _] = ??? diff --git a/src/main/scala/org/scalajs/dom/Idb.scala b/src/main/scala/org/scalajs/dom/Idb.scala index 60efaaeb7..1e1a47ffa 100644 --- a/src/main/scala/org/scalajs/dom/Idb.scala +++ b/src/main/scala/org/scalajs/dom/Idb.scala @@ -459,7 +459,7 @@ class IDBTransaction extends EventTarget { * * MDN */ - var oncomplete: js.Function1[Event, js.Any] = ??? + var oncomplete: js.Function1[Event, _] = ??? /** * The database connection with which this transaction is associated. @@ -493,13 +493,13 @@ class IDBTransaction extends EventTarget { * * MDN */ - var onerror: js.Function1[ErrorEvent, js.Any] = ??? + var onerror: js.Function1[ErrorEvent, _] = ??? /** * The event handler for the onabort event. * * MDN */ - var onabort: js.Function1[js.Any, js.Any] = ??? + var onabort: js.Function1[js.Any, _] = ??? /** * Returns immediately, and rolls back all the changes to objects in the database @@ -589,13 +589,13 @@ class IDBDatabase extends EventTarget { * * MDN */ - var onerror: js.Function1[ErrorEvent, js.Any] = ??? + var onerror: js.Function1[ErrorEvent, _] = ??? /** * Fires when access of the database is aborted. * * MDN */ - var onabort: js.Function1[js.Any, js.Any] = ??? + var onabort: js.Function1[js.Any, _] = ??? def createObjectStore(name: js.String, optionalParameters: js.Any): IDBObjectStore = ??? @@ -658,7 +658,7 @@ class IDBOpenDBRequest extends IDBRequest { * * MDN */ - var onupgradeneeded: js.Function1[IDBVersionChangeEvent, js.Any] = ??? + var onupgradeneeded: js.Function1[IDBVersionChangeEvent, _] = ??? /** * The event handler for the blocked event. This event is triggered when the * upgradeneeded should be triggered because of a version change but the database is @@ -667,7 +667,7 @@ class IDBOpenDBRequest extends IDBRequest { * * MDN */ - var onblocked: js.Function1[Event, js.Any] = ??? + var onblocked: js.Function1[Event, _] = ??? } @@ -737,7 +737,7 @@ class IDBRequest extends EventTarget { * * MDN */ - var onsuccess: js.Function1[Event, js.Any] = ??? + var onsuccess: js.Function1[Event, _] = ??? /** * A DOMError containing the relevant error. The following error codes are returned @@ -761,7 +761,7 @@ class IDBRequest extends EventTarget { * * MDN */ - var onerror: js.Function1[ErrorEvent, js.Any] = ??? + var onerror: js.Function1[ErrorEvent, _] = ??? /** * The state of the request. Every request starts in the pending state. The state diff --git a/src/main/scala/org/scalajs/dom/Svg.scala b/src/main/scala/org/scalajs/dom/Svg.scala index 4d3706b42..f41f61d7d 100644 --- a/src/main/scala/org/scalajs/dom/Svg.scala +++ b/src/main/scala/org/scalajs/dom/Svg.scala @@ -634,7 +634,7 @@ object SVGAngle extends js.Object { * MDN */ class SVGElement extends Element { - var onmouseover: js.Function1[MouseEvent, js.Any] = ??? + var onmouseover: js.Function1[MouseEvent, _] = ??? /** * The element which established the current viewport. Often, the nearest ancestor @@ -644,21 +644,21 @@ class SVGElement extends Element { */ def viewportElement: SVGElement = ??? - var onmousemove: js.Function1[MouseEvent, js.Any] = ??? - var onmouseout: js.Function1[MouseEvent, js.Any] = ??? - var ondblclick: js.Function1[MouseEvent, js.Any] = ??? - var onfocusout: js.Function1[FocusEvent, js.Any] = ??? - var onfocusin: js.Function1[FocusEvent, js.Any] = ??? + var onmousemove: js.Function1[MouseEvent, _] = ??? + var onmouseout: js.Function1[MouseEvent, _] = ??? + var ondblclick: js.Function1[MouseEvent, _] = ??? + var onfocusout: js.Function1[FocusEvent, _] = ??? + var onfocusin: js.Function1[FocusEvent, _] = ??? /** * Corresponds to attribute xml:base on the given element. * * MDN */ var xmlbase: js.String = ??? - var onmousedown: js.Function1[MouseEvent, js.Any] = ??? - var onload: js.Function1[Event, js.Any] = ??? - var onmouseup: js.Function1[MouseEvent, js.Any] = ??? - var onclick: js.Function1[MouseEvent, js.Any] = ??? + var onmousedown: js.Function1[MouseEvent, _] = ??? + var onload: js.Function1[Event, _] = ??? + var onmouseup: js.Function1[MouseEvent, _] = ??? + var onclick: js.Function1[MouseEvent, _] = ??? /** * The nearest ancestor element. Null if the given element is the outermost svg @@ -1023,7 +1023,7 @@ class SVGSVGElement extends SVGElement with SVGStylable with SVGZoomAndPan with * MDN */ var contentStyleType: js.String = ??? - var onzoom: js.Function1[js.Any, js.Any] = ??? + var onzoom: js.Function1[js.Any, _] = ??? /** * Corresponds to attribute y on the given element. @@ -1047,7 +1047,7 @@ class SVGSVGElement extends SVGElement with SVGStylable with SVGZoomAndPan with */ def viewport: SVGRect = ??? - var onerror: js.Function1[Event, js.Any] = ??? + var onerror: js.Function1[Event, _] = ??? /** * Corresponding size of a pixel unit along the y-axis of the viewport. @@ -1056,7 +1056,7 @@ class SVGSVGElement extends SVGElement with SVGStylable with SVGZoomAndPan with */ def pixelUnitToMillimeterY: js.Number = ??? - var onresize: js.Function1[UIEvent, js.Any] = ??? + var onresize: js.Function1[UIEvent, _] = ??? /** * Corresponding size of a screen pixel along the y-axis of the viewport. @@ -1072,7 +1072,7 @@ class SVGSVGElement extends SVGElement with SVGStylable with SVGZoomAndPan with */ def height: SVGAnimatedLength = ??? - var onabort: js.Function1[UIEvent, js.Any] = ??? + var onabort: js.Function1[UIEvent, _] = ??? /** * Corresponds to attribute contentScriptType on the given element. * @@ -1099,7 +1099,7 @@ class SVGSVGElement extends SVGElement with SVGStylable with SVGZoomAndPan with */ def currentTranslate: SVGPoint = ??? - var onunload: js.Function1[Event, js.Any] = ??? + var onunload: js.Function1[Event, _] = ??? /** * On an outermost element, this attribute indicates the current scale factor @@ -1115,7 +1115,7 @@ class SVGSVGElement extends SVGElement with SVGStylable with SVGZoomAndPan with */ def currentScale: js.Number = ??? - var onscroll: js.Function1[UIEvent, js.Any] = ??? + var onscroll: js.Function1[UIEvent, _] = ??? /** * User interface (UI) events in DOM Level 2 indicate the screen positions at which the diff --git a/src/main/scala/org/scalajs/dom/lib.scala b/src/main/scala/org/scalajs/dom/lib.scala index 16997d515..d006b15c9 100644 --- a/src/main/scala/org/scalajs/dom/lib.scala +++ b/src/main/scala/org/scalajs/dom/lib.scala @@ -338,12 +338,33 @@ class CompositionEvent extends UIEvent { trait WindowTimers extends WindowTimersExtension { + /** + * Clears the delay set by window.setTimeout(). + * + * MDN + */ def clearTimeout(handle: js.Number): Unit = ??? + /** + * Calls a function or executes a code snippet after a specified delay. + * + * MDN + */ def setTimeout(handler: js.Any, timeout: js.Any, args: js.Any*): js.Number = ??? + /** + * Cancels repeated action which was set up using setInterval. + * + * MDN + */ def clearInterval(handle: js.Number): Unit = ??? + /** + * Calls a function or executes a code snippet repeatedly, with a fixed time + * delay between each call to that function. + * + * MDN + */ def setInterval(handler: js.Any, timeout: js.Any, args: js.Any*): js.Number = ??? } @@ -360,8 +381,22 @@ trait WindowTimers extends WindowTimersExtension { class Navigator extends NavigatorID with NavigatorOnLine with NavigatorContentUtils with NavigatorGeolocation with NavigatorStorageUtils trait NodeSelector extends js.Object { + /** + * Returns a list of the elements within the document (using depth-first + * pre-order traversal of the document's nodes) that match the specified + * group of selectors. + * + * MDN + */ def querySelectorAll(selectors: js.String): NodeList = ??? + /** + * Returns the first element within the document (using depth-first pre-order + * traversal of the document's nodes) that matches the specified group of + * selectors. + * + * MDN + */ def querySelector(selectors: js.String): Element = ??? } @@ -521,6 +556,15 @@ class Element extends Node with NodeSelector with ParentNode { */ def scrollWidth: js.Number = ??? + /** + * Returns the inner height of an element in pixels, including padding but not + * the horizontal scrollbar height, border, or margin. + * + * clientHeight can be calculated as CSS height + CSS padding - height of + * horizontal scrollbar (if present). + * + * MDN + */ def clientHeight: js.Number = ??? /** @@ -539,6 +583,13 @@ class Element extends Node with NodeSelector with ParentNode { */ def scrollHeight: js.Number = ??? + /** + * getAttribute() returns the value of the named attribute on the specified element. + * If the named attribute does not exist, the value returned will either be null or "" + * (the empty string); see Notes for details. + * + * MDN + */ def getAttribute(name: js.String): js.String = ??? /** @@ -595,8 +646,6 @@ class Element extends Node with NodeSelector with ParentNode { */ def setAttributeNodeNS(newAttr: Attr): Attr = ??? - def msMatchesSelector(selectors: js.String): js.Boolean = ??? - /** * hasAttribute returns a boolean value indicating whether the specified element * has the specified attribute or not. @@ -605,6 +654,11 @@ class Element extends Node with NodeSelector with ParentNode { */ def hasAttribute(name: js.String): js.Boolean = ??? + /** + * removeAttribute removes an attribute from the specified element. + * + * MDN + */ def removeAttribute(name: js.String): Unit = ??? /** @@ -629,10 +683,6 @@ class Element extends Node with NodeSelector with ParentNode { */ def getAttributeNode(name: js.String): Attr = ??? - def fireEvent(eventName: js.String, eventObj: js.Any): js.Boolean = ??? - - def fireEvent(eventName: js.String): js.Boolean = ??? - /** * Returns a list of elements with the given tag name. The subtree underneath the * specified element is searched, excluding the element itself. The returned list is @@ -666,8 +716,20 @@ class Element extends Node with NodeSelector with ParentNode { */ def removeAttributeNode(oldAttr: Attr): Attr = ??? + /** + * Adds a new attribute or changes the value of an existing attribute on the + * specified element. + * + * MSN + */ def setAttribute(name: js.String, value: js.String): Unit = ??? + /** + * Adds a new attribute or changes the value of an existing attribute on the + * specified element. + * + * MDN + */ def setAttribute(name: js.String): Unit = ??? /** @@ -936,7 +998,12 @@ class Node extends EventTarget { * MDN */ def lookupNamespaceURI(prefix: js.String): js.String = ??? - + /** + * Clone a Node, and optionally, all of its contents. By default, it clones the content + * of the node. + * + * MDN + */ def cloneNode(deep: js.Boolean): Node = ??? /** @@ -961,7 +1028,12 @@ class Node extends EventTarget { * MDN */ def replaceChild(newChild: Node, oldChild: Node): Node = ??? - + /** + * Inserts the first Node given in a parameter immediately before the second, child of + * this element, Node. + * + * MDN + */ def insertBefore(newChild: Node, refChild: Node): Node = ??? /** @@ -971,42 +1043,6 @@ class Node extends EventTarget { * MDN */ def insertBefore(newChild: Node): Node = ??? - - def ENTITY_REFERENCE_NODE: js.Number = ??? - - def ATTRIBUTE_NODE: js.Number = ??? - - def DOCUMENT_FRAGMENT_NODE: js.Number = ??? - - def TEXT_NODE: js.Number = ??? - - def ELEMENT_NODE: js.Number = ??? - - def COMMENT_NODE: js.Number = ??? - - def DOCUMENT_POSITION_DISCONNECTED: js.Number = ??? - - def DOCUMENT_POSITION_CONTAINED_BY: js.Number = ??? - - def DOCUMENT_POSITION_CONTAINS: js.Number = ??? - - def DOCUMENT_TYPE_NODE: js.Number = ??? - - def DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: js.Number = ??? - - def DOCUMENT_NODE: js.Number = ??? - - def ENTITY_NODE: js.Number = ??? - - def PROCESSING_INSTRUCTION_NODE: js.Number = ??? - - def CDATA_SECTION_NODE: js.Number = ??? - - def NOTATION_NODE: js.Number = ??? - - def DOCUMENT_POSITION_FOLLOWING: js.Number = ??? - - def DOCUMENT_POSITION_PRECEDING: js.Number = ??? } @@ -1460,20 +1496,20 @@ trait WindowSessionStorage extends js.Object { * MDN */ class Window extends EventTarget with WindowLocalStorage with WindowSessionStorage with WindowTimers with WindowBase64 with IDBEnvironment with WindowConsole { - var ondragend: js.Function1[DragEvent, js.Any] = ??? + var ondragend: js.Function1[DragEvent, _] = ??? /** * An event handler property for keydown events on the window. * * MDN */ - var onkeydown: js.Function1[KeyboardEvent, js.Any] = ??? - var ondragover: js.Function1[DragEvent, js.Any] = ??? + var onkeydown: js.Function1[KeyboardEvent, _] = ??? + var ondragover: js.Function1[DragEvent, _] = ??? /** * An event handler property for keyup events on the window. * * MDN */ - var onkeyup: js.Function1[KeyboardEvent, js.Any] = ??? + var onkeyup: js.Function1[KeyboardEvent, _] = ??? /** * An event handler property for reset events on the window. * @@ -1485,9 +1521,9 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora * * MDN */ - var onmouseup: js.Function1[MouseEvent, js.Any] = ??? - var ondragstart: js.Function1[DragEvent, js.Any] = ??? - var ondrag: js.Function1[DragEvent, js.Any] = ??? + var onmouseup: js.Function1[MouseEvent, _] = ??? + var ondragstart: js.Function1[DragEvent, _] = ??? + var ondrag: js.Function1[DragEvent, _] = ??? /** * Returns the horizontal distance of the left border of the user's browser from the * left side of the screen. @@ -1500,8 +1536,8 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora * * MDN */ - var onmouseover: js.Function1[MouseEvent, js.Any] = ??? - var ondragleave: js.Function1[DragEvent, js.Any] = ??? + var onmouseover: js.Function1[MouseEvent, _] = ??? + var ondragleave: js.Function1[DragEvent, _] = ??? /** * The Window.history read-only property returns a reference to the History object, @@ -1556,7 +1592,7 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora * * MDN */ - var onmousedown: js.Function1[MouseEvent, js.Any] = ??? + var onmousedown: js.Function1[MouseEvent, _] = ??? var onseeked: js.Function1[Event, _] = ??? /** * Returns a reference to the window that opened this current window. @@ -1571,7 +1607,7 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora * * MDN */ - var onclick: js.Function1[MouseEvent, js.Any] = ??? + var onclick: js.Function1[MouseEvent, _] = ??? /** * Gets the height of the content area of the browser window including, if rendered, @@ -1599,7 +1635,7 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora * * MDN */ - var onblur: js.Function1[FocusEvent, js.Any] = ??? + var onblur: js.Function1[FocusEvent, _] = ??? var onemptied: js.Function1[Event, _] = ??? var onseeking: js.Function1[Event, _] = ??? var oncanplay: js.Function1[Event, _] = ??? @@ -1619,7 +1655,7 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora * * MDN */ - var onmousemove: js.Function1[MouseEvent, js.Any] = ??? + var onmousemove: js.Function1[MouseEvent, _] = ??? /** * Gets the width of the content area of the browser window including, if rendered, the * vertical scrollbar. @@ -1651,11 +1687,18 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora * * MDN */ - var onbeforeunload: js.Function1[BeforeUnloadEvent, js.Any] = ??? + var onbeforeunload: js.Function1[BeforeUnloadEvent, _] = ??? var onratechange: js.Function1[Event, _] = ??? - var onstorage: js.Function1[StorageEvent, js.Any] = ??? + var onstorage: js.Function1[StorageEvent, _] = ??? var onloadstart: js.Function1[Event, _] = ??? - var ondragenter: js.Function1[DragEvent, js.Any] = ??? + /** + * Called for an element when the mouse pointer first moves over the element while + * something is being dragged. This might be used to change the appearance of the + * element to indicate to the user that the object can be dropped on it. + * + * MDN + */ + var ondragenter: js.Function1[DragEvent, _] = ??? /** * An event handler property for submits on window forms. * @@ -1677,8 +1720,8 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora */ def document: Document = ??? - var onprogress: js.Function1[js.Any, js.Any] = ??? - var ondblclick: js.Function1[MouseEvent, js.Any] = ??? + var onprogress: js.Function1[js.Any, _] = ??? + var ondblclick: js.Function1[MouseEvent, _] = ??? /** * Returns the number of pixels that the document has already been scrolled @@ -1693,7 +1736,7 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora * * MDN */ - var oncontextmenu: js.Function1[MouseEvent, js.Any] = ??? + var oncontextmenu: js.Function1[MouseEvent, _] = ??? /** * An event handler property for change events on the window. * @@ -1730,7 +1773,7 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora * * MDN */ - var onabort: js.Function1[UIEvent, js.Any] = ??? + var onabort: js.Function1[UIEvent, _] = ??? var onreadystatechange: js.Function1[Event, _] = ??? /** @@ -1747,7 +1790,7 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora * * MDN */ - var onkeypress: js.Function1[KeyboardEvent, js.Any] = ??? + var onkeypress: js.Function1[KeyboardEvent, _] = ??? /** * Returns the element (such as element of the current document. If there are more than one @@ -2512,9 +2575,15 @@ class Document extends Node with NodeSelector with DocumentEvent with ParentNode * MDN */ var alinkColor: js.String = ??? - - var onmouseout: js.Function1[MouseEvent, js.Any] = ??? - var onmousewheel: js.Function1[WheelEvent, js.Any] = ??? + /** + * The mouseout event is raised when the mouse leaves an element (e.g, when the + * mouse moves off of an image in the web page, the mouseout event is raised for + * that image element). + * + * MDN + */ + var onmouseout: js.Function1[MouseEvent, _] = ??? + var onmousewheel: js.Function1[WheelEvent, _] = ??? var onvolumechange: js.Function1[Event, _] = ??? /** @@ -2525,7 +2594,12 @@ class Document extends Node with NodeSelector with DocumentEvent with ParentNode */ def xmlVersion: js.String = ??? - var ondragend: js.Function1[DragEvent, js.Any] = ??? + /** + * Called when the drag operation is finished. + * + * MDN + */ + var ondragend: js.Function1[DragEvent, _] = ??? /** * Returns the Document Type Declaration (DTD) associated with current document. @@ -2536,7 +2610,14 @@ class Document extends Node with NodeSelector with DocumentEvent with ParentNode */ def doctype: DocumentType = ??? - var ondragover: js.Function1[DragEvent, js.Any] = ??? + /** + * This event handler is called for an element when something is being dragged + * over top of it. If the object can be dropped on the element, the drag + * session should be notified. + * + * MDN + */ + var ondragover: js.Function1[DragEvent, _] = ??? /** * The default value for this property in Mozilla Firefox is white (#ffffff in * hexadecimal). @@ -2544,10 +2625,28 @@ class Document extends Node with NodeSelector with DocumentEvent with ParentNode * MDN */ var bgColor: js.String = ??? - var ondragstart: js.Function1[DragEvent, js.Any] = ??? - var onmouseup: js.Function1[MouseEvent, js.Any] = ??? - var ondrag: js.Function1[DragEvent, js.Any] = ??? - var onmouseover: js.Function1[MouseEvent, js.Any] = ??? + /** + * An alias for ondraggesture; this is the HTML 5 spec name for the event and + * may be used in HTML or XUL; however, for backward compatibility with older + * versions of Firefox, you may wish to continue using ondraggesture in XUL. + * + * MDN + */ + var ondragstart: js.Function1[DragEvent, _] = ??? + var onmouseup: js.Function1[MouseEvent, _] = ??? + /** + * Called periodically throughout the drag and drop operation. + * + * MDN + */ + var ondrag: js.Function1[DragEvent, _] = ??? + /** + * The mouseover event is raised when the user moves the mouse over a + * particular element. + * + * MDN + */ + var onmouseover: js.Function1[MouseEvent, _] = ??? /** * linkColor gets/sets the color of links within the document. * @@ -2555,8 +2654,18 @@ class Document extends Node with NodeSelector with DocumentEvent with ParentNode */ var linkColor: js.String = ??? var onpause: js.Function1[Event, _] = ??? - var onmousedown: js.Function1[MouseEvent, js.Any] = ??? - var onclick: js.Function1[MouseEvent, js.Any] = ??? + /** + * The mousedown event is raised when the user presses the mouse button. + * + * MDN + */ + var onmousedown: js.Function1[MouseEvent, _] = ??? + /** + * The onclick property returns the onClick event handler code on the current element. + * + * MDN + */ + var onclick: js.Function1[MouseEvent, _] = ??? var onwaiting: js.Function1[Event, _] = ??? var onstop: js.Function1[Event, _] = ??? @@ -2592,7 +2701,7 @@ class Document extends Node with NodeSelector with DocumentEvent with ParentNode def xmlStandalone: js.Boolean = ??? var onstalled: js.Function1[Event, _] = ??? - var onmousemove: js.Function1[MouseEvent, js.Any] = ??? + var onmousemove: js.Function1[MouseEvent, _] = ??? /** * Returns the Element that is the root element of the document (for example, the @@ -2603,9 +2712,9 @@ class Document extends Node with NodeSelector with DocumentEvent with ParentNode def documentElement: Element = ??? var onratechange: js.Function1[Event, _] = ??? - var onprogress: js.Function1[js.Any, js.Any] = ??? - var ondblclick: js.Function1[MouseEvent, js.Any] = ??? - var oncontextmenu: js.Function1[MouseEvent, js.Any] = ??? + var onprogress: js.Function1[js.Any, _] = ??? + var ondblclick: js.Function1[MouseEvent, _] = ??? + var oncontextmenu: js.Function1[MouseEvent, _] = ??? var onloadedmetadata: js.Function1[Event, _] = ??? var onerror: js.Function1[Event, _] = ??? @@ -2627,10 +2736,10 @@ class Document extends Node with NodeSelector with DocumentEvent with ParentNode * MDN */ var location: Location = ??? - var onabort: js.Function1[UIEvent, js.Any] = ??? - var onfocusout: js.Function1[FocusEvent, js.Any] = ??? + var onabort: js.Function1[UIEvent, _] = ??? + var onfocusout: js.Function1[FocusEvent, _] = ??? var onselectionchange: js.Function1[Event, _] = ??? - var onstoragecommit: js.Function1[StorageEvent, js.Any] = ??? + var onstoragecommit: js.Function1[StorageEvent, _] = ??? /** * Returns the event handling code for the readystatechange event. * @@ -2646,12 +2755,12 @@ class Document extends Node with NodeSelector with DocumentEvent with ParentNode */ def lastModified: js.String = ??? - var onkeypress: js.Function1[KeyboardEvent, js.Any] = ??? + var onkeypress: js.Function1[KeyboardEvent, _] = ??? var onloadeddata: js.Function1[Event, _] = ??? - var onbeforedeactivate: js.Function1[UIEvent, js.Any] = ??? - var onactivate: js.Function1[UIEvent, js.Any] = ??? + var onbeforedeactivate: js.Function1[UIEvent, _] = ??? + var onactivate: js.Function1[UIEvent, _] = ??? var onselectstart: js.Function1[Event, _] = ??? - var onfocus: js.Function1[FocusEvent, js.Any] = ??? + var onfocus: js.Function1[FocusEvent, _] = ??? /** * fgColor gets/sets the foreground color, or text color, of the current document. * @@ -2659,8 +2768,8 @@ class Document extends Node with NodeSelector with DocumentEvent with ParentNode */ var fgColor: js.String = ??? var ontimeupdate: js.Function1[Event, _] = ??? - var onselect: js.Function1[UIEvent, js.Any] = ??? - var ondrop: js.Function1[DragEvent, js.Any] = ??? + var onselect: js.Function1[UIEvent, _] = ??? + var ondrop: js.Function1[DragEvent, _] = ??? var onended: js.Function1[Event, _] = ??? /** @@ -2670,7 +2779,7 @@ class Document extends Node with NodeSelector with DocumentEvent with ParentNode */ def compatMode: js.String = ??? - var onscroll: js.Function1[UIEvent, js.Any] = ??? + var onscroll: js.Function1[UIEvent, _] = ??? var onload: js.Function1[Event, _] = ??? var oninput: js.Function1[Event, _] = ??? @@ -2973,11 +3082,6 @@ class Document extends Node with NodeSelector with DocumentEvent with ParentNode */ def getElementById(elementId: js.String): HTMLElement = ??? - - def msElementsFromPoint(x: js.Number, y: js.Number): NodeList = ??? - - def msElementsFromRect(left: js.Number, top: js.Number, width: js.Number, height: js.Number): NodeList = ??? - /** * In recent versions of Mozilla-based applications as well as in Internet Explorer * and Netscape 4 this method does nothing. @@ -3495,8 +3599,8 @@ class XMLHttpRequest extends EventTarget { * MDN */ var withCredentials: js.Boolean = ??? - var onprogress: js.Function1[ProgressEvent, js.Any] = ??? - var onabort: js.Function1[js.Any, js.Any] = ??? + var onprogress: js.Function1[ProgressEvent, _] = ??? + var onabort: js.Function1[js.Any, _] = ??? /** * Can be set to change the response type. Value Data type of response property "" * (empty string) String (this is the default) "arraybuffer" ArrayBuffer "blob" @@ -3523,15 +3627,15 @@ class XMLHttpRequest extends EventTarget { * MDN */ var responseType: js.String = ??? - var onloadend: js.Function1[ProgressEvent, js.Any] = ??? + var onloadend: js.Function1[ProgressEvent, _] = ??? /** * The upload process can be tracked by adding an event listener to upload. * * MDN */ var upload: XMLHttpRequestEventTarget = ??? - var onerror: js.Function1[ErrorEvent, js.Any] = ??? - var onloadstart: js.Function1[js.Any, js.Any] = ??? + var onerror: js.Function1[ErrorEvent, _] = ??? + var onloadstart: js.Function1[js.Any, _] = ??? } object XMLHttpRequest extends js.Object { @@ -6190,20 +6294,20 @@ trait XMLHttpRequestEventTarget extends EventTarget { * * MDN */ - var onprogress: js.Function1[ProgressEvent, js.Any] = ??? + var onprogress: js.Function1[ProgressEvent, _] = ??? /** * The function to call when a request encounters an error. * * MDN */ - var onerror: js.Function1[ErrorEvent, js.Any] = ??? + var onerror: js.Function1[ErrorEvent, _] = ??? /** * The function to call when an HTTP request returns after successfully loading * content. * * MDN */ - var onload: js.Function1[js.Any, js.Any] = ??? + var onload: js.Function1[js.Any, _] = ??? /** * A function that is called if the event times out; this only happens if a timeout has * been previously established by setting the value of the XMLHttpRequest object's @@ -6211,25 +6315,25 @@ trait XMLHttpRequestEventTarget extends EventTarget { * * MDN */ - var ontimeout: js.Function1[js.Any, js.Any] = ??? + var ontimeout: js.Function1[js.Any, _] = ??? /** * The function to call when a request is aborted. * * MDN */ - var onabort: js.Function1[js.Any, js.Any] = ??? + var onabort: js.Function1[js.Any, _] = ??? /** * A function that gets called when the HTTP request first begins loading data. * * MDN */ - var onloadstart: js.Function1[js.Any, js.Any] = ??? + var onloadstart: js.Function1[js.Any, _] = ??? /** * A function that is called when the load is completed, even if the request failed. * * MDN */ - var onloadend: js.Function1[ProgressEvent, js.Any] = ??? + var onloadend: js.Function1[ProgressEvent, _] = ??? } @@ -6237,8 +6341,8 @@ trait XMLHttpRequestEventTarget extends EventTarget { trait AudioTrackList extends EventTarget { var length: js.Number = _ - var onchange: js.Function1[js.Any, js.Any] = _ - var onaddtrack: js.Function1[TrackEvent, js.Any] = _ + var onchange: js.Function1[js.Any, _] = _ + var onaddtrack: js.Function1[TrackEvent, _] = _ def getTrackById(id: js.String): AudioTrack = ??? @@ -6255,12 +6359,8 @@ trait AudioTrackList extends EventTarget { trait WindowTimersExtension extends js.Object { - def msSetImmediate(expression: js.Any, args: js.Any*): js.Number = ??? - def clearImmediate(handle: js.Number): Unit = ??? - def msClearImmediate(handle: js.Number): Unit = ??? - def setImmediate(expression: js.Any, args: js.Any*): js.Number = ??? } @@ -6365,8 +6465,6 @@ trait Console extends js.Object { def assert(test: js.Boolean, message: js.String, optionalParams: js.Any*): Unit = ??? - def msIsIndependentlyComposed(element: Element): js.Boolean = ??? - def clear(): Unit = ??? /** @@ -6442,8 +6540,8 @@ trait TextTrack extends EventTarget { var cues: TextTrackCueList = _ var oncuechange: js.Function1[Event, _] = _ var kind: js.String = _ - var onload: js.Function1[js.Any, js.Any] = _ - var onerror: js.Function1[ErrorEvent, js.Any] = _ + var onload: js.Function1[js.Any, _] = _ + var onerror: js.Function1[ErrorEvent, _] = _ var label: js.String = _ @@ -6480,7 +6578,7 @@ trait MediaQueryListListener extends js.Object { trait MessagePort extends EventTarget { - var onmessage: js.Function1[js.Any, js.Any] = ??? + var onmessage: js.Function1[js.Any, _] = ??? def close(): Unit = ??? @@ -6575,8 +6673,6 @@ class Blob extends js.Object { */ def size: js.Number = ??? - def msDetachStream(): js.Dynamic = ??? - def slice(start: js.Number, end: js.Number, contentType: js.String): Blob = ??? def slice(start: js.Number, end: js.Number): Blob = ??? @@ -6592,8 +6688,6 @@ class Blob extends js.Object { def slice(): Blob = ??? def close(): Unit = ??? - - def msClose(): Unit = ??? } object Blob extends js.Object { @@ -6603,11 +6697,11 @@ trait ApplicationCache extends EventTarget { def status: js.Number = ??? var ondownloading: js.Function1[Event, _] = ??? - var onprogress: js.Function1[ProgressEvent, js.Any] = ??? + var onprogress: js.Function1[ProgressEvent, _] = ??? var onupdateready: js.Function1[Event, _] = ??? var oncached: js.Function1[Event, _] = ??? var onobsolete: js.Function1[Event, _] = ??? - var onerror: js.Function1[ErrorEvent, js.Any] = ??? + var onerror: js.Function1[ErrorEvent, _] = ??? var onchecking: js.Function1[Event, _] = ??? var onnoupdate: js.Function1[Event, _] = ??? @@ -6684,7 +6778,7 @@ trait AbstractWorker extends EventTarget { * * MDN */ - var onerror: js.Function1[ErrorEvent, js.Any] = ??? + var onerror: js.Function1[ErrorEvent, _] = ??? } @@ -6792,7 +6886,7 @@ class Worker protected() extends AbstractWorker { * * MDN */ - var onmessage: js.Function1[js.Any, js.Any] = ??? + var onmessage: js.Function1[js.Any, _] = ??? def postMessage(message: js.Any, ports: js.Any): Unit = ??? From 949997115c5dd2043e3f4198b6c8f854350ccb9f Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Mon, 17 Feb 2014 16:48:08 -0800 Subject: [PATCH 2/4] convert more functions, collapse telescoped constructors and methods to use the new default arguments --- src/main/scala/org/scalajs/dom/Css.scala | 35 +-- src/main/scala/org/scalajs/dom/Html.scala | 112 ++----- src/main/scala/org/scalajs/dom/Idb.scala | 67 +--- src/main/scala/org/scalajs/dom/Svg.scala | 4 +- src/main/scala/org/scalajs/dom/lib.scala | 353 +++++----------------- 5 files changed, 131 insertions(+), 440 deletions(-) diff --git a/src/main/scala/org/scalajs/dom/Css.scala b/src/main/scala/org/scalajs/dom/Css.scala index 0ceb3aafc..fa509e5ab 100644 --- a/src/main/scala/org/scalajs/dom/Css.scala +++ b/src/main/scala/org/scalajs/dom/Css.scala @@ -186,9 +186,7 @@ class CSSStyleDeclaration extends js.Object { @scala.scalajs.js.annotation.JSBracketAccess def update(index: js.Number, v: js.String): Unit = ??? - def setProperty(propertyName: js.String, value: js.String, priority: js.String): Unit = ??? - - def setProperty(propertyName: js.String, value: js.String): Unit = ??? + def setProperty(propertyName: js.String, value: js.String, priority: js.String = ???): Unit = ??? var animationFillMode: js.String = _ var floodColor: js.String = _ @@ -335,40 +333,28 @@ class CSSStyleSheet extends StyleSheet { var cssRules: CSSRuleList = _ var id: js.String = _ - def addImport(bstrURL: js.String, lIndex: js.Number): js.Number = ??? - - def addImport(bstrURL: js.String): js.Number = ??? - - def addPageRule(bstrSelector: js.String, bstrStyle: js.String, lIndex: js.Number): js.Number = ??? - - def addPageRule(bstrSelector: js.String, bstrStyle: js.String): js.Number = ??? - - def insertRule(rule: js.String, index: js.Number): js.Number = ??? + def addImport(bstrURL: js.String, lIndex: js.Number = ???): js.Number = ??? + def addPageRule(bstrSelector: js.String, bstrStyle: js.String, lIndex: js.Number = ???): js.Number = ??? /** * The CSSStyleSheet.insertRule() method inserts a new style rule into the current * style sheet. * * MDN */ - def insertRule(rule: js.String): js.Number = ??? + def insertRule(rule: js.String, index: js.Number = ???): js.Number = ??? - def removeRule(lIndex: js.Number): Unit = ??? - - def deleteRule(index: js.Number): Unit = ??? + def removeRule(lIndex: js.Number): Unit = ??? /** * Deletes a rule from the style sheet. * * MDN */ - def deleteRule(): Unit = ??? + def deleteRule(index: js.Number = ???): Unit = ??? - def addRule(bstrSelector: js.String, bstrStyle: js.String, lIndex: js.Number): js.Number = ??? - def addRule(bstrSelector: js.String, bstrStyle: js.String): js.Number = ??? - - def addRule(bstrSelector: js.String): js.Number = ??? + def addRule(bstrSelector: js.String, bstrStyle: js.String = ???, lIndex: js.Number = ???): js.Number = ??? def removeImport(lIndex: js.Number): Unit = ??? } @@ -406,13 +392,10 @@ class CSSMediaRule extends CSSRule { var media: MediaList = _ var cssRules: CSSRuleList = _ - def insertRule(rule: js.String, index: js.Number): js.Number = ??? - - def insertRule(rule: js.String): js.Number = ??? + def insertRule(rule: js.String, index: js.Number = ???): js.Number = ??? - def deleteRule(index: js.Number): Unit = ??? - def deleteRule(): Unit = ??? + def deleteRule(index: js.Number = ???): Unit = ??? } /** diff --git a/src/main/scala/org/scalajs/dom/Html.scala b/src/main/scala/org/scalajs/dom/Html.scala index 049313697..9463278cc 100644 --- a/src/main/scala/org/scalajs/dom/Html.scala +++ b/src/main/scala/org/scalajs/dom/Html.scala @@ -138,9 +138,6 @@ class HTMLTableElement extends HTMLElement { * MDN */ var border: js.String = ??? - - def deleteRow(index: js.Number): Unit = ??? - /** * Removes the row corresponding to the index given in parameter. If the index value is * -1 the last row is removed; if it smaller than -1 or greater than the amount of rows in @@ -148,7 +145,7 @@ class HTMLTableElement extends HTMLElement { * * MDN */ - def deleteRow(): Unit = ??? + def deleteRow(index: js.Number = ???): Unit = ??? def createTBody(): HTMLElement = ??? @@ -158,9 +155,6 @@ class HTMLTableElement extends HTMLElement { * MDN */ def deleteCaption(): Unit = ??? - - def insertRow(index: js.Number): HTMLElement = ??? - /** * Returns an HTMLElement representing a new row of the table. It inserts it in the rows * collection immediately before the element at the givent index position. If @@ -170,7 +164,9 @@ class HTMLTableElement extends HTMLElement { * * MDN */ - def insertRow(): HTMLElement = ??? + def insertRow(index: js.Number = ???): HTMLElement = ??? + + /** * Removes the first that is a child of the element. @@ -205,11 +201,7 @@ class HTMLTableElement extends HTMLElement { */ def createCaption(): HTMLElement = ??? - def moveRow(indexFrom: js.Number, indexTo: js.Number): Object = ??? - - def moveRow(indexFrom: js.Number): Object = ??? - - def moveRow(): Object = ??? + def moveRow(indexFrom: js.Number = ???, indexTo: js.Number = ???): Object = ??? /** * Returns an HTMLElement representing the first that is a child of the @@ -282,13 +274,9 @@ class HTMLParagraphElement extends HTMLElement { trait HTMLAreasCollection extends HTMLCollection { - def remove(index: js.Number): Unit = ??? - - def remove(): Unit = ??? - - def add(element: HTMLElement, before: js.Any): Unit = ??? + def remove(index: js.Number = ???): Unit = ??? - def add(element: HTMLElement): Unit = ??? + def add(element: HTMLElement, before: js.Any = ???): Unit = ??? } class HTMLAppletElement extends HTMLElement { @@ -393,31 +381,21 @@ class HTMLSelectElement extends HTMLElement { */ var multiple: js.Boolean = ??? var `type`: js.String = ??? - - def remove(index: js.Number): Unit = ??? - /** * Removes the element at the specified index from the options collection for this * select element. * * MDN */ - def remove(): Unit = ??? - - def add(element: HTMLElement, before: js.Any): Unit = ??? - + def remove(index: js.Number = ???): Unit = ??? /** * Adds an element to the collection of option elements for this select element. * * MDN */ - def add(element: HTMLElement): Unit = ??? - - def item(name: js.Any, index: js.Any): js.Dynamic = ??? + def add(element: HTMLElement, before: js.Any = ???): Unit = ??? - def item(name: js.Any): js.Dynamic = ??? - - def item(): js.Dynamic = ??? + def item(name: js.Any = ???, index: js.Any = ???): js.Dynamic = ??? def namedItem(name: js.String): js.Dynamic = ??? @@ -696,18 +674,14 @@ class HTMLCollection extends js.Object { * MDN */ var length: js.Number = ??? - - def item(nameOrIndex: js.Any, optionalIndex: js.Any): Element = ??? - - def item(nameOrIndex: js.Any): Element = ??? - /** * Returns the specific node at the given zero-based index into the list. Returns null * if the index is out of range. * * MDN */ - def item(): Element = ??? + def item(nameOrIndex: js.Any = ???, optionalIndex: js.Any = ???): Element = ??? + /** * Returns the specific node whose ID or, as a fallback, name matches the string @@ -822,9 +796,6 @@ class HTMLImageElement extends HTMLElement { def create(): HTMLImageElement = ??? - var msPlayToPrimary: js.Boolean = ??? - var msPlayToDisabled: js.Boolean = ??? - var msPlayToSource: js.Any = ??? } /** @@ -1154,9 +1125,6 @@ class HTMLTableRowElement extends HTMLElement with HTMLTableAlignment { var borderColor: js.Any = ??? var height: js.Any = ??? var borderColorDark: js.Any = ??? - - def deleteCell(index: js.Number): Unit = ??? - /** * Removes the cell at the given position in the row. If the given position is greater * (or equal as it starts at zero) than the amount of cells in the row, or is smaller than @@ -1164,10 +1132,7 @@ class HTMLTableRowElement extends HTMLElement with HTMLTableAlignment { * * MDN */ - def deleteCell(): Unit = ??? - - def insertCell(index: js.Number): HTMLElement = ??? - + def deleteCell(index: js.Number = ???): Unit = ??? /** * Inserts a new cell just before the given position in the row. If the given position is * not given or is -1, it appends the cell to the row. If the given position is greater (or @@ -1176,7 +1141,7 @@ class HTMLTableRowElement extends HTMLElement with HTMLTableAlignment { * * MDN */ - def insertCell(): HTMLElement = ??? + def insertCell(index: js.Number = ???): HTMLElement = ??? } /** @@ -1543,9 +1508,6 @@ class HTMLTableSectionElement extends HTMLElement with HTMLTableAlignment { * MDN */ var rows: HTMLCollection = ??? - - def deleteRow(index: js.Number): Unit = ??? - /** * Removes the cell at the given position in the section. If the given position is * greater (or equal as it starts at zero) than the amount of rows in the section, or is @@ -1553,17 +1515,13 @@ class HTMLTableSectionElement extends HTMLElement with HTMLTableAlignment { * * MDN */ - def deleteRow(): Unit = ??? - - def moveRow(indexFrom: js.Number, indexTo: js.Number): Object = ??? + def deleteRow(index: js.Number = ???): Unit = ??? - def moveRow(indexFrom: js.Number): Object = ??? + def moveRow(indexFrom: js.Number = ???, indexTo: js.Number = ???): Object = ??? - def moveRow(): Object = ??? - def insertRow(index: js.Number): HTMLElement = ??? + def insertRow(index: js.Number = ???): HTMLElement = ??? - def insertRow(): HTMLElement = ??? } /** @@ -1899,9 +1857,6 @@ class HTMLInputElement extends HTMLElement { * MDN */ def checkValidity(): js.Boolean = ??? - - def stepDown(n: js.Number): Unit = ??? - /** * Decrements the value by (step * n), where n defaults to 1 if not specified. Throws an * INVALID_STATE_ERR exception: if the method is not applicable to for the current @@ -1910,9 +1865,7 @@ class HTMLInputElement extends HTMLElement { * * MDN */ - def stepDown(): Unit = ??? - - def stepUp(n: js.Number): Unit = ??? + def stepDown(n: js.Number = ???): Unit = ??? /** * Increments the value by (step * n), where n defaults to 1 if not specified. Throws an @@ -1922,7 +1875,7 @@ class HTMLInputElement extends HTMLElement { * * MDN */ - def stepUp(): Unit = ??? + def stepUp(n: js.Number = ???): Unit = ??? /** * Sets a custom validity message for the element. If this message is not the empty @@ -3156,15 +3109,11 @@ class HTMLElement extends Element { def dragDrop(): js.Boolean = ??? - def scrollIntoView(top: js.Boolean): Unit = ??? - - def scrollIntoView(): Unit = ??? + def scrollIntoView(top: js.Boolean = ???): Unit = ??? def addFilter(filter: Object): Unit = ??? - def setCapture(containerCapture: js.Boolean): Unit = ??? - - def setCapture(): Unit = ??? + def setCapture(containerCapture: js.Boolean = ???): Unit = ??? /** * Sets focus on the specified element, if it can be focused. @@ -3207,19 +3156,13 @@ class HTMLElement extends Element { def insertAdjacentElement(position: js.String, insertedElement: Element): Element = ??? - def mergeAttributes(source: HTMLElement, preserveIdentity: js.Boolean): Unit = ??? - - def mergeAttributes(source: HTMLElement): Unit = ??? + def mergeAttributes(source: HTMLElement, preserveIdentity: js.Boolean = ???): Unit = ??? def replaceAdjacentText(where: js.String, newText: js.String): js.String = ??? - def applyElement(apply: Element, where: js.String): Element = ??? - - def applyElement(apply: Element): Element = ??? + def applyElement(apply: Element, where: js.String = ???): Element = ??? - def addBehavior(bstrUrl: js.String, factory: js.Any): js.Number = ??? - - def addBehavior(bstrUrl: js.String): js.Number = ??? + def addBehavior(bstrUrl: js.String, factory: js.Any = ???): js.Number = ??? def insertAdjacentHTML(where: js.String, html: js.String): Unit = ??? @@ -3740,11 +3683,6 @@ class HTMLFormElement extends HTMLElement { * MDN */ def reset(): Unit = ??? - - def item(name: js.Any, index: js.Any): js.Dynamic = ??? - - def item(name: js.Any): js.Dynamic = ??? - /** * Gets the item in the elements collection at the specified index, or null if there is * no item at that index. You can also specify the index in array-style brackets or @@ -3752,7 +3690,7 @@ class HTMLFormElement extends HTMLElement { * * MDN */ - def item(): js.Dynamic = ??? + def item(name: js.Any = ???, index: js.Any = ???): js.Dynamic = ??? /** * This method does something similar to activating a submit button of the form. diff --git a/src/main/scala/org/scalajs/dom/Idb.scala b/src/main/scala/org/scalajs/dom/Idb.scala index 1e1a47ffa..ce35ebbcf 100644 --- a/src/main/scala/org/scalajs/dom/Idb.scala +++ b/src/main/scala/org/scalajs/dom/Idb.scala @@ -44,11 +44,7 @@ class IDBObjectStore extends js.Object { */ def keyPath: js.String = ??? - def count(key: js.Any): IDBRequest = ??? - - def count(): IDBRequest = ??? - - def add(value: js.Any, key: js.Any): IDBRequest = ??? + def count(key: js.Any = ???): IDBRequest = ??? /** * To determine if the add operation has completed successfully, listen for the @@ -59,7 +55,7 @@ class IDBObjectStore extends js.Object { * * MDN */ - def add(value: js.Any): IDBRequest = ??? + def add(value: js.Any, key: js.Any = ???): IDBRequest = ??? /** * Clearing an object store consists of removing all records from the object store and @@ -68,18 +64,13 @@ class IDBObjectStore extends js.Object { * MDN */ def clear(): IDBRequest = ??? - - def createIndex(name: js.String, keyPath: js.String, optionalParameters: js.Any): IDBIndex = ??? - /** * Note that this method must be called only from a VersionChange transaction mode * callback. * * MDN */ - def createIndex(name: js.String, keyPath: js.String): IDBIndex = ??? - - def put(value: js.Any, key: js.Any): IDBRequest = ??? + def createIndex(name: js.String, keyPath: js.String, optionalParameters: js.Any = ???): IDBIndex = ??? /** * If the record is successfully stored, then a success event is fired on the returned @@ -88,13 +79,9 @@ class IDBObjectStore extends js.Object { * * MDN */ - def put(value: js.Any): IDBRequest = ??? - - def openCursor(range: js.Any, direction: js.String): IDBRequest = ??? + def put(value: js.Any, key: js.Any = ???): IDBRequest = ??? - def openCursor(range: js.Any): IDBRequest = ??? - - def openCursor(): IDBRequest = ??? + def openCursor(range: js.Any = ???, direction: js.String = ???): IDBRequest = ??? /** * Note that this method must be called only from a VersionChange transaction mode @@ -215,18 +202,13 @@ class IDBIndex extends js.Object { * MDN */ def getKey(key: js.Any): IDBRequest = ??? - - def openKeyCursor(range: IDBKeyRange, direction: js.String): IDBRequest = ??? - - def openKeyCursor(range: IDBKeyRange): IDBRequest = ??? - /** * Returns an IDBRequest object, and, in a separate thread, creates a cursor over the * specified key range, as arranged by this index. * * MDN */ - def openKeyCursor(): IDBRequest = ??? + def openKeyCursor(range: IDBKeyRange = ???, direction: js.String = ???): IDBRequest = ??? /** * Returns an IDBRequest object, and, in a separate thread, finds either the value in @@ -236,18 +218,14 @@ class IDBIndex extends js.Object { * MDN */ def get(key: js.Any): IDBRequest = ??? - - def openCursor(range: IDBKeyRange, direction: js.String): IDBRequest = ??? - - def openCursor(range: IDBKeyRange): IDBRequest = ??? - /** * The method sets the position of the cursor to the appropriate record, based on the * specified direction. * * MDN */ - def openCursor(): IDBRequest = ??? + def openCursor(range: IDBKeyRange = ???, direction: js.String = ???): IDBRequest = ??? + } @@ -402,11 +380,6 @@ class IDBKeyRange extends js.Object { * MDN */ def lowerOpen: js.Boolean = ??? - - def bound(lower: js.Any, upper: js.Any, lowerOpen: js.Boolean, upperOpen: js.Boolean): IDBKeyRange = ??? - - def bound(lower: js.Any, upper: js.Any, lowerOpen: js.Boolean): IDBKeyRange = ??? - /** * The bounds can be open (that is, the bounds exclude the endpoint values) or closed * (that is, the bounds include the endpoint values). By default, the bounds are @@ -414,7 +387,8 @@ class IDBKeyRange extends js.Object { * * MDN */ - def bound(lower: js.Any, upper: js.Any): IDBKeyRange = ??? + def bound(lower: js.Any, upper: js.Any, lowerOpen: js.Boolean = ???, upperOpen: js.Boolean = ???): IDBKeyRange = ??? + /** * This method may raise a DOMException with a DOMError of the following types: @@ -422,24 +396,19 @@ class IDBKeyRange extends js.Object { * MDN */ def only(value: js.Any): IDBKeyRange = ??? - - def lowerBound(bound: js.Any, open: js.Boolean): IDBKeyRange = ??? - /** * By default, it includes the lower endpoint value and is closed. * * MDN */ - def lowerBound(bound: js.Any): IDBKeyRange = ??? - - def upperBound(bound: js.Any, open: js.Boolean): IDBKeyRange = ??? + def lowerBound(bound: js.Any, open: js.Boolean = ???): IDBKeyRange = ??? /** * By default, it includes the upper endpoint value and is closed. * * MDN */ - def upperBound(bound: js.Any): IDBKeyRange = ??? + def upperBound(bound: js.Any, open: js.Boolean = ???): IDBKeyRange = ??? } @@ -596,9 +565,6 @@ class IDBDatabase extends EventTarget { * MDN */ var onabort: js.Function1[js.Any, _] = ??? - - def createObjectStore(name: js.String, optionalParameters: js.Any): IDBObjectStore = ??? - /** * The method takes the name of the store as well as a parameter object. The parameter * object lets you define important optional properties. You can use the property to @@ -608,7 +574,8 @@ class IDBDatabase extends EventTarget { * * MDN */ - def createObjectStore(name: js.String): IDBObjectStore = ??? + def createObjectStore(name: js.String, optionalParameters: js.Any = ???): IDBObjectStore = ??? + /** * The connection is not actually closed until all transactions created using this @@ -619,9 +586,6 @@ class IDBDatabase extends EventTarget { * MDN */ def close(): Unit = ??? - - def transaction(storeNames: js.Any, mode: js.String): IDBTransaction = ??? - /** * Immediately returns a transaction object (IDBTransaction) containing the * IDBTransaction.objectStore method, which you can use to access your object @@ -629,7 +593,8 @@ class IDBDatabase extends EventTarget { * * MDN */ - def transaction(storeNames: js.Any): IDBTransaction = ??? + def transaction(storeNames: js.Any, mode: js.String = ???): IDBTransaction = ??? + /** * As with createObjectStore, this method can be called only within a versionchange diff --git a/src/main/scala/org/scalajs/dom/Svg.scala b/src/main/scala/org/scalajs/dom/Svg.scala index f41f61d7d..55b585a12 100644 --- a/src/main/scala/org/scalajs/dom/Svg.scala +++ b/src/main/scala/org/scalajs/dom/Svg.scala @@ -1315,9 +1315,7 @@ class SVGSVGElement extends SVGElement with SVGStylable with SVGZoomAndPan with */ def createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform = ??? - def getComputedStyle(elt: Element, pseudoElt: js.String): CSSStyleDeclaration = ??? - - def getComputedStyle(elt: Element): CSSStyleDeclaration = ??? + def getComputedStyle(elt: Element, pseudoElt: js.String = ???): CSSStyleDeclaration = ??? /** * Searches this SVG document fragment (i.e., the search is restricted to a subset of diff --git a/src/main/scala/org/scalajs/dom/lib.scala b/src/main/scala/org/scalajs/dom/lib.scala index d006b15c9..6926ded03 100644 --- a/src/main/scala/org/scalajs/dom/lib.scala +++ b/src/main/scala/org/scalajs/dom/lib.scala @@ -256,37 +256,25 @@ class Performance extends js.Object { */ def toJSON(): js.Dynamic = ??? - def getMeasures(measureName: js.String): js.Dynamic = ??? + def getMeasures(measureName: js.String = ???): js.Dynamic = ??? - def getMeasures(): js.Dynamic = ??? - def clearMarks(markName: js.String): Unit = ??? + def clearMarks(markName: js.String = ???): Unit = ??? - def clearMarks(): Unit = ??? + def getMarks(markName: js.String = ???): js.Dynamic = ??? - def getMarks(markName: js.String): js.Dynamic = ??? - - def getMarks(): js.Dynamic = ??? def clearResourceTimings(): Unit = ??? def mark(markName: js.String): Unit = ??? - def measure(measureName: js.String, startMarkName: js.String, endMarkName: js.String): Unit = ??? - - def measure(measureName: js.String, startMarkName: js.String): Unit = ??? - - def measure(measureName: js.String): Unit = ??? + def measure(measureName: js.String, startMarkName: js.String = ???, endMarkName: js.String = ???): Unit = ??? - def getEntriesByName(name: js.String, entryType: js.String): js.Dynamic = ??? - - def getEntriesByName(name: js.String): js.Dynamic = ??? + def getEntriesByName(name: js.String, entryType: js.String = ???): js.Dynamic = ??? def getEntries(): js.Dynamic = ??? - def clearMeasures(measureName: js.String): Unit = ??? - - def clearMeasures(): Unit = ??? + def clearMeasures(measureName: js.String = ???): Unit = ??? def setResourceTimingBufferSize(maxSize: js.Number): Unit = ??? @@ -722,23 +710,7 @@ class Element extends Node with NodeSelector with ParentNode { * * MSN */ - def setAttribute(name: js.String, value: js.String): Unit = ??? - - /** - * Adds a new attribute or changes the value of an existing attribute on the - * specified element. - * - * MDN - */ - def setAttribute(name: js.String): Unit = ??? - - /** - * Adds a new attribute or changes the value of an existing attribute on the specified - * element. - * - * MDN - */ - def setAttribute(): Unit = ??? + def setAttribute(name: js.String = ???, value: js.String = ???): Unit = ??? /** * removeAttributeNS removes the specified attribute from an element. @@ -1004,15 +976,7 @@ class Node extends EventTarget { * * MDN */ - def cloneNode(deep: js.Boolean): Node = ??? - - /** - * Clone a Node, and optionally, all of its contents. By default, it clones the content - * of the node. - * - * MDN - */ - def cloneNode(): Node = ??? + def cloneNode(deep: js.Boolean = ???): Node = ??? /** * hasChildNodes returns a Boolean value indicating whether the current Node has @@ -1034,15 +998,7 @@ class Node extends EventTarget { * * MDN */ - def insertBefore(newChild: Node, refChild: Node): Node = ??? - - /** - * Inserts the first Node given in a parameter immediately before the second, child of - * this element, Node. - * - * MDN - */ - def insertBefore(newChild: Node): Node = ??? + def insertBefore(newChild: Node, refChild: Node = ???): Node = ??? } @@ -1907,17 +1863,12 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora * MDN */ def alert(): Unit = ??? - - def scroll(x: js.Number, y: js.Number): Unit = ??? - - def scroll(x: js.Number): Unit = ??? - /** * Scrolls the window to a particular place in the document. * * MDN */ - def scroll(): Unit = ??? + def scroll(x: js.Number = ???, y: js.Number = ???): Unit = ??? /** * Makes a request to bring the window to the front. It may fail due to user settings and @@ -1926,17 +1877,12 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora * MDN */ def focus(): Unit = ??? - - def scrollTo(x: js.Number, y: js.Number): Unit = ??? - - def scrollTo(x: js.Number): Unit = ??? - /** * Scrolls to a particular set of coordinates in the document. * * MDN */ - def scrollTo(): Unit = ??? + def scrollTo(x: js.Number = ???, y: js.Number = ???): Unit = ??? /** * Opens the Print Dialog to print the current document. @@ -1945,9 +1891,7 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora */ def print(): Unit = ??? - def prompt(message: js.String, defaul: js.String): js.String = ??? - - def prompt(message: js.String): js.String = ??? + def prompt(message: js.String, default: js.String = ???): js.String = ??? /** * The Window.prompt() displays a dialog with an optional message prompting the user @@ -1956,34 +1900,22 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora * MDN */ def prompt(): js.String = ??? - - def open(url: js.String, target: js.String, features: js.String, replace: js.Boolean): Window = ??? - - def open(url: js.String, target: js.String, features: js.String): Window = ??? - - def open(url: js.String, target: js.String): Window = ??? - - def open(url: js.String): Window = ??? - /** * Loads a resource in a new browsing context or an existing one. * * MDN */ - def open(): Window = ??? - - def scrollBy(x: js.Number, y: js.Number): Unit = ??? - - def scrollBy(x: js.Number): Unit = ??? + def open(url: js.String = ???, + target: js.String = ???, + features: js.String = ???, + replace: js.Boolean = ???): Window = ??? /** * Scrolls the document in the window by the given amount. * * MDN */ - def scrollBy(): Unit = ??? - - def confirm(message: js.String): js.Boolean = ??? + def scrollBy(x: js.Number = 0, y: js.Number = 0): Unit = ??? /** * The Window.confirm() method displays a modal dialog with an optional message and @@ -1991,7 +1923,8 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora * * MDN */ - def confirm(): js.Boolean = ??? + def confirm(message: js.String = ???): js.Boolean = ??? + /** * Closes the current window, or a referenced window. @@ -1999,9 +1932,6 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora * MDN */ def close(): Unit = ??? - - def postMessage(message: js.Any, targetOrigin: js.String, ports: js.Any): Unit = ??? - /** * The window.postMessage method safely enables cross-origin communication. * Normally, scripts on different pages are allowed to access each other if and only if @@ -2013,20 +1943,19 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora * * MDN */ - def postMessage(message: js.Any, targetOrigin: js.String): Unit = ??? - - def showModalDialog(url: js.String, argument: js.Any, options: js.Any): js.Dynamic = ??? - - def showModalDialog(url: js.String, argument: js.Any): js.Dynamic = ??? - - def showModalDialog(url: js.String): js.Dynamic = ??? + def postMessage(message: js.Any, targetOrigin: js.String, transfer: js.Any = ???): Unit = ??? /** - * Creates and displays a modal dialog box containing a specified HTML document. + * The Window.showModalDialog() creates and displays a modal dialog box containing + * a specified HTML document. * - * MDN + * @param url The URI of the document to display in the dialog box + * @param argument An optional variant the contains values that should be passed to the + * dialog box; these are made available in the `window` object's + * `dialogArguments` property. + * @param options An optional String that specifies window ornamentation */ - def showModalDialog(): js.Dynamic = ??? + def showModalDialog(url: js.String = ???, argument: js.Any = ???, options: js.Any = ???): js.Dynamic = ??? /** * The window.blur() method is the programmatic equivalent of the user shifting @@ -2043,17 +1972,7 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora */ def getSelection(): Selection = ??? - def getComputedStyle(elt: Element, pseudoElt: js.String): CSSStyleDeclaration = ??? - - /** - * getComputedStyle() gives the values of all the CSS properties of an element after - * applying the active stylesheets and resolving any basic computation those values - * may contain. - * - * MDN - */ - def getComputedStyle(elt: Element): CSSStyleDeclaration = ??? - + def getComputedStyle(elt: Element, pseudoElt: js.String = ???): CSSStyleDeclaration = ??? /** * An OfflineResourceList object providing access to the offline resources for the @@ -2070,7 +1989,6 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora * MDN */ var onpopstate: js.Function1[PopStateEvent, _] = ??? - var onmspointerup: js.Function1[js.Any, _] = ??? /** * Returns a new MediaQueryList object representing the parsed results of the @@ -2114,17 +2032,13 @@ class Window extends EventTarget with WindowLocalStorage with WindowSessionStora * MDN */ class EventTarget extends js.Object { - def removeEventListener(`type`: js.String, listener: js.Function1[Event, Unit], useCapture: js.Boolean): Unit = ??? - /** * Removes the event listener previously registered with * EventTarget.addEventListener. * * MDN */ - def removeEventListener(`type`: js.String, listener: js.Function1[Event, Unit]): Unit = ??? - - def addEventListener(`type`: js.String, listener: js.Function1[Event, Unit], useCapture: js.Boolean): Unit = ??? + def removeEventListener(`type`: js.String, listener: js.Function1[Event, _], useCapture: js.Boolean = ???): Unit = ??? /** * The EventTarget.addEventListener() method registers the specified listener on @@ -2134,7 +2048,7 @@ class EventTarget extends js.Object { * * MDN */ - def addEventListener(`type`: js.String, listener: js.Function1[Event, Unit]): Unit = ??? + def addEventListener(`type`: js.String, listener: js.Function1[Event, _], useCapture: js.Boolean = ???): Unit = ??? /** * Dispatches an Event at the specified EventTarget, invoking the affected @@ -2822,11 +2736,6 @@ class Document extends Node with NodeSelector with DocumentEvent with ParentNode * MDN */ def createProcessingInstruction(target: js.String, data: js.String): ProcessingInstruction = ??? - - def execCommand(commandId: js.String, showUI: js.Boolean, value: js.Any): js.Boolean = ??? - - def execCommand(commandId: js.String, showUI: js.Boolean): js.Boolean = ??? - /** * When an HTML document has been switched to designMode, the document object exposes * the execCommand method which allows one to run commands to manipulate the @@ -2837,7 +2746,7 @@ class Document extends Node with NodeSelector with DocumentEvent with ParentNode * * MDN */ - def execCommand(commandId: js.String): js.Boolean = ??? + def execCommand(commandId: js.String, showUI: js.Boolean = ???, value: js.Any = ???): js.Boolean = ??? /** * Returns the element from the document whose elementFromPoint method is being @@ -2904,21 +2813,13 @@ class Document extends Node with NodeSelector with DocumentEvent with ParentNode * MDN */ def createElementNS(namespaceURI: js.String, qualifiedName: js.String): Element = ??? - - def open(url: js.String, name: js.String, features: js.String, replace: js.Boolean): js.Dynamic = ??? - - def open(url: js.String, name: js.String, features: js.String): js.Dynamic = ??? - - def open(url: js.String, name: js.String): js.Dynamic = ??? - - def open(url: js.String): js.Dynamic = ??? - /** * The document.open() method opens a document for writing. * * MDN */ - def open(): js.Dynamic = ??? + def open(url: js.String = ???, name: js.String = ???, features: js.String = ???, replace: js.Boolean = ???): js.Dynamic = ??? + /** * Reports whether or not the specified editor query command is supported by the @@ -2986,9 +2887,7 @@ class Document extends Node with NodeSelector with DocumentEvent with ParentNode */ def createRange(): Range = ??? - def fireEvent(eventName: js.String, eventObj: js.Any): js.Boolean = ??? - - def fireEvent(eventName: js.String): js.Boolean = ??? + def fireEvent(eventName: js.String, eventObj: js.Any = ???): js.Boolean = ??? /** * createComment() creates a new comment node, and returns it. @@ -3014,11 +2913,7 @@ class Document extends Node with NodeSelector with DocumentEvent with ParentNode */ def createDocumentFragment(): DocumentFragment = ??? - def createStyleSheet(href: js.String, index: js.Number): CSSStyleSheet = ??? - - def createStyleSheet(href: js.String): CSSStyleSheet = ??? - - def createStyleSheet(): CSSStyleSheet = ??? + def createStyleSheet(href: js.String = ???, index: js.Number = ???): CSSStyleSheet = ??? /** * Returns a list of elements with a given name in the (X)HTML document. @@ -3278,21 +3173,11 @@ class CanvasRenderingContext2D extends js.Object { def quadraticCurveTo(cpx: js.Number, cpy: js.Number, x: js.Number, y: js.Number): Unit = ??? - def putImageData(imagedata: ImageData, dx: js.Number, dy: js.Number, dirtyX: js.Number, dirtyY: js.Number, dirtyWidth: js.Number, dirtyHeight: js.Number): Unit = ??? - - def putImageData(imagedata: ImageData, dx: js.Number, dy: js.Number, dirtyX: js.Number, dirtyY: js.Number, dirtyWidth: js.Number): Unit = ??? - - def putImageData(imagedata: ImageData, dx: js.Number, dy: js.Number, dirtyX: js.Number, dirtyY: js.Number): Unit = ??? - - def putImageData(imagedata: ImageData, dx: js.Number, dy: js.Number, dirtyX: js.Number): Unit = ??? - - def putImageData(imagedata: ImageData, dx: js.Number, dy: js.Number): Unit = ??? + def putImageData(imagedata: ImageData, dx: js.Number, dy: js.Number, dirtyX: js.Number = ???, dirtyY: js.Number = ???, dirtyWidth: js.Number = ???, dirtyHeight: js.Number = ???): Unit = ??? def rotate(angle: js.Number): Unit = ??? - def fillText(text: js.String, x: js.Number, y: js.Number, maxWidth: js.Number): Unit = ??? - - def fillText(text: js.String, x: js.Number, y: js.Number): Unit = ??? + def fillText(text: js.String, x: js.Number, y: js.Number, maxWidth: js.Number = ???): Unit = ??? /** * Moves the origin point of the context to (x, y). @@ -3318,17 +3203,12 @@ class CanvasRenderingContext2D extends js.Object { * MDN */ def getLineDash(): js.Array[js.Number] = ??? - - def fill(fillRule: js.String): Unit = ??? - /** * Fills the subpaths with the current fill style. * * MDN */ - def fill(): Unit = ??? - - def createImageData(imageDataOrSw: js.Any, sh: js.Number): ImageData = ??? + def fill(fillRule: js.String = ???): Unit = ??? /** * Creates a new, blank ImageData object with the specified dimensions. All of the @@ -3336,7 +3216,8 @@ class CanvasRenderingContext2D extends js.Object { * * MDN */ - def createImageData(imageDataOrSw: js.Any): ImageData = ??? + def createImageData(imageDataOrSw: js.Any, sh: js.Number = ???): ImageData = ??? + def createPattern(image: HTMLElement, repetition: js.String): CanvasPattern = ??? @@ -3349,9 +3230,6 @@ class CanvasRenderingContext2D extends js.Object { def closePath(): Unit = ??? def rect(x: js.Number, y: js.Number, w: js.Number, h: js.Number): Unit = ??? - - def clip(fillRule: js.String): Unit = ??? - /** * Creates a clipping path from the current sub-paths. Everything drawn after clip() * is called appears inside the clipping path only. For an example, see Clipping paths @@ -3359,7 +3237,8 @@ class CanvasRenderingContext2D extends js.Object { * * MDN */ - def clip(): Unit = ??? + def clip(fillRule: js.String = ???): Unit = ??? + /** * Sets all pixels in the rectangle defined by starting point (x, y) and size (width, @@ -3394,26 +3273,13 @@ class CanvasRenderingContext2D extends js.Object { def fillRect(x: js.Number, y: js.Number, w: js.Number, h: js.Number): Unit = ??? def bezierCurveTo(cp1x: js.Number, cp1y: js.Number, cp2x: js.Number, cp2y: js.Number, x: js.Number, y: js.Number): Unit = ??? - - def drawImage(image: HTMLElement, offsetX: js.Number, offsetY: js.Number, width: js.Number, height: js.Number, canvasOffsetX: js.Number, canvasOffsetY: js.Number, canvasImageWidth: js.Number, canvasImageHeight: js.Number): Unit = ??? - - def drawImage(image: HTMLElement, offsetX: js.Number, offsetY: js.Number, width: js.Number, height: js.Number, canvasOffsetX: js.Number, canvasOffsetY: js.Number, canvasImageWidth: js.Number): Unit = ??? - - def drawImage(image: HTMLElement, offsetX: js.Number, offsetY: js.Number, width: js.Number, height: js.Number, canvasOffsetX: js.Number, canvasOffsetY: js.Number): Unit = ??? - - def drawImage(image: HTMLElement, offsetX: js.Number, offsetY: js.Number, width: js.Number, height: js.Number, canvasOffsetX: js.Number): Unit = ??? - - def drawImage(image: HTMLElement, offsetX: js.Number, offsetY: js.Number, width: js.Number, height: js.Number): Unit = ??? - - def drawImage(image: HTMLElement, offsetX: js.Number, offsetY: js.Number, width: js.Number): Unit = ??? - /** * Draws the specified image. This method is available in multiple formats, * providing a great deal of flexibility in its use. * * MDN */ - def drawImage(image: HTMLElement, offsetX: js.Number, offsetY: js.Number): Unit = ??? + def drawImage(image: HTMLElement, offsetX: js.Number, offsetY: js.Number, width: js.Number = ???, height: js.Number = ???, canvasOffsetX: js.Number = ???, canvasOffsetY: js.Number = ???, canvasImageWidth: js.Number = ???, canvasImageHeight: js.Number = ???): Unit = ??? def transform(m11: js.Number, m12: js.Number, m21: js.Number, m22: js.Number, dx: js.Number, dy: js.Number): Unit = ??? @@ -3434,9 +3300,7 @@ class CanvasRenderingContext2D extends js.Object { def setLineDash(segments: js.Array[js.Number]): Unit = ??? - def strokeText(text: js.String, x: js.Number, y: js.Number, maxWidth: js.Number): Unit = ??? - - def strokeText(text: js.String, x: js.Number, y: js.Number): Unit = ??? + def strokeText(text: js.String, x: js.Number, y: js.Number, maxWidth: js.Number = ???): Unit = ??? /** * Starts a new path by resetting the list of sub-paths. Call this method when you want @@ -3530,25 +3394,15 @@ class XMLHttpRequest extends EventTarget { */ var timeout: js.Number = ??? var onload: js.Function1[Event, _] = ??? - - def open(method: js.String, url: js.String, async: js.Boolean, user: js.String, password: js.String): Unit = ??? - - def open(method: js.String, url: js.String, async: js.Boolean, user: js.String): Unit = ??? - - def open(method: js.String, url: js.String, async: js.Boolean): Unit = ??? - /** * Initializes a request. This method is to be used from JavaScript code; to * initialize a request from native code, use openRequest()instead. * * MDN */ - def open(method: js.String, url: js.String): Unit = ??? + def open(method: js.String, url: js.String, async: js.Boolean = ???, user: js.String = ???, password: js.String = ???): Unit = ??? def create(): XMLHttpRequest = ??? - - def send(data: js.Any): Unit = ??? - /** * Sends the request. If the request is asynchronous (which is the default), this * method returns as soon as the request is sent. If the request is synchronous, this @@ -3556,7 +3410,8 @@ class XMLHttpRequest extends EventTarget { * * MDN */ - def send(): Unit = ??? + def send(data: js.Any = ???): Unit = ??? + /** * Aborts the request if it has already been sent. @@ -3822,9 +3677,6 @@ trait DataTransfer extends js.Object { * MDN */ def dropEffect: js.String = ??? - - def clearData(format: js.String): js.Boolean = ??? - /** * Remove the data associated with a given type. The type argument is optional. If the * type is empty or not specified, the data associated with all types is removed. If @@ -3833,7 +3685,7 @@ trait DataTransfer extends js.Object { * * MDN */ - def clearData(): js.Boolean = ??? + def clearData(format: js.String = ???): js.Boolean = ??? /** * Set the data for a given type. If data for the type does not exist, it is added at the @@ -4546,8 +4398,6 @@ trait Location extends js.Object { */ var host: js.String = ??? - def reload(flag: js.Boolean): Unit = ??? - /** * The Location.reload()method Reloads the resource from the current URL. Its * optional unique parameter is a Boolean, which, when it is true, causes the page to @@ -4556,7 +4406,8 @@ trait Location extends js.Object { * * MDN */ - def reload(): Unit = ??? + def reload(flag: js.Boolean = ???): Unit = ??? + /** * The Location.replace()method replaces the current resource with the one at the @@ -4760,9 +4611,7 @@ object PositionError extends js.Object { class StyleSheetList extends js.Object { def length: js.Number = ??? - def item(index: js.Number): StyleSheet = ??? - - def item(): StyleSheet = ??? + def item(index: js.Number = ???): StyleSheet = ??? @scala.scalajs.js.annotation.JSBracketAccess def apply(index: js.Number): StyleSheet = ??? @@ -4812,9 +4661,8 @@ trait Geolocation extends js.Object { */ def clearWatch(watchId: js.Number): Unit = ??? - def getCurrentPosition(successCallback: js.Function1[Position, Unit], errorCallback: js.Function1[PositionError, Unit], options: PositionOptions): Unit = ??? + def getCurrentPosition(successCallback: js.Function1[Position, _], errorCallback: js.Function1[PositionError, _], options: PositionOptions = ???): Unit = ??? - def getCurrentPosition(successCallback: js.Function1[Position, Unit], errorCallback: js.Function1[PositionError, Unit]): Unit = ??? /** * The Geolocation.getCurrentPosition() method is used to get the current position @@ -4822,11 +4670,7 @@ trait Geolocation extends js.Object { * * MDN */ - def getCurrentPosition(successCallback: js.Function1[Position, Unit]): Unit = ??? - - def watchPosition(successCallback: js.Function1[Position, Unit], errorCallback: js.Function1[PositionError, Unit], options: PositionOptions): js.Number = ??? - - def watchPosition(successCallback: js.Function1[Position, Unit], errorCallback: js.Function1[PositionError, Unit]): js.Number = ??? + def getCurrentPosition(successCallback: js.Function1[Position, _]): Unit = ??? /** * The Geolocation.watchPosition() method is used to register a handler function @@ -4835,7 +4679,7 @@ trait Geolocation extends js.Object { * * MDN */ - def watchPosition(successCallback: js.Function1[Position, Unit]): js.Number = ??? + def watchPosition(successCallback: js.Function1[Position, _], errorCallback: js.Function1[PositionError, _] = ???, options: PositionOptions = ???): js.Number = ??? } @@ -6008,22 +5852,15 @@ trait CloseEvent extends Event { * connection to a server, as well as for sending and receiving data on the connection. * * MDN + * + * @param url The URL as resolved by the constructor. This is always an absolute + * URL. Read only. + * @param protocol A string indicating the name of the sub-protocol the server selected; this will be + * one of the strings specified in the protocols parameter when creating the + * WebSocket object. */ -class WebSocket protected() extends EventTarget { - def this(url: js.String) = this() - - def this(url: js.String, prototcol: js.String) = this() - - def this(url: js.String, prototcol: js.Array[js.String]) = this() - - /** - * A string indicating the name of the sub-protocol the server selected; this will be - * one of the strings specified in the protocols parameter when creating the - * WebSocket object. - * - * MDN - */ - var protocol: js.String = ??? +class WebSocket(var url: js.String = ???, var protocol: js.String = ???) extends EventTarget { + def this(url: js.String, protocol: js.Array[js.String]) = this("", "") /** * The current state of the connection; this is one of the Ready state constants. Read @@ -6049,7 +5886,7 @@ class WebSocket protected() extends EventTarget { * * MDN */ - var onopen: js.Function1[Event, Unit] = ??? + var onopen: js.Function1[Event, _] = ??? /** * The extensions selected by the server. This is currently only the empty string or a @@ -6065,21 +5902,21 @@ class WebSocket protected() extends EventTarget { * * MDN */ - var onmessage: js.Function1[MessageEvent, Unit] = ??? + var onmessage: js.Function1[MessageEvent, _] = ??? /** * An event listener to be called when the WebSocket connection's readyState changes * to CLOSED. The listener receives a CloseEvent named "close". * * MDN */ - var onclose: js.Function1[CloseEvent, Unit] = ??? + var onclose: js.Function1[CloseEvent, _] = ??? /** * An event listener to be called when an error occurs. This is a simple event named * "error". * * MDN */ - var onerror: js.Function1[ErrorEvent, Unit] = ??? + var onerror: js.Function1[ErrorEvent, _] = ??? /** * A string indicating the type of binary data being transmitted by the connection. * This should be either "blob" if DOM Blob objects are being used or "arraybuffer" @@ -6088,16 +5925,6 @@ class WebSocket protected() extends EventTarget { * MDN */ var binaryType: js.String = ??? - /** - * The URL as resolved by the constructor. This is always an absolute URL. Read only. - * - * MDN - */ - val url: js.String = ??? - - def close(code: js.Number, reason: js.String): Unit = ??? - - def close(code: js.Number): Unit = ??? /** * Closes the WebSocket connection or connection attempt, if any. If the connection @@ -6105,7 +5932,8 @@ class WebSocket protected() extends EventTarget { * * MDN */ - def close(): Unit = ??? + + def close(code: js.Number = ???, reason: js.String = ???): Unit = ??? /** * Transmits data to the server over the WebSocket connection. @@ -6267,9 +6095,6 @@ trait URL extends js.Object { * MDN */ def revokeObjectURL(url: js.String): Unit = ??? - - def createObjectURL(`object`: js.Any, options: ObjectURLOptions): js.String = ??? - /** * The URL.createObjectURL() static method creates a DOMString containing an URL * representing the object given in parameter. The URL lifetime is tied to the @@ -6278,7 +6103,8 @@ trait URL extends js.Object { * * MDN */ - def createObjectURL(`object`: js.Any): js.String = ??? + def createObjectURL(`object`: js.Any, options: ObjectURLOptions = ???): js.String = ??? + } /** @@ -6459,9 +6285,7 @@ trait Console extends js.Object { */ def info(message: js.Any, optionalParams: js.Any*): Unit = ??? - def profile(reportName: js.String): Unit = ??? - - def profile(): Unit = ??? + def profile(reportName: js.String = ???): Unit = ??? def assert(test: js.Boolean, message: js.String, optionalParams: js.Any*): Unit = ??? @@ -6582,9 +6406,7 @@ trait MessagePort extends EventTarget { def close(): Unit = ??? - def postMessage(message: js.Any, ports: js.Any): Unit = ??? - - def postMessage(message: js.Any): Unit = ??? + def postMessage(message: js.Any, ports: js.Any = ???): Unit = ??? def start(): Unit = ??? @@ -6659,10 +6481,7 @@ trait BlobPropertyBag extends js.Object { * * MDN */ -class Blob extends js.Object { - def this(blobParts: js.Array[js.Any], options: BlobPropertyBag) = this() - - def this(blobParts: js.Array[js.Any]) = this() +class Blob(blobParts: js.Array[js.Any] = ???, options: BlobPropertyBag = ???) extends js.Object { def `type`: js.String = ??? @@ -6672,20 +6491,13 @@ class Blob extends js.Object { * MDN */ def size: js.Number = ??? - - def slice(start: js.Number, end: js.Number, contentType: js.String): Blob = ??? - - def slice(start: js.Number, end: js.Number): Blob = ??? - - def slice(start: js.Number): Blob = ??? - /** * The slice is used to create a new Blob object containing the data in the specified * range of bytes of the source Blob. * * MDN */ - def slice(): Blob = ??? + def slice(start: js.Number = ???, end: js.Number = ???, contentType: js.String = ???): Blob = ??? def close(): Unit = ??? } @@ -6748,17 +6560,15 @@ trait DOMSettableTokenList extends DOMTokenList { * * MDN */ -class FormData extends js.Object { - def this(form: HTMLFormElement) = this() - - def append(name: js.Any, value: js.Any, blobName: js.String): Unit = ??? +class FormData(form: HTMLFormElement = ???) extends js.Object { /** * Appends a key/value pair to the FormData object. * * MDN */ - def append(name: js.Any, value: js.Any): Unit = ??? + def append(name: js.Any, value: js.Any, blobName: js.String = ???): Unit = ??? + } object FormData extends js.Object { @@ -6875,8 +6685,7 @@ trait ValidityState extends js.Object { * * MDN */ -class Worker protected() extends AbstractWorker { - def this(stringUrl: js.String) = this() +class Worker (stringUrl: js.String) extends AbstractWorker { /** * The Worker.onmessage property represents an EventHandler, that is a function to @@ -6888,8 +6697,6 @@ class Worker protected() extends AbstractWorker { */ var onmessage: js.Function1[js.Any, _] = ??? - def postMessage(message: js.Any, ports: js.Any): Unit = ??? - /** * The Worker.postMessage() method sends a message to the worker's inner scope. This * accepts a single parameter, which is the data to send to the worker. The data may be @@ -6898,7 +6705,7 @@ class Worker protected() extends AbstractWorker { * * MDN */ - def postMessage(message: js.Any): Unit = ??? + def postMessage(message: js.Any, ports: js.Any = ???): Unit = ??? /** * The Worker.terminate() method immediately terminates the Worker. This does not From eb84fac41ca20557b6cd50e6025cc5806ba1dcaa Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Mon, 17 Feb 2014 16:49:13 -0800 Subject: [PATCH 3/4] fix typo in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1e8c54d68..da6bed6ca 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Contributing Scala-js-dom is a work in progress. The current code base is a hodgepodge of auto-generated/scraped/hand-tweaked code, and is full of rough edges. If you see something that you think can be improved, feel free to send a pull request. These could include: - Improved doc-comments; who doesn't love better docs? -- Missing methods/properties/classes; send the PR adding it in including it together with a link to an authoritative source (e.g. MDN) and it should get merge +- Missing methods/properties/classes; send the PR adding it in including it together with a link to an authoritative source (e.g. MDN) and it should get merged. - Additional extensions (in `org.scalajs.dom.extensions`). These currently represent an arbitrary collection of helpers that have been needed so far. If there's some implicit that you find you need and you think other people will to, send a pull request and we can talk about it. License From 48108dae33d6d9903f6f8297967c932dfeb09118 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Mon, 17 Feb 2014 16:50:04 -0800 Subject: [PATCH 4/4] update readme sbt snippet to use version 0.2 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index da6bed6ca..c1dcaea9d 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Usage Add the following to your sbt build definition: - libraryDependencies += "org.scala-lang.modules.scalajs" %% "scalajs-dom" % "0.1-SNAPSHOT" + libraryDependencies += "org.scala-lang.modules.scalajs" %% "scalajs-dom" % "0.2" then enjoy the types available in `org.scalajs.dom`.