mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Removed unnecessary type
attribute in script tags (#9586)
closes #9585 - for reference: https://stackoverflow.com/questions/3485606/will-removing-the-type-from-a-script-tag-break-in-any-browsers
This commit is contained in:
parent
097e1d1fac
commit
ce98d272fe
4 changed files with 14 additions and 14 deletions
|
@ -27,7 +27,7 @@ function makeHidden(name, extras) {
|
|||
* document.querySelector['.location']['value'] = document.querySelector('.location')['value'] || window.location.href;
|
||||
*/
|
||||
subscribeScript =
|
||||
'<script type="text/javascript">' +
|
||||
'<script>' +
|
||||
'(function(g,h,o,s,t){' +
|
||||
'h[o](\'.location\')[s]=h[o](\'.location\')[s] || g.location.href;' +
|
||||
'h[o](\'.referrer\')[s]=h[o](\'.referrer\')[s] || h.referrer;' +
|
||||
|
|
|
@ -44,10 +44,10 @@ function finaliseStructuredData(metaData) {
|
|||
}
|
||||
|
||||
function getAjaxHelper(clientId, clientSecret) {
|
||||
return '<script type="text/javascript" src="' +
|
||||
return '<script src="' +
|
||||
getAssetUrl('public/ghost-sdk.js', true) +
|
||||
'"></script>\n' +
|
||||
'<script type="text/javascript">\n' +
|
||||
'<script>\n' +
|
||||
'ghost.init({\n' +
|
||||
'\tclientId: "' + clientId + '",\n' +
|
||||
'\tclientSecret: "' + clientSecret + '"\n' +
|
||||
|
|
|
@ -20,18 +20,18 @@ describe('{{ghost_foot}} helper', function () {
|
|||
});
|
||||
|
||||
it('outputs global injected code', function (done) {
|
||||
settingsCacheStub.withArgs('ghost_foot').returns('<script type="text/javascript">var test = \'I am a variable!\'</script>');
|
||||
settingsCacheStub.withArgs('ghost_foot').returns('<script>var test = \'I am a variable!\'</script>');
|
||||
|
||||
helpers.ghost_foot({data: {}}).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<script type="text\/javascript">var test = 'I am a variable!'<\/script>/);
|
||||
rendered.string.should.match(/<script>var test = 'I am a variable!'<\/script>/);
|
||||
|
||||
done();
|
||||
}).catch(done);
|
||||
});
|
||||
|
||||
it('outputs post injected code', function (done) {
|
||||
settingsCacheStub.withArgs('ghost_foot').returns('<script type="text/javascript">var test = \'I am a variable!\'</script>');
|
||||
settingsCacheStub.withArgs('ghost_foot').returns('<script>var test = \'I am a variable!\'</script>');
|
||||
|
||||
helpers.ghost_foot({
|
||||
data: {
|
||||
|
@ -43,7 +43,7 @@ describe('{{ghost_foot}} helper', function () {
|
|||
}
|
||||
}).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<script type="text\/javascript">var test = 'I am a variable!'<\/script>/);
|
||||
rendered.string.should.match(/<script>var test = 'I am a variable!'<\/script>/);
|
||||
rendered.string.should.match(/post-codeinjection/);
|
||||
|
||||
done();
|
||||
|
@ -51,7 +51,7 @@ describe('{{ghost_foot}} helper', function () {
|
|||
});
|
||||
|
||||
it('handles post injected code being null', function (done) {
|
||||
settingsCacheStub.withArgs('ghost_foot').returns('<script type="text/javascript">var test = \'I am a variable!\'</script>');
|
||||
settingsCacheStub.withArgs('ghost_foot').returns('<script>var test = \'I am a variable!\'</script>');
|
||||
|
||||
helpers.ghost_foot({
|
||||
data: {
|
||||
|
@ -63,7 +63,7 @@ describe('{{ghost_foot}} helper', function () {
|
|||
}
|
||||
}).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<script type="text\/javascript">var test = 'I am a variable!'<\/script>/);
|
||||
rendered.string.should.match(/<script>var test = 'I am a variable!'<\/script>/);
|
||||
rendered.string.should.not.match(/post-codeinjection/);
|
||||
|
||||
done();
|
||||
|
@ -71,7 +71,7 @@ describe('{{ghost_foot}} helper', function () {
|
|||
});
|
||||
|
||||
it('handles post injected code being empty', function (done) {
|
||||
settingsCacheStub.withArgs('ghost_foot').returns('<script type="text/javascript">var test = \'I am a variable!\'</script>');
|
||||
settingsCacheStub.withArgs('ghost_foot').returns('<script>var test = \'I am a variable!\'</script>');
|
||||
|
||||
helpers.ghost_foot({
|
||||
data: {
|
||||
|
@ -83,7 +83,7 @@ describe('{{ghost_foot}} helper', function () {
|
|||
}
|
||||
}).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<script type="text\/javascript">var test = 'I am a variable!'<\/script>/);
|
||||
rendered.string.should.match(/<script>var test = 'I am a variable!'<\/script>/);
|
||||
rendered.string.should.not.match(/post-codeinjection/);
|
||||
|
||||
done();
|
||||
|
|
|
@ -1539,7 +1539,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
}
|
||||
})).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<script type="text\/javascript" src="\/public\/ghost-sdk\.js\?v=/);
|
||||
rendered.string.should.match(/<script src="\/public\/ghost-sdk\.js\?v=/);
|
||||
|
||||
done();
|
||||
});
|
||||
|
@ -1557,7 +1557,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
}
|
||||
})).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<script type="text\/javascript">\n/);
|
||||
rendered.string.should.match(/<script src="/);
|
||||
rendered.string.should.match(/ghost\.init\(\{/);
|
||||
rendered.string.should.match(/\tclientId: "/);
|
||||
rendered.string.should.match(/\tclientSecret: "/);
|
||||
|
@ -1596,7 +1596,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
}
|
||||
})).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.not.match(/<script type="text\/javascript">\n/);
|
||||
rendered.string.should.not.match(/<script src="/);
|
||||
rendered.string.should.not.match(/ghost\.init\(\{/);
|
||||
rendered.string.should.not.match(/\tclientId: "/);
|
||||
rendered.string.should.not.match(/\tclientSecret: "/);
|
||||
|
|
Loading…
Reference in a new issue