Skip to content

Commit c8f04e2

Browse files
authored
Warn about viewport shrink-to-fit directive (#108)
1 parent c9c6706 commit c8f04e2

File tree

6 files changed

+17
-6
lines changed

6 files changed

+17
-6
lines changed

crx/capo.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crx/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 3,
33
"name": "Capo: get your ﹤𝚑𝚎𝚊𝚍﹥ in order",
44
"description": "Visualize the optimal ordering of ﹤𝚑𝚎𝚊𝚍﹥ elements on any web page",
5-
"version": "1.5.1",
5+
"version": "1.5.2",
66
"permissions": [
77
"scripting",
88
"activeTab",

docs/src/lib/capo.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,7 @@ function $c322f9a5057eaf5c$var$validateMetaViewport(element) {
890890
];
891891
if (!validValues.includes(interactiveWidget)) warnings.push(`Unsupported value "${interactiveWidget}" found.`);
892892
}
893+
if ("shrink-to-fit" in directives) warnings.push("The shrink-to-fit directive has been obsolete since iOS 9.2.\n See https://www.scottohara.me/blog/2018/12/11/shrink-to-fit.html");
893894
const validDirectives = new Set([
894895
"width",
895896
"height",
@@ -900,7 +901,8 @@ function $c322f9a5057eaf5c$var$validateMetaViewport(element) {
900901
"interactive-widget"
901902
]);
902903
Object.keys(directives).filter((directive)=>{
903-
return !validDirectives.has(directive);
904+
// shrink-to-fit is not valid, but we have a separate warning for it.
905+
return !validDirectives.has(directive) && directive != "shrink-to-fit";
904906
}).forEach((directive)=>{
905907
warnings.push(`Invalid viewport directive "${directive}".`);
906908
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rviscomi/capo.js",
3-
"version": "1.5.1",
3+
"version": "1.5.2",
44
"description": "Get your ﹤𝚑𝚎𝚊𝚍﹥ in order",
55
"author": "Rick Viscomi",
66
"license": "Apache-2.0",

snippet/capo.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,7 @@ function $580f7ed6bc170ae8$var$validateMetaViewport(element) {
891891
];
892892
if (!validValues.includes(interactiveWidget)) warnings.push(`Unsupported value "${interactiveWidget}" found.`);
893893
}
894+
if ("shrink-to-fit" in directives) warnings.push("The shrink-to-fit directive has been obsolete since iOS 9.2.\n See https://www.scottohara.me/blog/2018/12/11/shrink-to-fit.html");
894895
const validDirectives = new Set([
895896
"width",
896897
"height",
@@ -901,7 +902,8 @@ function $580f7ed6bc170ae8$var$validateMetaViewport(element) {
901902
"interactive-widget"
902903
]);
903904
Object.keys(directives).filter((directive)=>{
904-
return !validDirectives.has(directive);
905+
// shrink-to-fit is not valid, but we have a separate warning for it.
906+
return !validDirectives.has(directive) && directive != "shrink-to-fit";
905907
}).forEach((directive)=>{
906908
warnings.push(`Invalid viewport directive "${directive}".`);
907909
});

src/lib/validation.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,12 @@ function validateMetaViewport(element) {
675675
}
676676
}
677677

678+
if ("shrink-to-fit" in directives) {
679+
warnings.push(
680+
"The shrink-to-fit directive has been obsolete since iOS 9.2.\n See https://www.scottohara.me/blog/2018/12/11/shrink-to-fit.html"
681+
);
682+
}
683+
678684
const validDirectives = new Set([
679685
"width",
680686
"height",
@@ -686,7 +692,8 @@ function validateMetaViewport(element) {
686692
]);
687693
Object.keys(directives)
688694
.filter((directive) => {
689-
return !validDirectives.has(directive);
695+
// shrink-to-fit is not valid, but we have a separate warning for it.
696+
return !validDirectives.has(directive) && directive != "shrink-to-fit";
690697
})
691698
.forEach((directive) => {
692699
warnings.push(`Invalid viewport directive "${directive}".`);

0 commit comments

Comments
 (0)