Skip to content

Commit

Permalink
Allow “color” attribute with link[rel="mask-icon"]
Browse files Browse the repository at this point in the history
Fixes #174 Thanks @925dk & @XhmikosR

Relates to whatwg/html#110
Relates to whatwg/html#2230
Relates to jadu/pulsar#465

See also #483
  • Loading branch information
sideshowbarker committed Mar 26, 2017
1 parent 6e9eeb8 commit 8b33317
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ changes to any options/interfaces the checker exposes for developers.

# 17.3.0
26 March 2017
- Allow “color” attribute with link[rel="mask-icon"]
- Allow `meta[name]` to have `itemref`/`itemscope`/`itemtype`/`itemid`
- Allow `allow-top-navigation-by-user-activation` in `iframe[sandbox]`
- Stop hiding “sectioning roots” headings in “Heading-level outline”
Expand Down
2 changes: 1 addition & 1 deletion docs
Submodule docs updated from 09cd01 to 61a84f
5 changes: 5 additions & 0 deletions schema/html5/common.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@ common.attrs.other =
}+
}

## color for <link rel="mask-icon"> and <meta name="theme-color">

common.data.color =
w:color

## MIME types

common.data.mimetype =
Expand Down
5 changes: 5 additions & 0 deletions schema/html5/meta.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ datatypes w = "http://whattf.org/datatype-draft"
& shared-hyperlink.attrs.type?
& referrerpolicy?
& link.attrs.sizes?
& link.attrs.color?
# link.attrs.title included in common.attrs
& embedded.content.attrs.crossorigin?
& ( common.attrs.aria.role.link
Expand Down Expand Up @@ -207,6 +208,10 @@ datatypes w = "http://whattf.org/datatype-draft"
attribute sizes {
w:string "any" | common.data.sizes
}
link.attrs.color =
attribute color {
common.data.color
}
link.inner =
( empty )

Expand Down
8 changes: 8 additions & 0 deletions src/nu/validator/checker/schematronequiv/Assertions.java
Original file line number Diff line number Diff line change
Expand Up @@ -2425,6 +2425,14 @@ else if ("bdo" == localName && atts.getIndex("", "dir") < 0) {
+ " value \u201Cicon\u201D or the value"
+ " \u201Capple-touch-icon\u201D.");
}
if (atts.getIndex("", "color") > -1 //
&& (!hasRel || (relList != null
&& !relList.contains("mask-icon")))) {
err("A \u201Clink\u201D element with a"
+ " \u201Ccolor\u201D attribute must have a"
+ " \u201Crel\u201D attribute that contains"
+ " the value \u201Cmask-icon\u201D.");
}
if ((ancestorMask & BODY_MASK) != 0
&& (relList != null
&& !(relList.contains("dns-prefetch")
Expand Down
51 changes: 51 additions & 0 deletions src/nu/validator/datatype/Color.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2017 Mozilla Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/

package nu.validator.datatype;

import org.relaxng.datatype.DatatypeException;

public class Color extends AbstractDatatype {

public static final Color THE_INSTANCE = new Color();

public Color() {
super();
}

/**
* @see nu.validator.datatype.AbstractDatatype#checkValid(java.lang.CharSequence)
*/
@Override
public void checkValid(CharSequence literal) throws DatatypeException {
// TODO Auto-generated method stub
}

/**
* @see nu.validator.datatype.AbstractDatatype#getName()
*/
@Override
public String getName() {
return "color";
}

}
2 changes: 2 additions & 0 deletions src/nu/validator/datatype/Html5DatatypeLibrary.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ public Datatype createDatatype(String typeLocalName)
return StringWithoutLineBreaks.THE_INSTANCE;
} else if ("simple-color".equals(typeLocalName)) {
return SimpleColor.THE_INSTANCE;
} else if ("color".equals(typeLocalName)) {
return Color.THE_INSTANCE;
} else if ("time-datetime".equals(typeLocalName)) {
return TimeDatetime.THE_INSTANCE;
} else if ("svg-pathdata".equals(typeLocalName)) {
Expand Down
1 change: 1 addition & 0 deletions src/nu/validator/datatype/LinkRel.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public final class LinkRel extends AbstractRel {
registeredValues.add("help");
registeredValues.add("icon");
registeredValues.add("license");
registeredValues.add("mask-icon");
registeredValues.add("next");
registeredValues.add("pingback");
registeredValues.add("preconnect");
Expand Down

0 comments on commit 8b33317

Please sign in to comment.