Skip to content

Commit

Permalink
Adding HTML global attributes detection
Browse files Browse the repository at this point in the history
  • Loading branch information
SphinxKnight committed Mar 17, 2018
1 parent 91703fb commit c71cef2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/html/compat-analyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@ function initParser (browserScope, fileName, numLine, report, callback){
});
}
Object.keys(attribs).map((attrib)=>{
let versionAddedAttr = null;
let featureName = "";
if(bcd.html.elements[name][attrib] && bcd.html.elements[name][attrib].__compat){
const versionAddedAttr = bcd.html.elements[name][attrib].__compat.support[browser].version_added;
versionAddedAttr = bcd.html.elements[name][attrib].__compat.support[browser].version_added;
featureName = "<" + name + "> - attribute " + attrib;
} else if (bcd.html.global_attributes[attrib] && bcd.html.global_attributes[attrib].__compat){
versionAddedAttr = bcd.html.global_attributes[attrib].__compat.support[browser].version_added;
featureName = "global attribute " + attrib;
}
if(versionAddedAttr){
if((!versionAddedAttr) || (versionAddedAttr !== true && semver.lt(semver.coerce(browserScope[browser]), semver.coerce(versionAddedAttr)) )){
report.push({
"featureName":"<" + name + "> - attr" + attrib,
"featureName":featureName,
"browser":browser,
"fileName":fileName,
"line": numLine,
Expand All @@ -68,7 +76,6 @@ function initParser (browserScope, fileName, numLine, report, callback){
});
}
}

});
});

Expand Down

0 comments on commit c71cef2

Please sign in to comment.