Skip to content

Commit ee2fbb0

Browse files
authored
Merge pull request #1 from typekit/master
sync
2 parents 33bec9d + 117e48d commit ee2fbb0

23 files changed

+99
-208
lines changed

CHANGELOG

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
v1.6.28 (March 27, 2017)
2+
3+
* Clear timer timeout when promise resolves.
4+
5+
v1.6.27 (November 29, 2016)
6+
7+
* Disable native font loading for Safari 10
8+
19
v1.6.26 (July 8, 2016)
210

311
* Add support for latin extended in the Google Fonts module.

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Web Font Loader gives you added control when using linked fonts via `@font-face`
2626
To use the Web Font Loader library, just include it in your page and tell it which fonts to load. For example, you could load fonts from [Google Fonts](http://www.google.com/fonts/) using the Web Font Loader hosted on [Google Hosted Libraries](https://developers.google.com/speed/libraries/) using the following code.
2727

2828
```html
29-
<script src="https://ajax.googleapis.com/ajax/libs/webfont/1.6.16/webfont.js"></script>
29+
<script src="https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js"></script>
3030
<script>
3131
WebFont.load({
3232
google: {
@@ -36,7 +36,7 @@ To use the Web Font Loader library, just include it in your page and tell it whi
3636
</script>
3737
```
3838

39-
Alternatively, you can link to the latest `1.x` version of the Web Font Loader by using `https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js` as the `script` source. Note that the version in this url is less specific. It will always load the latest `1.x` version, but it also has a shorter cache time to ensure that your page gets updates in a timely manner. For performance reasons, we recommend using an explicit version number (such as `1.6.16`) in urls when using the Web Font Loader in production. You can manually update the Web Font Loader version number in the url when you want to adopt a new version.
39+
Alternatively, you can link to the latest `1.x` version of the Web Font Loader by using `https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js` as the `script` source. Note that the version in this url is less specific. It will always load the latest `1.x` version, but it also has a shorter cache time to ensure that your page gets updates in a timely manner. For performance reasons, we recommend using an explicit version number (such as `1.6.26`) in urls when using the Web Font Loader in production. You can manually update the Web Font Loader version number in the url when you want to adopt a new version.
4040

4141
Web Font Loader is also available on the [jsDelivr](http://www.jsdelivr.com/projects/webfontloader) & [CDNJS](https://cdnjs.com/libraries/webfont) CDNs.
4242

@@ -50,7 +50,8 @@ It is also possible to use the Web Font Loader asynchronously. For example, to l
5050
5151
(function(d) {
5252
var wf = d.createElement('script'), s = d.scripts[0];
53-
wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.16/webfont.js';
53+
wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js';
54+
wf.async = true;
5455
s.parentNode.insertBefore(wf, s);
5556
})(document);
5657
</script>
@@ -384,7 +385,7 @@ If `providerA` can serve fonts to a browser, but `providerB` cannot, The `fontin
384385

385386
## Copyright and License
386387

387-
Web Font Loader Copyright (c) 2010 Adobe Systems Incorporated, Google Incorporated.
388+
Web Font Loader Copyright (c) 2010-2017 Adobe Systems Incorporated, Google Incorporated.
388389

389390
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
390391

lib/webfontloader.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require 'webfontloader/modules'
44

55
module WebFontLoader
6-
VERSION = '1.6.26'
6+
VERSION = '1.6.28'
77

88
ProjectRoot = File.expand_path(File.dirname(__FILE__) + "/..")
99

lib/webfontloader/demo/server.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ class Server < Sinatra::Base
88
DemoRoot = File.expand_path(File.join(File.dirname(__FILE__)))
99
ProjectRoot = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", ".."))
1010

11-
GoogleApi = "http://fonts.googleapis.com/css"
12-
GoogleFontApi = "http://themes.googleusercontent.com/font"
11+
GoogleApi = "https://fonts.googleapis.com/css"
12+
GoogleFontApi = "https://themes.googleusercontent.com/font"
1313

1414
set :app_file, __FILE__
1515
set :sessions, false
@@ -43,7 +43,7 @@ class Server < Sinatra::Base
4343
headers 'Cache-Control' => 'max-age=300'
4444
response = open(url, 'User-Agent' => env['HTTP_USER_AGENT'])
4545
source = response.read
46-
source.gsub!(%r[http://themes.googleusercontent.com/font], '/fonts/font')
46+
source.gsub!(%r[https://themes.googleusercontent.com/font], '/fonts/font')
4747
source
4848
end
4949

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webfontloader",
3-
"version": "1.6.26",
3+
"version": "1.6.28",
44
"description": "Web Font Loader gives you added control when using linked fonts via @font-face.",
55
"main": "webfontloader.js",
66
"scripts": {

spec/core/domhelper_spec.js

Lines changed: 0 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -405,100 +405,6 @@ describe('DomHelper', function () {
405405
});
406406
});
407407

408-
describe('#getProtocol', function () {
409-
it('should return http', function () {
410-
var domHelper = new DomHelper({
411-
location: {
412-
protocol: 'http:'
413-
}
414-
});
415-
416-
expect(domHelper.getProtocol()).toEqual('http:');
417-
});
418-
419-
it('should return https', function () {
420-
var domHelper = new DomHelper({
421-
location: {
422-
protocol: 'https:'
423-
}
424-
});
425-
426-
expect(domHelper.getProtocol()).toEqual('https:');
427-
});
428-
429-
it('should return the protocol from an iframe', function () {
430-
var domHelper = new DomHelper({
431-
location: {
432-
protocol: 'https:'
433-
}
434-
}, {
435-
location: {
436-
protocol: 'http:'
437-
}
438-
});
439-
440-
expect(domHelper.getProtocol()).toEqual('http:');
441-
});
442-
443-
it('should return the protocol from the main window if the iframe has no protocol', function () {
444-
var domHelper = new DomHelper({
445-
location: {
446-
protocol: 'http:'
447-
}
448-
}, {
449-
location: {
450-
protocol: 'about:'
451-
}
452-
});
453-
454-
expect(domHelper.getProtocol()).toEqual('http:');
455-
});
456-
});
457-
458-
describe('#setProtocol', function () {
459-
it('ignores invalid values', function () {
460-
var domHelper = new DomHelper({
461-
location: 'http:'
462-
});
463-
464-
domHelper.setProtocol('huh');
465-
466-
expect(domHelper.getProtocol()).toEqual('http:');
467-
});
468-
469-
it('overrides the global value', function () {
470-
var domHelper = new DomHelper({
471-
location: 'http:'
472-
});
473-
474-
domHelper.setProtocol('https:');
475-
476-
expect(domHelper.getProtocol()).toEqual('https:');
477-
});
478-
});
479-
480-
describe('#isHttps', function () {
481-
it('should return true if the protocol is https', function () {
482-
var domHelper = new DomHelper({
483-
location: {
484-
protocol: 'https:'
485-
}
486-
});
487-
488-
expect(domHelper.isHttps()).toBe(true);
489-
});
490-
491-
it('should return false if the protocol is not https', function () {
492-
var domHelper = new DomHelper({
493-
location: {
494-
protocol: 'http:'
495-
}
496-
});
497-
498-
expect(domHelper.isHttps()).toBe(false);
499-
});
500-
});
501-
502408
describe('#getHostname', function () {
503409
it('should return the hostname', function () {
504410
var domHelper = new DomHelper({

spec/core/fontwatcher_spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ describe('FontWatcher', function () {
7474
spyOn(FontWatcher, 'getUserAgent').andReturn('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:43.0) Gecko/20100101 Firefox/43.0');
7575
expect(FontWatcher.shouldUseNativeLoader()).toEqual(true);
7676
});
77+
78+
it('is disabled on Safari > 10', function () {
79+
spyOn(FontWatcher, 'getUserAgent').andReturn('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14');
80+
spyOn(FontWatcher, 'getVendor').andReturn('Apple');
81+
expect(FontWatcher.shouldUseNativeLoader()).toEqual(false);
82+
});
7783
});
7884
}
7985

spec/modules/custom_spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('modules.Custom', function () {
2424

2525
var defaultModule = new Custom(fakeDomHelper, {
2626
families: ['Font1', 'Font2', 'Font3'],
27-
urls: ['http://moo', 'http://meuh'],
27+
urls: ['https://moo', 'https://meuh'],
2828
testStrings: {
2929
Font3: 'hello world'
3030
}
@@ -35,8 +35,8 @@ describe('modules.Custom', function () {
3535

3636
it('should have inserted the links correctly', function () {
3737
expect(fakeDomHelper.loadStylesheet.callCount).toEqual(2);
38-
expect(fakeDomHelper.loadStylesheet).toHaveBeenCalledWith('http://moo', new Any(Function));
39-
expect(fakeDomHelper.loadStylesheet).toHaveBeenCalledWith('http://meuh', new Any(Function));
38+
expect(fakeDomHelper.loadStylesheet).toHaveBeenCalledWith('https://moo', new Any(Function));
39+
expect(fakeDomHelper.loadStylesheet).toHaveBeenCalledWith('https://meuh', new Any(Function));
4040
});
4141

4242
if (webfont.DomHelper.CAN_WAIT_STYLESHEET) {

spec/modules/fontdeck_spec.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ describe('modules.Fontdeck', function () {
88

99
var apiResponse = {
1010
"domain" : "localhost",
11-
"cssurl" : "http://f.fontdeck.com/s/css/03BmCXiV2AHwX/Rp+OBFTfD2oFs/localhost/2282.css",
11+
"cssurl" : "https://f.fontdeck.com/s/css/03BmCXiV2AHwX/Rp+OBFTfD2oFs/localhost/2282.css",
1212
"project" : 2282,
13-
"cssbase" : "http://f.fontdeck.com/s/css/03BmCXiV2AHwX/Rp+OBFTfD2oFs",
13+
"cssbase" : "https://f.fontdeck.com/s/css/03BmCXiV2AHwX/Rp+OBFTfD2oFs",
1414
"fonts" : [
1515
{
1616
"font_family" : "'Fertigo Pro Regular', Fertigo, Constantia, Palatino, serif",
@@ -19,10 +19,10 @@ describe('modules.Fontdeck', function () {
1919
"style" : "normal",
2020
"weight" : "normal",
2121
"font_urls" : {
22-
"eot" : "http://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.eot",
23-
"ttf" : "http://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.ttf",
24-
"woff" : "http://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.woff",
25-
"svg" : "http://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.svg#104"
22+
"eot" : "https://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.eot",
23+
"ttf" : "https://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.ttf",
24+
"woff" : "https://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.woff",
25+
"svg" : "https://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.svg#104"
2626
},
2727
"id" : 104
2828
},
@@ -33,10 +33,10 @@ describe('modules.Fontdeck', function () {
3333
"style" : "italic",
3434
"weight" : "bold",
3535
"font_urls" : {
36-
"eot" : "http://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.eot",
37-
"ttf" : "http://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.ttf",
38-
"woff" : "http://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.woff",
39-
"svg" : "http://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.svg#2256"
36+
"eot" : "https://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.eot",
37+
"ttf" : "https://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.ttf",
38+
"woff" : "https://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.woff",
39+
"svg" : "https://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.svg#2256"
4040
},
4141
"id" : 2256
4242
}
@@ -54,7 +54,6 @@ describe('modules.Fontdeck', function () {
5454
fakeDomHelper = {
5555
loadScript: jasmine.createSpy('loadScript'),
5656
getLoadWindow: jasmine.createSpy('getLoadWindow').andReturn(global),
57-
getProtocol: jasmine.createSpy('getProtocol').andReturn('https:'),
5857
getHostName: function () { return 'test-host-name'; }
5958
};
6059
});

spec/modules/google/fontapiurlbuilder_spec.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,37 @@ describe('modules.google.FontApiUrlBuilder', function () {
22
var FontApiUrlBuilder = webfont.modules.google.FontApiUrlBuilder;
33

44
it('should throw an exception if there are no font families', function () {
5-
var builder = new FontApiUrlBuilder('http://moo', 'http:');
5+
var builder = new FontApiUrlBuilder('https://moo');
66
expect(builder.build).toThrow();
77
});
88

99
it('should build a proper url', function () {
10-
var builder = new FontApiUrlBuilder('http://moo', 'http:');
10+
var builder = new FontApiUrlBuilder('https://moo');
1111
builder.setFontFamilies(['Font1', 'Font2']);
12-
expect(builder.build()).toEqual('http://moo?family=Font1%7CFont2');
12+
expect(builder.build()).toEqual('https://moo?family=Font1%7CFont2');
1313
});
1414

1515
it('should build a proper url', function () {
16-
var builder = new FontApiUrlBuilder(undefined, 'http:');
16+
var builder = new FontApiUrlBuilder(undefined);
1717
builder.setFontFamilies(['Font1', 'Font2']);
18-
expect(builder.build()).toEqual('http:' +
18+
expect(builder.build()).toEqual(
1919
FontApiUrlBuilder.DEFAULT_API_URL +
2020
'?family=Font1%7CFont2');
2121
});
2222

2323
it('should build a proper url', function () {
24-
var builder = new FontApiUrlBuilder(undefined, 'http:');
24+
var builder = new FontApiUrlBuilder(undefined);
2525
builder.setFontFamilies(['Font1:bold:greek,cyrillic', 'Font2:italic', 'Font3']);
26-
expect(builder.build()).toEqual('http:' +
26+
expect(builder.build()).toEqual(
2727
FontApiUrlBuilder.DEFAULT_API_URL +
2828
'?family=Font1:bold%7CFont2:italic%7CFont3' +
2929
'&subset=greek,cyrillic');
3030
});
3131

3232
it('should build a proper url', function () {
33-
var builder = new FontApiUrlBuilder(undefined, 'http:');
33+
var builder = new FontApiUrlBuilder(undefined);
3434
builder.setFontFamilies(['Font1:bold,italic:greek,cyrillic', 'Font2:italic', 'Font3::latin']);
35-
expect(builder.build()).toEqual('http:' +
35+
expect(builder.build()).toEqual(
3636
FontApiUrlBuilder.DEFAULT_API_URL +
3737
'?family=Font1:bold,italic%7CFont2:italic%7CFont3' +
3838
'&subset=greek,cyrillic,latin');

spec/modules/google/googlefontapi_spec.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ describe('modules.google.GoogleFontApi', function () {
1212
loadStylesheet: function (cssLink, cb) {
1313
link = cssLink;
1414
onload = cb;
15-
},
16-
getProtocol: function () {
17-
return 'http:';
1815
}
1916
};
2017

@@ -42,7 +39,7 @@ describe('modules.google.GoogleFontApi', function () {
4239
});
4340

4441
it('has inserted the link element correctly', function () {
45-
expect(link).toEqual('http://fonts.googleapis.com/css?family=Font1%7CFont2');
42+
expect(link).toEqual('https://fonts.googleapis.com/css?family=Font1%7CFont2');
4643
});
4744

4845
it('has the correct families', function () {
@@ -61,14 +58,14 @@ describe('modules.google.GoogleFontApi', function () {
6158
beforeEach(function () {
6259
loaded = false;
6360
googleFontApi = new GoogleFontApi(fakeDomHelper, {
64-
api: 'http://moo',
61+
api: 'https://moo',
6562
families: ['Font1', 'Font2']
6663
});
6764
googleFontApi.load(function () { loaded = true; });
6865
});
6966

7067
it('has inserted the link element correctly', function () {
71-
expect(link).toEqual('http://moo?family=Font1%7CFont2');
68+
expect(link).toEqual('https://moo?family=Font1%7CFont2');
7269
});
7370

7471
if (webfont.DomHelper.CAN_WAIT_STYLESHEET) {
@@ -91,7 +88,7 @@ describe('modules.google.GoogleFontApi', function () {
9188
});
9289

9390
it('has inserted the link element correctly', function () {
94-
expect(link).toEqual('http://fonts.googleapis.com/css?family=Font1+WithSpace%7CFont2+WithSpaceToo');
91+
expect(link).toEqual('https://fonts.googleapis.com/css?family=Font1+WithSpace%7CFont2+WithSpaceToo');
9592
});
9693
});
9794

@@ -104,7 +101,7 @@ describe('modules.google.GoogleFontApi', function () {
104101
});
105102

106103
it('has inserted the link element correctly', function () {
107-
expect(link).toEqual('http://fonts.googleapis.com/css?family=Font1+WithSpace:bi%7CFont2+WithSpaceToo:b,r');
104+
expect(link).toEqual('https://fonts.googleapis.com/css?family=Font1+WithSpace:bi%7CFont2+WithSpaceToo:b,r');
108105
});
109106
});
110107
});

spec/modules/monotype_spec.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe('modules.Monotype', function () {
77

88
var configuration = {
99
projectId: '01e2ff27-25bf-4801-a23e-73d328e6c7cc',
10-
api: 'http://fast.fonts.net/jsapidev'
10+
api: 'https://fast.fonts.net/jsapidev'
1111
};
1212

1313
var fakeDomHelper = null,
@@ -25,8 +25,7 @@ describe('modules.Monotype', function () {
2525
script.onload = callback;
2626
return script;
2727
}),
28-
getLoadWindow: jasmine.createSpy('getLoadWindow').andReturn(global),
29-
getProtocol: jasmine.createSpy('getProtocol').andReturn('http:')
28+
getLoadWindow: jasmine.createSpy('getLoadWindow').andReturn(global)
3029
};
3130
support = jasmine.createSpy('support');
3231
load = jasmine.createSpy('load');
@@ -44,7 +43,7 @@ describe('modules.Monotype', function () {
4443

4544
it('should create a script element', function () {
4645
expect(fakeDomHelper.loadScript).toHaveBeenCalled();
47-
expect(fakeDomHelper.loadScript.calls[0].args[0]).toEqual('http://fast.fonts.net/jsapidev/01e2ff27-25bf-4801-a23e-73d328e6c7cc.js');
46+
expect(fakeDomHelper.loadScript.calls[0].args[0]).toEqual('https://fast.fonts.net/jsapidev/01e2ff27-25bf-4801-a23e-73d328e6c7cc.js');
4847
expect(load).toHaveBeenCalledWith([new Font('aachen bold'), new Font('kid print regular')]);
4948
});
5049
});

0 commit comments

Comments
 (0)