From a5978467fdf7d7d0131c77c6bea73b849d07da9a Mon Sep 17 00:00:00 2001 From: "Michael[tm] Smith" Date: Wed, 28 Nov 2018 11:31:06 +0900 Subject: [PATCH] Allow rel=modulepreload for the link element Fixes https://github.com/validator/validator/issues/733 Thanks @SimonSiefke --- CHANGELOG.md | 6 ++++++ src/nu/validator/checker/schematronequiv/Assertions.java | 6 +++++- src/nu/validator/datatype/LinkRel.java | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c082596f9..57145a8a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ With a few exceptions, this is a record of mainly just user-facing changes—that is, either changes to the actual behavior of the checker, or changes to any options/interfaces the checker exposes for developers. +# N.N.N +05 November 2018 +NN XXX NNNN + - Disallow `accept-charset` values other than `UTF-8` + - Allow `rel=modulepreload` for the `link` element + # 18.11.5 05 November 2018 - Fix bugs that can cause the command-line checker to emit broken JSON output diff --git a/src/nu/validator/checker/schematronequiv/Assertions.java b/src/nu/validator/checker/schematronequiv/Assertions.java index ab64b3f67..c885906fd 100644 --- a/src/nu/validator/checker/schematronequiv/Assertions.java +++ b/src/nu/validator/checker/schematronequiv/Assertions.java @@ -2688,7 +2688,9 @@ else if ("bdo" == localName && atts.getIndex("", "dir") < 0) { .toLowerCase().split("\\s+")); } if (atts.getIndex("", "as") > -1 - && ((relList != null && !relList.contains("preload") + && ((relList != null // + && !(relList.contains("preload") + || relList.contains("modulepreload")) || !hasRel))) { err("A \u201Clink\u201D element with an" + " \u201Cas\u201D attribute must have a" @@ -2753,6 +2755,7 @@ else if ("bdo" == localName && atts.getIndex("", "dir") < 0) { if ((ancestorMask & BODY_MASK) != 0 && (relList != null && !(relList.contains("dns-prefetch") + || relList.contains("modulepreload") || relList.contains("pingback") || relList.contains("preconnect") || relList.contains("prefetch") @@ -2767,6 +2770,7 @@ else if ("bdo" == localName && atts.getIndex("", "dir") < 0) { + " \u201Citemprop\u201D attribute or has a" + " \u201Crel\u201D attribute whose value contains" + " \u201Cdns-prefetch\u201D," + + " \u201Cmodulepreload\u201D," + " \u201Cpingback\u201D," + " \u201Cpreconnect\u201D," + " \u201Cprefetch\u201D," diff --git a/src/nu/validator/datatype/LinkRel.java b/src/nu/validator/datatype/LinkRel.java index b4cc46083..f334766d5 100644 --- a/src/nu/validator/datatype/LinkRel.java +++ b/src/nu/validator/datatype/LinkRel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017 Mozilla Foundation + * Copyright (c) 2013-2018 Mozilla Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -48,6 +48,7 @@ public final class LinkRel extends AbstractRel { registeredValues.add("icon"); registeredValues.add("license"); registeredValues.add("mask-icon"); + registeredValues.add("modulepreload"); registeredValues.add("next"); registeredValues.add("pingback"); registeredValues.add("preconnect");