-
Notifications
You must be signed in to change notification settings - Fork 161
Migrate DOMParser to dom #566
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
import scala.scalajs.js.annotation._ | ||
|
||
/** The [[DOMParser]] interface provides the ability to parse XML or HTML source code from a string into a DOM Document. | ||
* | ||
* You can perform the opposite operation—converting a DOM tree into XML or HTML source—using the `XMLSerializer` | ||
* interface. | ||
* | ||
* In the case of an HTML document, you can also replace portions of the DOM with new DOM trees built from HTML by | ||
* setting the value of the `Element.innerHTML` and `outerHTML` properties. These properties can also be read to fetch | ||
* HTML fragments corresponding to the corresponding DOM subtree. | ||
* | ||
* Note that `XMLHttpRequest` can parse XML and HTML directly from a URL-addressable resource, returning a Document in | ||
* its response property. | ||
*/ | ||
@js.native | ||
@JSGlobal | ||
class DOMParser extends js.Object { | ||
|
||
/** The DOMParser can also be used to parse a SVG document or a HTML document. There are three different results | ||
* possible, selected by the MIME type given. If the MIME type is text/xml, the resulting object will be an | ||
* XMLDocument, if the MIME type is image/svg+xml, it will be an SVGDocument and if the MIME type is text/html, it | ||
* will be an HTMLDocument. | ||
*/ | ||
def parseFromString(string: String, mimeType: MIMEType): Document = js.native | ||
} | ||
|
||
@js.native | ||
sealed trait MIMEType extends js.Any | ||
|
||
object MIMEType { | ||
val `text/html` = "text/html".asInstanceOf[MIMEType] | ||
val `text/xml` = "text/xml".asInstanceOf[MIMEType] | ||
val `application/xml` = "application/xml".asInstanceOf[MIMEType] | ||
|
||
val `application/xhtml+xml` = | ||
"application/xhtml+xml".asInstanceOf[MIMEType] | ||
val `image/svg+xml` = "image/svg+xml".asInstanceOf[MIMEType] | ||
} |
31 changes: 0 additions & 31 deletions
31
src/main/scala/org/scalajs/dom/experimental/domparser/DOMParser.scala
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
src/main/scala/org/scalajs/dom/experimental/domparser/package.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.scalajs | ||
package dom.experimental | ||
|
||
package object domparser { | ||
|
||
@deprecated("use dom.DOMParser instead", "2.0.0") | ||
type DOMParser = dom.DOMParser | ||
|
||
@deprecated("use dom.MIMEType instead", "2.0.0") | ||
type SupportedType = dom.MIMEType | ||
|
||
@deprecated("use dom.MIMEType instead", "2.0.0") | ||
val SupportedType = dom.MIMEType | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.