Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <title>remove meta viewport node</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  <meta id="viewport" name="viewport" content="width=device-width, initial-scale=1">
  <script src="viewport_helpers.js"></script>
</head>
<body>
  <script>
    "use strict";
    add_task(async function remove_viewport_node() {
      await SpecialPowers.pushPrefEnv(scaleRatio(1.0));
      let viewport = document.getElementById("viewport");
      let info = getViewportInfo(800, 480);
      is(info.defaultZoom, 1, "initial zoom is 1");
      is(info.width, 800, "width should be 800");
      is(info.height, 480, "height should be 480");
      // Now there is no <meta name="viewport">, but we still retain the info
      // from the last one.
      viewport.remove();
      info = getViewportInfo(800, 480);
      is(info.defaultZoom, 1, "initial zoom is 1");
      is(info.width, 800, "width should be 800");
      is(info.height, 480, "height should be 480");
    });
  </script>
</body>
</html>