Merge pull request #260 from twbs/fix-259

Allow "x-ua-compatible: ie=edge"
This commit is contained in:
Chris Rebert 2015-03-15 05:52:37 -07:00
Родитель 432e506f2b 50234ce5b8
Коммит 01e8dec617
3 изменённых файлов: 31 добавлений и 2 удалений

Просмотреть файл

@ -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.');

23
test/fixtures/x-ua-compatible/lowercase.html поставляемый Normal file
Просмотреть файл

@ -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>