File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
src/main/scala/org/scalajs/dom/experimental/domparser Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ package org .scalajs .dom .experimental .domparser
2
+
3
+ import scala .scalajs .js
4
+ import scala .scalajs .js .|
5
+
6
+ import org .scalajs .dom .raw .{Document , HTMLDocument }
7
+
8
+ /**
9
+ * DOMParser can parse XML or HTML source stored in a string into a DOM Document.
10
+ *
11
+ * MDN
12
+ */
13
+ @ js.native
14
+ class DOMParser extends js.Object {
15
+ /**
16
+ * The DOMParser can also be used to parse a SVG document or a HTML document.
17
+ * There are three different results possible, selected by the MIME type given.
18
+ * If the MIME type is text/xml, the resulting object will be an XMLDocument,
19
+ * if the MIME type is image/svg+xml, it will be an SVGDocument and
20
+ * if the MIME type is text/html, it will be an HTMLDocument.
21
+ *
22
+ * MDN
23
+ */
24
+ def parseFromString (string : String , supportedType : SupportedType ): Document = js.native
25
+ }
26
+
27
+ @ js.native
28
+ sealed trait SupportedType extends js.Any
29
+
30
+ object SupportedType {
31
+ val `text/html` = " text/html" .asInstanceOf [SupportedType ]
32
+ val `text/xml` = " text/xml" .asInstanceOf [SupportedType ]
33
+ val `application/xml` = " application/xml" .asInstanceOf [SupportedType ]
34
+ val `application/xhtml+xml` = " application/xhtml+xml" .asInstanceOf [SupportedType ]
35
+ val `image/svg+xml` = " image/svg+xml" .asInstanceOf [SupportedType ]
36
+ }
You can’t perform that action at this time.
0 commit comments