1 | "use strict";
|
2 |
|
3 | var format = require("util").format;
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | function rule(analyzer) {
|
12 | var re = {
|
13 | property: /^(\*|-ms-filter)/,
|
14 | selector: /^(\* html|html\s?>\s?body) /,
|
15 | value: /progid:DXImageTransform\.Microsoft|!ie$/,
|
16 | };
|
17 |
|
18 | analyzer.setMetric("oldIEFixes");
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | analyzer.on("selector", function (rule, selector) {
|
24 | if (re.selector.test(selector)) {
|
25 | analyzer.incrMetric("oldIEFixes");
|
26 | analyzer.addOffender("oldIEFixes", selector);
|
27 | }
|
28 | });
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | analyzer.on("declaration", function (rule, property, value) {
|
35 | if (re.property.test(property) || re.value.test(value)) {
|
36 | analyzer.incrMetric("oldIEFixes");
|
37 | analyzer.addOffender(
|
38 | "oldIEFixes",
|
39 | format("%s {%s: %s}", rule.selectors.join(", "), property, value)
|
40 | );
|
41 | }
|
42 | });
|
43 | }
|
44 |
|
45 | rule.description =
|
46 | "Reports fixes for old versions of Internet Explorer (IE9 and below)";
|
47 | module.exports = rule;
|