зеркало из https://github.com/twbs/bootlint.git
Merge pull request #260 from twbs/fix-259
Allow "x-ua-compatible: ie=edge"
This commit is contained in:
Коммит
01e8dec617
|
@ -366,7 +366,10 @@ var LocationIndex = _location.LocationIndex;
|
|||
}
|
||||
});
|
||||
addLinter("W002", function lintXUaCompatible($, reporter) {
|
||||
var meta = $('head>meta[http-equiv="X-UA-Compatible"][content="IE=edge"]');
|
||||
var meta = $([
|
||||
'head>meta[http-equiv="X-UA-Compatible"][content="IE=edge"]',
|
||||
'head>meta[http-equiv="x-ua-compatible"][content="ie=edge"]'
|
||||
].join(','));
|
||||
if (!meta.length) {
|
||||
reporter("`<head>` is missing X-UA-Compatible `<meta>` tag that disables old IE compatibility modes");
|
||||
}
|
||||
|
|
|
@ -84,10 +84,13 @@ exports.bootlint = {
|
|||
test.done();
|
||||
},
|
||||
'X-UA-Compatible': function (test) {
|
||||
test.expect(2);
|
||||
test.expect(3);
|
||||
test.deepEqual(lintHtml(utf8Fixture('x-ua-compatible/present.html')),
|
||||
[],
|
||||
'should not complain when X-UA-Compatible <meta> tag is present.');
|
||||
test.deepEqual(lintHtml(utf8Fixture('x-ua-compatible/lowercase.html')),
|
||||
[],
|
||||
'should not complain when X-UA-Compatible <meta> tag is present but lowercased.');
|
||||
test.deepEqual(lintHtml(utf8Fixture('x-ua-compatible/missing.html')),
|
||||
["`<head>` is missing X-UA-Compatible `<meta>` tag that disables old IE compatibility modes"],
|
||||
'should complain when X-UA-Compatible <meta> tag is missing.');
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Test</title>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<script src="../../lib/jquery.min.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="../../lib/qunit.css">
|
||||
<script src="../../lib/qunit.js"></script>
|
||||
<script src="../../../dist/browser/bootlint.js"></script>
|
||||
<script src="../generic-qunit.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="qunit"></div>
|
||||
<ol id="bootlint"></ol>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче