Skip to content

Commit

Permalink
Merge pull request #294 from w3c/denis/generic-exceptions
Browse files Browse the repository at this point in the history
Generic exceptions
  • Loading branch information
deniak committed Feb 27, 2016
2 parents 8f044be + 314523d commit 812095a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
21 changes: 16 additions & 5 deletions lib/exceptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ function findSet(shortname) {
function _findSet(name) {
if (count > 10)
return undefined;
var set = records[name];
var set = [];
for (var k in records) {
var regex = new RegExp(k);
if (records.hasOwnProperty(k) && regex.test(name)) {
set.push(records[k]);
}
}
count++;
if (typeof set === "String")
return _findSet(set);
Expand All @@ -27,11 +33,16 @@ Exceptions.prototype.has = function (shortname, rule, key, extra) {
var set = findSet(shortname);
if (set === undefined) return false;
for (var i = set.length - 1; i >= 0; i--) {
var exception = set[i];
for (var y = set[i].length - 1; y >= 0; y--) {
var exception = set[i][y];

return (rule === exception.rule
&& (extra === undefined
|| compareValue(extra.type, exception.type)));
if (rule === exception.rule
&& (extra === undefined
|| (compareValue(extra.type, exception.type)
&& compareValue(extra.source, exception.source)))) {
return true;
}
}
}
return false;
};
Expand Down
13 changes: 10 additions & 3 deletions lib/exceptions.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
{
"webrtc": [
".*": [
{
"rule": "validation.css",
"type": "generator.unrecognize",
"source": "https://www.w3.org/StyleSheets/TR/2016/base.css"
}
],
"^webrtc$": [
{
"rule": "headers.copyright"
}
],
"mediacapture-streams": [
"^mediacapture-streams$": [
{
"rule": "headers.copyright"
}
],
"css-ui-3": [
"^css-ui-3$": [
{
"rule": "validation.css",
"type": "at-rule"
Expand Down

0 comments on commit 812095a

Please sign in to comment.