-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
63 additions
and
1,582 deletions.
There are no files selected for viewing
This file contains 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 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 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,28 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<title>Viewport tests</title> | ||
<link rel="stylesheet" type="text/css" href="styles.css" /> | ||
</head> | ||
<body> | ||
<p><a href="../../">[Home]</a> ↣ <strong>[Viewport Test Cases]</strong></p> | ||
<p>This section contains various use-cases of <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag">viewport meta tag</a>. This affects page rendering depending on the hardware (e.g. mobile / desktop) and browser configuration (e.g. desktop mode, accesibility preferences).</p> | ||
|
||
<ul> | ||
<li><a href="case/?content=width=600,initial-scale=1">width=600,initial-scale=1</a></li> | ||
<li><a href="case/?content=width=600">width=600</a></li> | ||
<li><a href="case/?content=width=device-width,initial-scale=1">width=device-width,initial-scale=1</a></li> | ||
<li><a href="case/?content=width=device-width,initial-scale=2">width=device-width,initial-scale=2</a></li> | ||
<li><a href="case/?content=width=device-width">width=device-width</a></li> | ||
<li><a href="case/?content=initial-scale=1">initial-scale=1</a></li> | ||
<li><a href="case/?content=initial-scale=2">initial-scale=2</a></li> | ||
<li><a href="case/?content=width=600;initial-scale=2,user-scalable=no">width=600;initial-scale=2,user-scalable=no</a></li> | ||
<li><a href="case/?content=user-scalable=no">user-scalable=no</a></li> | ||
<li><a href="case/">no viewport tag</a></li> | ||
<li><a href="viewport-multiple-tags.html">multiple viewport tags</a></li> | ||
<li><a href="viewport-conflicting-tags.html">conflicting viewport tags</a></li> | ||
</ul> | ||
</body> | ||
</html> |
This file contains 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,20 @@ | ||
const fs = require('fs'); | ||
const express = require('express'); | ||
const router = express.Router(); | ||
|
||
router.get('/case/', (req, res) => { | ||
let tag = ''; | ||
if (typeof req.query.content !== 'undefined') { | ||
const sanitizedContent = String.prototype.replaceAll.call(req.query.content, /[^a-zA-Z0-9,; =-]/g, ''); | ||
tag = `<meta name="viewport" content="${sanitizedContent}">`; | ||
} | ||
fs.readFile('./viewport/server/viewport-template.html', { encoding: 'utf-8' }, (err, contents) => { | ||
if (err) { | ||
res.statusCode = 500; | ||
return res.end('error'); | ||
} | ||
res.end(contents.replace('{{ VIEWPORT_TAG }}', tag)); | ||
}); | ||
}); | ||
|
||
module.exports = router; |
7 changes: 3 additions & 4 deletions
7
...ompat/viewport/viewport-custom-width.html → viewport/server/viewport-template.html
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.