summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign.html
blob: 7e18804c283adf0055124602d2c78130d803a351 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!DOCTYPE HTML>
<html>
  <head>
    <title>location_assign</title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
  </head>
  <body>
    <div id="log"></div>
    <script>
    test(function () {
      var href = location.href;
      location.assign('#x');

      assert_equals((href + "#x"), location.href, "location href");

    }, "location assign");

    test(function () {
      var href = location.href;
      assert_throws('SYNTAX_ERR', function() { location.assign("http://:"); });
      assert_equals(location.href, href);
    }, "URL that fails to parse");
    </script>
  </body>
</html>