From 2fdb9c82d55b909ffabe3d69c5a41de082ab1116 Mon Sep 17 00:00:00 2001 From: Bryce Johnson Date: Sat, 9 Jan 2016 06:02:24 -0500 Subject: [PATCH 1/2] Remove unneccessary refs to type attr in helper output snippets. See Issue #1695: https://github.com/hexojs/hexo/issues/1695 Also see the HTML5 Spec section on the type attr: http://dev.w3.org/html5/spec-preview/Overview.html#attr-link-type In short, the use of type tags is purely advisory, and the spec instructs browsers to infer the resource type before fetching them. In cases where the inference does not match the declaration, the resource will not be loaded. When the declaration is left off, the resource will load. It appears generally safer to leave the tags off entirely. --- lib/plugins/helper/css.js | 2 +- lib/plugins/helper/feed_tag.js | 2 +- lib/plugins/helper/js.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/plugins/helper/css.js b/lib/plugins/helper/css.js index 42286ac9e9..b8f58f7d71 100644 --- a/lib/plugins/helper/css.js +++ b/lib/plugins/helper/css.js @@ -13,7 +13,7 @@ function cssHelper() { result += cssHelper.apply(this, path); } else { if (path.substring(path.length - 4, path.length) !== '.css') path += '.css'; - result += ''; + result += ''; } } diff --git a/lib/plugins/helper/feed_tag.js b/lib/plugins/helper/feed_tag.js index c6df2d9b02..4811c522db 100644 --- a/lib/plugins/helper/feed_tag.js +++ b/lib/plugins/helper/feed_tag.js @@ -6,7 +6,7 @@ function feedTagHelper(path, options) { var title = options.title || this.config.title; var type = options.type || 'atom'; - return ''; + return ''; } module.exports = feedTagHelper; diff --git a/lib/plugins/helper/js.js b/lib/plugins/helper/js.js index 7ae902d66d..bea2cab015 100644 --- a/lib/plugins/helper/js.js +++ b/lib/plugins/helper/js.js @@ -13,7 +13,7 @@ function jsHelper() { result += jsHelper.apply(this, path); } else { if (path.substring(path.length - 3, path.length) !== '.js') path += '.js'; - result += ''; + result += ''; } } From d1c3098f01204414665682e983107ba38950701b Mon Sep 17 00:00:00 2001 From: Bryce Johnson Date: Sat, 9 Jan 2016 06:24:31 -0500 Subject: [PATCH 2/2] Revise tests to not expect type attrs in generated link/script tags. --- test/scripts/helpers/css.js | 2 +- test/scripts/helpers/feed_tag.js | 6 +++--- test/scripts/helpers/js.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/scripts/helpers/css.js b/test/scripts/helpers/css.js index 8d5c8a8b5c..819edce2ac 100644 --- a/test/scripts/helpers/css.js +++ b/test/scripts/helpers/css.js @@ -18,7 +18,7 @@ describe('css', function() { var expected = ''; for (var i = 1, len = arguments.length; i < len; i++) { - expected += '\n'; + expected += '\n'; } result.should.eql(expected.trim()); diff --git a/test/scripts/helpers/feed_tag.js b/test/scripts/helpers/feed_tag.js index e380c7a9b4..cc7da1c864 100644 --- a/test/scripts/helpers/feed_tag.js +++ b/test/scripts/helpers/feed_tag.js @@ -15,14 +15,14 @@ describe('feed_tag', function() { var feed = require('../../../lib/plugins/helper/feed_tag').bind(ctx); it('path', function() { - feed('atom.xml').should.eql(''); + feed('atom.xml').should.eql(''); }); it('title', function() { - feed('atom.xml', {title: 'RSS Feed'}).should.eql(''); + feed('atom.xml', {title: 'RSS Feed'}).should.eql(''); }); it('type', function() { - feed('rss.xml', {type: 'rss'}).should.eql(''); + feed('rss.xml', {type: 'rss'}).should.eql(''); }); }); diff --git a/test/scripts/helpers/js.js b/test/scripts/helpers/js.js index 5c7cf79ec9..51f9636633 100644 --- a/test/scripts/helpers/js.js +++ b/test/scripts/helpers/js.js @@ -18,7 +18,7 @@ describe('js', function() { var expected = ''; for (var i = 1, len = arguments.length; i < len; i++) { - expected += '\n'; + expected += '\n'; } result.should.eql(expected.trim());