diff --git a/url.bs b/url.bs index 8ad40e2d..18a7c7dc 100644 --- a/url.bs +++ b/url.bs @@ -3502,6 +3502,54 @@ e.g., "newURL" and "oldURL". examples of proper naming. [[!HTML]] +

URLHost class

+ +
+[Exposed=*]
+interface URLHost {
+  constructor(USVString host);
+
+  readonly attribute URLHostType type;
+
+  stringifier USVString toJSON();
+};
+
+enum URLHostType { "ipv4", "ipv6", "domain" };
+ +

Each {{URLHost}} object has an associated host (a host). + +


+ +

The URLHost(input) constructor steps +are: + +

    +
  1. Let host be the result of host parsing input with true. + +

  2. If host is failure, then throw a {{TypeError}}. + +

  3. Set this's host to host. +

+ +

The type getter steps are: + +

    +
  1. If this's host is an IPv4 address, then return + "ipv4". + +

  2. If this's host is an IPv6 address, then return + "ipv6". + +

  3. Assert: this's host is a domain. + +

  4. Return "domain". +

+ +

The stringification behavior and +toJSON() method steps, are to return this's +host, serialized. + +

Acknowledgments

@@ -3614,7 +3662,8 @@ Wei Wang, Wolf Lammen, 山岸和利 (Yamagishi Kazutoshi), Yongsheng Zhang, -成瀬ゆい (Yui Naruse), and +成瀬ゆい (Yui Naruse), +Zach Lym, and zealousidealroll for being awesome!