Permalink
Browse files

Warn about viewport values that restrict resizing

Fixes #379 Thanks @stevefaulkner
  • Loading branch information...
sideshowbarker committed Dec 11, 2016
1 parent 3530d33 commit 7cfc964d343cbd677beee32dad8f8e6ecab1210b
Showing with 18 additions and 8 deletions.
  1. +18 −8 src/nu/validator/checker/schematronequiv/Assertions.java
@@ -2301,15 +2301,25 @@ else if ("bdo" == localName && atts.getIndex("", "dir") < 0) {
}
hasMetaCharset = true;
}
if (atts.getIndex("", "name") > -1
&& "description".equals(atts.getValue("", "name"))) {
if (hasMetaDescription) {
err("A document must not include more than one"
+ " \u201Cmeta\u201D element with its"
+ " \u201Cname\u201D attribute set to the value"
+ " \u201Cdescription\u201D.");
if (atts.getIndex("", "name") > -1) {
if ("description".equals(atts.getValue("", "name"))) {
if (hasMetaDescription) {
err("A document must not include more than one"
+ " \u201Cmeta\u201D element with its"
+ " \u201Cname\u201D attribute set to the"
+ " value \u201Cdescription\u201D.");
}
hasMetaDescription = true;
}
if ("viewport".equals(atts.getValue("", "name"))) {
String contentVal = atts.getValue("",
"content").toLowerCase();
if (contentVal.contains("user-scalable=no")
|| contentVal.contains("maximum-scale=1.0")) {
warn("Consider avoiding viewport values that"
+ " prevent users from resizing documents.");
}
}
hasMetaDescription = true;
}
if (atts.getIndex("", "http-equiv") > -1
&& lowerCaseLiteralEqualsIgnoreAsciiCaseString(

0 comments on commit 7cfc964

Please sign in to comment.