-
Notifications
You must be signed in to change notification settings - Fork 161
Update dom/form data #800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update dom/form data #800
Changes from 1 commit
3d9f133
1f3526c
31c026c
3fc37fe
8989d97
60f2e98
862b43e
30cbe41
aa5a898
1582e48
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,17 +8,48 @@ package org.scalajs.dom | |
|
||
import scala.scalajs.js | ||
import scala.scalajs.js.annotation._ | ||
import scala.scalajs.js.| | ||
|
||
/** XMLHttpRequest Level 2 adds support for the new FormData interface. FormData objects provide a way to easily | ||
* construct a set of key/value pairs representing form fields and their values, which can then be easily sent using | ||
* the XMLHttpRequest send() method. | ||
*/ | ||
@js.native | ||
@JSGlobal | ||
class FormData(form: HTMLFormElement = js.native) extends js.Object { | ||
class FormData(form: HTMLFormElement = js.native) extends js.Iterable[js.Tuple2[String, String]] { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, it seems there are three possible constructors. new FormData()
new FormData(form)
new FormData(form, submitter) class FormData extends ... {
def this(form: HTMLFormElement) = this()
def this(form: HTMLFormElement, submitter: HTMLElement) = this()
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. class FormData(form: HTMLFormElement = js.native) extends ... {
def this(form: HTMLFormElement) = this(form)
def this(form: HTMLFormElement, submitter: HTMLElement) = this(form)
} I think this is good point ! I'd be grateful if someone could fix this part for sure There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That won't work, because there are two constructors that take a I believe the correct change is the one I suggested in #800 (comment). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. got it ! |
||
|
||
/** Appends a key/value pair to the FormData object. */ | ||
def append(name: js.Any, value: js.Any, blobName: String = js.native): Unit = js.native | ||
|
||
/** Deletes a key/value pair from the FormData object. */ | ||
def delete(name: String): Unit = js.native | ||
|
||
/** Returns the first value associated with a given key from within a FormData object. */ | ||
def get(name: String): String | Blob = js.native | ||
zetashift marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** Returns whether a FormData object contains a certain key. */ | ||
def has(name: String): Boolean = js.native | ||
|
||
/** Sets a new value for an existing key inside a FormData object, or adds the key/value if it does not already exist. | ||
*/ | ||
def set( | ||
name: String, value: String | Blob, blobName: String = js.native | ||
): Unit = js.native | ||
|
||
@JSName(js.Symbol.iterator) | ||
override def jsIterator(): js.Iterator[js.Tuple2[String, String]] = js.native | ||
|
||
/** Returns an iterator that iterates through all key/value pairs contained in the FormData. */ | ||
def entries(): js.Iterator[js.Tuple2[String, String | Blob]] = js.native | ||
|
||
/** Returns an array of all the values associated with a given key from within a FormData. */ | ||
def getAll(name: String): js.Array[String | Blob] = js.native | ||
|
||
/** Returns an iterator iterates through all keys of the key/value pairs contained in the FormData. */ | ||
def keys(): js.Iterator[String] = js.native | ||
|
||
/** Returns an iterator that iterates through all values contained in the FormData. */ | ||
def values(): js.Iterator[String | Blob] = js.native | ||
} | ||
|
||
@js.native | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clear