Skip to content

Add URL constructor #235

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

Merged
merged 1 commit into from
Jul 14, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions src/main/scala/org/scalajs/dom/experimental/URL.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package org.scalajs.dom.experimental

import scala.scalajs.js

/**
* The URL() constructor returns a newly created URL object representing the URL
* defined by the parameters.
*
* MDN
*/
@js.native
class URL(url: String, base: String = js.native) extends js.Object {

/**
* Returns a DOMString containing the origin of the URL, that is its scheme,
* its domain and its port.
*
* MDN
*/
def origin: String = js.native

/**
* Is a DOMString containing the whole URL.
*
* MDN
*/
var href: String = js.native

/**
* Is a DOMString containing the protocol scheme of the URL,
* including the final ':'.
*
* MDN
*/
var protocol: String = js.native

/**
* Is a DOMString containing the username specified before the domain name.
*
* MDN
*/
var username: String = js.native

/**
* Is a DOMString containing the password specified before the domain name.
*
* MDN
*/
var password: String = js.native

/**
* Is a DOMString containing the host, that is the hostname, a ':',
* and the port of the URL.
*
* MDN
*/
var host: String = js.native

/**
* Is a DOMString containing the domain of the URL.
*
* MDN
*/
var hostname: String = js.native

/**
* Is a DOMString containing the port number of the URL.
*
* MDN
*/
var port: String = js.native

/**
* Is a DOMString containing an initial '/' followed by the path of the URL.
*
* MDN
*/
var pathname: String = js.native

/**
* Is a DOMString containing a '?' followed by the parameters of the URL.
*
* MDN
*/
var search: String = js.native

/**
* Is a DOMString containing a '#' followed by the fragment identifier of the URL.
*
* MDN
*/
var hash: String = js.native
}