webfontloader 1.5.21 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,6 @@ projectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'//this is your Fonts.com Web fo
17
17
  webfont.modules.Monotype = function (domHelper, configuration) {
18
18
  this.domHelper_ = domHelper;
19
19
  this.configuration_ = configuration;
20
- this.fonts_ = [];
21
20
  };
22
21
 
23
22
  /**
@@ -45,46 +44,42 @@ goog.scope(function () {
45
44
  var Monotype = webfont.modules.Monotype,
46
45
  Font = webfont.Font;
47
46
 
48
- Monotype.prototype.supportUserAgent = function (userAgent, support) {
47
+ Monotype.prototype.getScriptSrc = function (projectId, version) {
48
+ var p = this.domHelper_.getProtocol();
49
+ var api = (this.configuration_['api'] || 'fast.fonts.net/jsapi').replace(/^.*http(s?):(\/\/)?/, "");
50
+ return p + "//" + api + '/' + projectId + '.js' + ( version ? '?v='+ version : '' );
51
+ };
52
+
53
+ Monotype.prototype.load = function (onReady) {
49
54
  var self = this;
50
55
  var projectId = self.configuration_['projectId'];
51
56
  var version = self.configuration_['version'];
57
+
52
58
  if (projectId) {
53
59
  var loadWindow = self.domHelper_.getLoadWindow();
54
60
 
55
- function onload() {
56
- if (loadWindow[Monotype.HOOK + projectId]) {
57
- var mti_fnts = loadWindow[Monotype.HOOK + projectId]();
58
- if (mti_fnts) {
59
- for (var i = 0; i < mti_fnts.length; i++) {
60
- self.fonts_.push(new Font(mti_fnts[i]["fontfamily"]));
61
- }
62
- }
63
- }
64
- support(userAgent.getBrowserInfo().hasWebFontSupport());
65
- }
66
-
67
61
  var script = this.domHelper_.loadScript(self.getScriptSrc(projectId, version), function (err) {
68
62
  if (err) {
69
- support(false);
63
+ onReady([]);
70
64
  } else {
71
- onload();
65
+ if (loadWindow[Monotype.HOOK + projectId]) {
66
+ var mti_fnts = loadWindow[Monotype.HOOK + projectId](),
67
+ fonts = [];
68
+
69
+ if (mti_fnts) {
70
+ for (var i = 0; i < mti_fnts.length; i++) {
71
+ fonts.push(new Font(mti_fnts[i]["fontfamily"]));
72
+ }
73
+ }
74
+ onReady(fonts);
75
+ } else {
76
+ onReady([]);
77
+ }
72
78
  }
73
79
  });
74
80
  script["id"] = Monotype.SCRIPTID + projectId;
81
+ } else {
82
+ onReady([]);
75
83
  }
76
- else {
77
- support(false);
78
- }
79
- };
80
-
81
- Monotype.prototype.getScriptSrc = function (projectId, version) {
82
- var p = this.domHelper_.getProtocol();
83
- var api = (this.configuration_['api'] || 'fast.fonts.net/jsapi').replace(/^.*http(s?):(\/\/)?/, "");
84
- return p + "//" + api + '/' + projectId + '.js' + ( version ? '?v='+ version : '' );
85
- };
86
-
87
- Monotype.prototype.load = function (onReady) {
88
- onReady(this.fonts_);
89
84
  };
90
85
  });
@@ -9,7 +9,6 @@ goog.require('webfont.Font');
9
9
  webfont.modules.Typekit = function(domHelper, configuration) {
10
10
  this.domHelper_ = domHelper;
11
11
  this.configuration_ = configuration;
12
- this.fonts_ = [];
13
12
  };
14
13
 
15
14
  /**
@@ -23,12 +22,11 @@ goog.scope(function () {
23
22
  Font = webfont.Font;
24
23
 
25
24
  Typekit.prototype.getScriptSrc = function(kitId) {
26
- var protocol = this.domHelper_.getProtocol();
27
- var api = this.configuration_['api'] || protocol + '//use.typekit.net';
25
+ var api = this.configuration_['api'] || 'https://use.typekit.net';
28
26
  return api + '/' + kitId + '.js';
29
27
  };
30
28
 
31
- Typekit.prototype.supportUserAgent = function(userAgent, support) {
29
+ Typekit.prototype.load = function(onReady) {
32
30
  var kitId = this.configuration_['id'];
33
31
  var configuration = this.configuration_;
34
32
  var loadWindow = this.domHelper_.getLoadWindow();
@@ -39,17 +37,18 @@ goog.scope(function () {
39
37
  // and use that to populate the fonts we should watch.
40
38
  this.domHelper_.loadScript(this.getScriptSrc(kitId), function (err) {
41
39
  if (err) {
42
- support(false);
40
+ onReady([]);
43
41
  } else {
44
42
  if (loadWindow['Typekit'] && loadWindow['Typekit']['config'] && loadWindow['Typekit']['config']['fn']) {
45
- var fn = loadWindow['Typekit']['config']['fn'];
43
+ var fn = loadWindow['Typekit']['config']['fn'],
44
+ fonts = [];
46
45
 
47
46
  for (var i = 0; i < fn.length; i += 2) {
48
47
  var font = fn[i],
49
48
  variations = fn[i + 1];
50
49
 
51
50
  for (var j = 0; j < variations.length; j++) {
52
- that.fonts_.push(new Font(font, variations[j]));
51
+ fonts.push(new Font(font, variations[j]));
53
52
  }
54
53
  }
55
54
 
@@ -61,16 +60,13 @@ goog.scope(function () {
61
60
  'classes': false
62
61
  });
63
62
  } catch (e) {}
63
+
64
+ onReady(fonts);
64
65
  }
65
- support(true);
66
66
  }
67
67
  }, 2000);
68
68
  } else {
69
- support(false);
69
+ onReady([]);
70
70
  }
71
71
  };
72
-
73
- Typekit.prototype.load = function(onReady) {
74
- onReady(this.fonts_);
75
- };
76
72
  });
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'webfontloader'
16
- s.version = '1.5.21'
17
- s.date = '2015-05-26'
16
+ s.version = '1.6.0'
17
+ s.date = '2015-05-28'
18
18
 
19
19
  ## Make sure your summary is short. The description may be as long
20
20
  ## as you like.
@@ -120,8 +120,6 @@ DESC
120
120
  spec/core/fontwatchrunner_spec.js
121
121
  spec/core/nativefontwatchrunner_spec.js
122
122
  spec/core/size_spec.js
123
- spec/core/useragentparser_spec.js
124
- spec/core/version_spec.js
125
123
  spec/core/webfont_spec.js
126
124
  spec/deps.js
127
125
  spec/fixtures/external_script.js
@@ -149,7 +147,6 @@ DESC
149
147
  spec/modules/monotype_spec.js
150
148
  spec/modules/typekit_spec.js
151
149
  src/closure.js
152
- src/core/browserinfo.js
153
150
  src/core/cssclassname.js
154
151
  src/core/domhelper.js
155
152
  src/core/eventdispatcher.js
@@ -161,9 +158,6 @@ DESC
161
158
  src/core/fontwatchrunner.js
162
159
  src/core/initialize.js
163
160
  src/core/nativefontwatchrunner.js
164
- src/core/useragent.js
165
- src/core/useragentparser.js
166
- src/core/version.js
167
161
  src/core/webfont.js
168
162
  src/modules.yml
169
163
  src/modules/custom.js
data/webfontloader.js CHANGED
@@ -1,30 +1,18 @@
1
- /* Web Font Loader v1.5.21 - (c) Adobe Systems, Google. License: Apache 2.0 */
2
- ;(function(window,document,undefined){function aa(a,b,c){return a.call.apply(a.bind,arguments)}function ba(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function k(a,b,c){k=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?aa:ba;return k.apply(null,arguments)}var n=Date.now||function(){return+new Date};function q(a,b){this.K=a;this.w=b||a;this.G=this.w.document}q.prototype.createElement=function(a,b,c){a=this.G.createElement(a);if(b)for(var d in b)b.hasOwnProperty(d)&&("style"==d?a.style.cssText=b[d]:a.setAttribute(d,b[d]));c&&a.appendChild(this.G.createTextNode(c));return a};function r(a,b,c){a=a.G.getElementsByTagName(b)[0];a||(a=document.documentElement);a&&a.lastChild&&a.insertBefore(c,a.lastChild)}function ca(a,b){function c(){a.G.body?b():setTimeout(c,0)}c()}
3
- function s(a,b,c){b=b||[];c=c||[];for(var d=a.className.split(/\s+/),e=0;e<b.length;e+=1){for(var f=!1,g=0;g<d.length;g+=1)if(b[e]===d[g]){f=!0;break}f||d.push(b[e])}b=[];for(e=0;e<d.length;e+=1){f=!1;for(g=0;g<c.length;g+=1)if(d[e]===c[g]){f=!0;break}f||b.push(d[e])}a.className=b.join(" ").replace(/\s+/g," ").replace(/^\s+|\s+$/,"")}function t(a,b){for(var c=a.className.split(/\s+/),d=0,e=c.length;d<e;d++)if(c[d]==b)return!0;return!1}
4
- function u(a){if("string"===typeof a.na)return a.na;var b=a.w.location.protocol;"about:"==b&&(b=a.K.location.protocol);return"https:"==b?"https:":"http:"}function v(a,b){var c=a.createElement("link",{rel:"stylesheet",href:b,media:"all"}),d=!1;c.onload=function(){d||(d=!0)};c.onerror=function(){d||(d=!0)};r(a,"head",c)}
5
- function w(a,b,c,d){var e=a.G.getElementsByTagName("head")[0];if(e){var f=a.createElement("script",{src:b}),g=!1;f.onload=f.onreadystatechange=function(){g||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(g=!0,c&&c(null),f.onload=f.onreadystatechange=null,"HEAD"==f.parentNode.tagName&&e.removeChild(f))};e.appendChild(f);setTimeout(function(){g||(g=!0,c&&c(Error("Script load timeout")))},d||5E3);return f}return null};function x(a,b){this.Y=a;this.ga=b};function y(a,b,c,d){this.c=null!=a?a:null;this.g=null!=b?b:null;this.D=null!=c?c:null;this.e=null!=d?d:null}var da=/^([0-9]+)(?:[\._-]([0-9]+))?(?:[\._-]([0-9]+))?(?:[\._+-]?(.*))?$/;y.prototype.compare=function(a){return this.c>a.c||this.c===a.c&&this.g>a.g||this.c===a.c&&this.g===a.g&&this.D>a.D?1:this.c<a.c||this.c===a.c&&this.g<a.g||this.c===a.c&&this.g===a.g&&this.D<a.D?-1:0};y.prototype.toString=function(){return[this.c,this.g||"",this.D||"",this.e||""].join("")};
6
- function z(a){a=da.exec(a);var b=null,c=null,d=null,e=null;a&&(null!==a[1]&&a[1]&&(b=parseInt(a[1],10)),null!==a[2]&&a[2]&&(c=parseInt(a[2],10)),null!==a[3]&&a[3]&&(d=parseInt(a[3],10)),null!==a[4]&&a[4]&&(e=/^[0-9]+$/.test(a[4])?parseInt(a[4],10):a[4]));return new y(b,c,d,e)};function A(a,b,c,d,e,f,g,h){this.N=a;this.m=h}A.prototype.getName=function(){return this.N};function B(a){this.a=a}var ea=new A("Unknown",0,0,0,0,0,0,new x(!1,!1));
7
- B.prototype.parse=function(){var a;if(-1!=this.a.indexOf("MSIE")||-1!=this.a.indexOf("Trident/")){a=C(this);var b=z(D(this)),c=null,d=E(this.a,/Trident\/([\d\w\.]+)/,1),c=-1!=this.a.indexOf("MSIE")?z(E(this.a,/MSIE ([\d\w\.]+)/,1)):z(E(this.a,/rv:([\d\w\.]+)/,1));""!=d&&z(d);a=new A("MSIE",0,0,0,0,0,0,new x("Windows"==a&&6<=c.c||"Windows Phone"==a&&8<=b.c,!1))}else if(-1!=this.a.indexOf("Opera"))a:if(a=z(E(this.a,/Presto\/([\d\w\.]+)/,1)),z(D(this)),null!==a.c||z(E(this.a,/rv:([^\)]+)/,1)),-1!=this.a.indexOf("Opera Mini/"))a=
8
- z(E(this.a,/Opera Mini\/([\d\.]+)/,1)),a=new A("OperaMini",0,0,0,C(this),0,0,new x(!1,!1));else{if(-1!=this.a.indexOf("Version/")&&(a=z(E(this.a,/Version\/([\d\.]+)/,1)),null!==a.c)){a=new A("Opera",0,0,0,C(this),0,0,new x(10<=a.c,!1));break a}a=z(E(this.a,/Opera[\/ ]([\d\.]+)/,1));a=null!==a.c?new A("Opera",0,0,0,C(this),0,0,new x(10<=a.c,!1)):new A("Opera",0,0,0,C(this),0,0,new x(!1,!1))}else/OPR\/[\d.]+/.test(this.a)?a=F(this):/AppleWeb(K|k)it/.test(this.a)?a=F(this):-1!=this.a.indexOf("Gecko")?
9
- (a="Unknown",b=new y,z(D(this)),b=!1,-1!=this.a.indexOf("Firefox")?(a="Firefox",b=z(E(this.a,/Firefox\/([\d\w\.]+)/,1)),b=3<=b.c&&5<=b.g):-1!=this.a.indexOf("Mozilla")&&(a="Mozilla"),c=z(E(this.a,/rv:([^\)]+)/,1)),b||(b=1<c.c||1==c.c&&9<c.g||1==c.c&&9==c.g&&2<=c.D),a=new A(a,0,0,0,C(this),0,0,new x(b,!1))):a=ea;return a};
10
- function C(a){var b=E(a.a,/(iPod|iPad|iPhone|Android|Windows Phone|BB\d{2}|BlackBerry)/,1);if(""!=b)return/BB\d{2}/.test(b)&&(b="BlackBerry"),b;a=E(a.a,/(Linux|Mac_PowerPC|Macintosh|Windows|CrOS|PlayStation|CrKey)/,1);return""!=a?("Mac_PowerPC"==a?a="Macintosh":"PlayStation"==a&&(a="Linux"),a):"Unknown"}
11
- function D(a){var b=E(a.a,/(OS X|Windows NT|Android) ([^;)]+)/,2);if(b||(b=E(a.a,/Windows Phone( OS)? ([^;)]+)/,2))||(b=E(a.a,/(iPhone )?OS ([\d_]+)/,2)))return b;if(b=E(a.a,/(?:Linux|CrOS|CrKey) ([^;)]+)/,1))for(var b=b.split(/\s/),c=0;c<b.length;c+=1)if(/^[\d\._]+$/.test(b[c]))return b[c];return(a=E(a.a,/(BB\d{2}|BlackBerry).*?Version\/([^\s]*)/,2))?a:"Unknown"}
12
- function F(a){var b=C(a),c=z(D(a)),d=z(E(a.a,/AppleWeb(?:K|k)it\/([\d\.\+]+)/,1)),e="Unknown",f=new y,f="Unknown",g=!1;/OPR\/[\d.]+/.test(a.a)?e="Opera":-1!=a.a.indexOf("Chrome")||-1!=a.a.indexOf("CrMo")||-1!=a.a.indexOf("CriOS")?e="Chrome":/Silk\/\d/.test(a.a)?e="Silk":"BlackBerry"==b||"Android"==b?e="BuiltinBrowser":-1!=a.a.indexOf("PhantomJS")?e="PhantomJS":-1!=a.a.indexOf("Safari")?e="Safari":-1!=a.a.indexOf("AdobeAIR")?e="AdobeAIR":-1!=a.a.indexOf("PlayStation")&&(e="BuiltinBrowser");"BuiltinBrowser"==
13
- e?f="Unknown":"Silk"==e?f=E(a.a,/Silk\/([\d\._]+)/,1):"Chrome"==e?f=E(a.a,/(Chrome|CrMo|CriOS)\/([\d\.]+)/,2):-1!=a.a.indexOf("Version/")?f=E(a.a,/Version\/([\d\.\w]+)/,1):"AdobeAIR"==e?f=E(a.a,/AdobeAIR\/([\d\.]+)/,1):"Opera"==e?f=E(a.a,/OPR\/([\d.]+)/,1):"PhantomJS"==e&&(f=E(a.a,/PhantomJS\/([\d.]+)/,1));f=z(f);g="AdobeAIR"==e?2<f.c||2==f.c&&5<=f.g:"BlackBerry"==b?10<=c.c:"Android"==b?2<c.c||2==c.c&&1<c.g:526<=d.c||525<=d.c&&13<=d.g;return new A(e,0,0,0,0,0,0,new x(g,536>d.c||536==d.c&&11>d.g))}
14
- function E(a,b,c){return(a=a.match(b))&&a[c]?a[c]:""};function G(a){this.ma=a||"-"}G.prototype.e=function(a){for(var b=[],c=0;c<arguments.length;c++)b.push(arguments[c].replace(/[\W_]+/g,"").toLowerCase());return b.join(this.ma)};function H(a,b){this.N=a;this.Z=4;this.O="n";var c=(b||"n4").match(/^([nio])([1-9])$/i);c&&(this.O=c[1],this.Z=parseInt(c[2],10))}H.prototype.getName=function(){return this.N};function I(a){return a.O+a.Z}function fa(a){var b=4,c="n",d=null;a&&((d=a.match(/(normal|oblique|italic)/i))&&d[1]&&(c=d[1].substr(0,1).toLowerCase()),(d=a.match(/([1-9]00|normal|bold)/i))&&d[1]&&(/bold/i.test(d[1])?b=7:/[1-9]00/.test(d[1])&&(b=parseInt(d[1].substr(0,1),10))));return c+b};function ha(a,b){this.d=a;this.q=a.w.document.documentElement;this.Q=b;this.j="wf";this.h=new G("-");this.ha=!1!==b.events;this.F=!1!==b.classes}function J(a){if(a.F){var b=t(a.q,a.h.e(a.j,"active")),c=[],d=[a.h.e(a.j,"loading")];b||c.push(a.h.e(a.j,"inactive"));s(a.q,c,d)}K(a,"inactive")}function K(a,b,c){if(a.ha&&a.Q[b])if(c)a.Q[b](c.getName(),I(c));else a.Q[b]()};function ia(){this.C={}};function L(a,b){this.d=a;this.I=b;this.k=this.d.createElement("span",{"aria-hidden":"true"},this.I)}function M(a){r(a.d,"body",a.k)}
15
- function N(a){var b;b=[];for(var c=a.N.split(/,\s*/),d=0;d<c.length;d++){var e=c[d].replace(/['"]/g,"");-1==e.indexOf(" ")?b.push(e):b.push("'"+e+"'")}b=b.join(",");c="normal";"o"===a.O?c="oblique":"i"===a.O&&(c="italic");return"display:block;position:absolute;top:-9999px;left:-9999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:"+b+";"+("font-style:"+c+";font-weight:"+(a.Z+"00")+";")}
16
- L.prototype.remove=function(){var a=this.k;a.parentNode&&a.parentNode.removeChild(a)};function O(a,b,c,d,e,f,g,h){this.$=a;this.ka=b;this.d=c;this.o=d;this.m=e;this.I=h||"BESbswy";this.v={};this.X=f||3E3;this.ca=g||null;this.H=this.u=this.t=null;this.t=new L(this.d,this.I);this.u=new L(this.d,this.I);this.H=new L(this.d,this.I);a=new H("serif",I(this.o));a=N(a);this.t.k.style.cssText=a;a=new H("sans-serif",I(this.o));a=N(a);this.u.k.style.cssText=a;a=new H("monospace",I(this.o));a=N(a);this.H.k.style.cssText=a;M(this.t);M(this.u);M(this.H);this.v.serif=this.t.k.offsetWidth;this.v["sans-serif"]=
17
- this.u.k.offsetWidth;this.v.monospace=this.H.k.offsetWidth}var P={sa:"serif",ra:"sans-serif",qa:"monospace"};O.prototype.start=function(){this.oa=n();var a=new H(this.o.getName()+",serif",I(this.o)),a=N(a);this.t.k.style.cssText=a;a=new H(this.o.getName()+",sans-serif",I(this.o));a=N(a);this.u.k.style.cssText=a;Q(this)};function ja(a,b,c){for(var d in P)if(P.hasOwnProperty(d)&&b===a.v[P[d]]&&c===a.v[P[d]])return!0;return!1}
18
- function Q(a){var b=a.t.k.offsetWidth,c=a.u.k.offsetWidth;b===a.v.serif&&c===a.v["sans-serif"]||a.m.ga&&ja(a,b,c)?n()-a.oa>=a.X?a.m.ga&&ja(a,b,c)&&(null===a.ca||a.ca.hasOwnProperty(a.o.getName()))?R(a,a.$):R(a,a.ka):ka(a):R(a,a.$)}function ka(a){setTimeout(k(function(){Q(this)},a),50)}function R(a,b){a.t.remove();a.u.remove();a.H.remove();b(a.o)};function S(a,b,c,d){this.d=b;this.A=c;this.S=0;this.ea=this.ba=!1;this.X=d;this.m=a.m}function la(a,b,c,d,e){c=c||{};if(0===b.length&&e)J(a.A);else for(a.S+=b.length,e&&(a.ba=e),e=0;e<b.length;e++){var f=b[e],g=c[f.getName()],h=a.A,m=f;h.F&&s(h.q,[h.h.e(h.j,m.getName(),I(m).toString(),"loading")]);K(h,"fontloading",m);h=null;h=new O(k(a.ia,a),k(a.ja,a),a.d,f,a.m,a.X,d,g);h.start()}}
19
- S.prototype.ia=function(a){var b=this.A;b.F&&s(b.q,[b.h.e(b.j,a.getName(),I(a).toString(),"active")],[b.h.e(b.j,a.getName(),I(a).toString(),"loading"),b.h.e(b.j,a.getName(),I(a).toString(),"inactive")]);K(b,"fontactive",a);this.ea=!0;ma(this)};
20
- S.prototype.ja=function(a){var b=this.A;if(b.F){var c=t(b.q,b.h.e(b.j,a.getName(),I(a).toString(),"active")),d=[],e=[b.h.e(b.j,a.getName(),I(a).toString(),"loading")];c||d.push(b.h.e(b.j,a.getName(),I(a).toString(),"inactive"));s(b.q,d,e)}K(b,"fontinactive",a);ma(this)};function ma(a){0==--a.S&&a.ba&&(a.ea?(a=a.A,a.F&&s(a.q,[a.h.e(a.j,"active")],[a.h.e(a.j,"loading"),a.h.e(a.j,"inactive")]),K(a,"active")):J(a.A))};function T(a){this.K=a;this.B=new ia;this.pa=new B(a.navigator.userAgent);this.a=this.pa.parse();this.U=this.V=0;this.R=this.T=!0}
21
- T.prototype.load=function(a){this.d=new q(this.K,a.context||this.K);this.T=!1!==a.events;this.R=!1!==a.classes;var b=new ha(this.d,a),c=[],d=a.timeout;b.F&&s(b.q,[b.h.e(b.j,"loading")]);K(b,"loading");var c=this.B,e=this.d,f=[],g;for(g in a)if(a.hasOwnProperty(g)){var h=c.C[g];h&&f.push(h(a[g],e))}c=f;this.U=this.V=c.length;a=new S(this.a,this.d,b,d);d=0;for(g=c.length;d<g;d++)e=c[d],e.L(this.a,k(this.la,this,e,b,a))};
22
- T.prototype.la=function(a,b,c,d){var e=this;d?a.load(function(a,b,d){na(e,c,a,b,d)}):(a=0==--this.V,this.U--,a&&0==this.U?J(b):(this.R||this.T)&&la(c,[],{},null,a))};function na(a,b,c,d,e){var f=0==--a.V;(a.R||a.T)&&setTimeout(function(){la(b,c,d||null,e||null,f)},0)};function oa(a,b,c){this.P=a?a:b+pa;this.s=[];this.W=[];this.fa=c||""}var pa="//fonts.googleapis.com/css";oa.prototype.e=function(){if(0==this.s.length)throw Error("No fonts to load!");if(-1!=this.P.indexOf("kit="))return this.P;for(var a=this.s.length,b=[],c=0;c<a;c++)b.push(this.s[c].replace(/ /g,"+"));a=this.P+"?family="+b.join("%7C");0<this.W.length&&(a+="&subset="+this.W.join(","));0<this.fa.length&&(a+="&text="+encodeURIComponent(this.fa));return a};function qa(a){this.s=a;this.da=[];this.M={}}
23
- var ra={latin:"BESbswy",cyrillic:"&#1081;&#1103;&#1046;",greek:"&#945;&#946;&#931;",khmer:"&#x1780;&#x1781;&#x1782;",Hanuman:"&#x1780;&#x1781;&#x1782;"},sa={thin:"1",extralight:"2","extra-light":"2",ultralight:"2","ultra-light":"2",light:"3",regular:"4",book:"4",medium:"5","semi-bold":"6",semibold:"6","demi-bold":"6",demibold:"6",bold:"7","extra-bold":"8",extrabold:"8","ultra-bold":"8",ultrabold:"8",black:"9",heavy:"9",l:"3",r:"4",b:"7"},ta={i:"i",italic:"i",n:"n",normal:"n"},ua=/^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$/;
24
- qa.prototype.parse=function(){for(var a=this.s.length,b=0;b<a;b++){var c=this.s[b].split(":"),d=c[0].replace(/\+/g," "),e=["n4"];if(2<=c.length){var f;var g=c[1];f=[];if(g)for(var g=g.split(","),h=g.length,m=0;m<h;m++){var l;l=g[m];if(l.match(/^[\w-]+$/)){l=ua.exec(l.toLowerCase());var p=void 0;if(null==l)p="";else{p=void 0;p=l[1];if(null==p||""==p)p="4";else var ga=sa[p],p=ga?ga:isNaN(p)?"4":p.substr(0,1);l=l[2];p=[null==l||""==l?"n":ta[l],p].join("")}l=p}else l="";l&&f.push(l)}0<f.length&&(e=f);
25
- 3==c.length&&(c=c[2],f=[],c=c?c.split(","):f,0<c.length&&(c=ra[c[0]])&&(this.M[d]=c))}this.M[d]||(c=ra[d])&&(this.M[d]=c);for(c=0;c<e.length;c+=1)this.da.push(new H(d,e[c]))}};function U(a,b){this.a=(new B(navigator.userAgent)).parse();this.d=a;this.f=b}var va={Arimo:!0,Cousine:!0,Tinos:!0};U.prototype.L=function(a,b){b(a.m.Y)};U.prototype.load=function(a){var b=this.d;"MSIE"==this.a.getName()&&1!=this.f.blocking?ca(b,k(this.aa,this,a)):this.aa(a)};
26
- U.prototype.aa=function(a){for(var b=this.d,c=new oa(this.f.api,u(b),this.f.text),d=this.f.families,e=d.length,f=0;f<e;f++){var g=d[f].split(":");3==g.length&&c.W.push(g.pop());var h="";2==g.length&&""!=g[1]&&(h=":");c.s.push(g.join(h))}d=new qa(d);d.parse();v(b,c.e());a(d.da,d.M,va)};function V(a,b){this.d=a;this.f=b;this.p=[]}V.prototype.J=function(a){var b=this.d;return u(this.d)+(this.f.api||"//f.fontdeck.com/s/css/js/")+(b.w.location.hostname||b.K.location.hostname)+"/"+a+".js"};
27
- V.prototype.L=function(a,b){var c=this.f.id,d=this.d.w,e=this;c?(d.__webfontfontdeckmodule__||(d.__webfontfontdeckmodule__={}),d.__webfontfontdeckmodule__[c]=function(a,c){for(var d=0,m=c.fonts.length;d<m;++d){var l=c.fonts[d];e.p.push(new H(l.name,fa("font-weight:"+l.weight+";font-style:"+l.style)))}b(a)},w(this.d,this.J(c),function(a){a&&b(!1)})):b(!1)};V.prototype.load=function(a){a(this.p)};function W(a,b){this.d=a;this.f=b;this.p=[]}W.prototype.J=function(a){var b=u(this.d);return(this.f.api||b+"//use.typekit.net")+"/"+a+".js"};W.prototype.L=function(a,b){var c=this.f.id,d=this.d.w,e=this;c?w(this.d,this.J(c),function(a){if(a)b(!1);else{if(d.Typekit&&d.Typekit.config&&d.Typekit.config.fn){a=d.Typekit.config.fn;for(var c=0;c<a.length;c+=2)for(var h=a[c],m=a[c+1],l=0;l<m.length;l++)e.p.push(new H(h,m[l]));try{d.Typekit.load({events:!1,classes:!1})}catch(p){}}b(!0)}},2E3):b(!1)};
28
- W.prototype.load=function(a){a(this.p)};function X(a,b){this.d=a;this.f=b;this.p=[]}X.prototype.L=function(a,b){var c=this,d=c.f.projectId,e=c.f.version;if(d){var f=c.d.w;w(this.d,c.J(d,e),function(e){if(e)b(!1);else{if(f["__mti_fntLst"+d]&&(e=f["__mti_fntLst"+d]()))for(var h=0;h<e.length;h++)c.p.push(new H(e[h].fontfamily));b(a.m.Y)}}).id="__MonotypeAPIScript__"+d}else b(!1)};X.prototype.J=function(a,b){var c=u(this.d),d=(this.f.api||"fast.fonts.net/jsapi").replace(/^.*http(s?):(\/\/)?/,"");return c+"//"+d+"/"+a+".js"+(b?"?v="+b:"")};
29
- X.prototype.load=function(a){a(this.p)};function Y(a,b){this.d=a;this.f=b}Y.prototype.load=function(a){var b,c,d=this.f.urls||[],e=this.f.families||[],f=this.f.testStrings||{};b=0;for(c=d.length;b<c;b++)v(this.d,d[b]);d=[];b=0;for(c=e.length;b<c;b++){var g=e[b].split(":");if(g[1])for(var h=g[1].split(","),m=0;m<h.length;m+=1)d.push(new H(g[0],h[m]));else d.push(new H(g[0]))}a(d,f)};Y.prototype.L=function(a,b){return b(a.m.Y)};var Z=new T(this);Z.B.C.custom=function(a,b){return new Y(b,a)};Z.B.C.fontdeck=function(a,b){return new V(b,a)};Z.B.C.monotype=function(a,b){return new X(b,a)};Z.B.C.typekit=function(a,b){return new W(b,a)};Z.B.C.google=function(a,b){return new U(b,a)};var $={load:k(Z.load,Z)};"function"===typeof define&&define.amd?define(function(){return $}):"undefined"!==typeof module&&module.exports?module.exports=$:(window.WebFont=$,window.WebFontConfig&&Z.load(window.WebFontConfig));})(this,document);
1
+ /* Web Font Loader v1.6.0 - (c) Adobe Systems, Google. License: Apache 2.0 */
2
+ ;(function(window,document,undefined){function aa(a,b,c){return a.call.apply(a.bind,arguments)}function ba(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function m(a,b,c){m=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?aa:ba;return m.apply(null,arguments)}var n=Date.now||function(){return+new Date};function r(a,b){this.C=a;this.q=b||a;this.D=this.q.document}r.prototype.createElement=function(a,b,c){a=this.D.createElement(a);if(b)for(var d in b)b.hasOwnProperty(d)&&("style"==d?a.style.cssText=b[d]:a.setAttribute(d,b[d]));c&&a.appendChild(this.D.createTextNode(c));return a};function s(a,b,c){a=a.D.getElementsByTagName(b)[0];a||(a=document.documentElement);a&&a.lastChild&&a.insertBefore(c,a.lastChild)}
3
+ function t(a,b,c){b=b||[];c=c||[];for(var d=a.className.split(/\s+/),f=0;f<b.length;f+=1){for(var e=!1,g=0;g<d.length;g+=1)if(b[f]===d[g]){e=!0;break}e||d.push(b[f])}b=[];for(f=0;f<d.length;f+=1){e=!1;for(g=0;g<c.length;g+=1)if(d[f]===c[g]){e=!0;break}e||b.push(d[f])}a.className=b.join(" ").replace(/\s+/g," ").replace(/^\s+|\s+$/,"")}function u(a,b){for(var c=a.className.split(/\s+/),d=0,f=c.length;d<f;d++)if(c[d]==b)return!0;return!1}
4
+ function v(a){if("string"===typeof a.ca)return a.ca;var b=a.q.location.protocol;"about:"==b&&(b=a.C.location.protocol);return"https:"==b?"https:":"http:"}function w(a,b){var c=a.createElement("link",{rel:"stylesheet",href:b,media:"all"}),d=!1;c.onload=function(){d||(d=!0)};c.onerror=function(){d||(d=!0)};s(a,"head",c)}
5
+ function x(a,b,c,d){var f=a.D.getElementsByTagName("head")[0];if(f){var e=a.createElement("script",{src:b}),g=!1;e.onload=e.onreadystatechange=function(){g||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(g=!0,c&&c(null),e.onload=e.onreadystatechange=null,"HEAD"==e.parentNode.tagName&&f.removeChild(e))};f.appendChild(e);setTimeout(function(){g||(g=!0,c&&c(Error("Script load timeout")))},d||5E3);return e}return null};function y(a){this.ba=a||"-"}y.prototype.d=function(a){for(var b=[],c=0;c<arguments.length;c++)b.push(arguments[c].replace(/[\W_]+/g,"").toLowerCase());return b.join(this.ba)};function z(a,b){this.U=a;this.M=4;this.G="n";var c=(b||"n4").match(/^([nio])([1-9])$/i);c&&(this.G=c[1],this.M=parseInt(c[2],10))}z.prototype.getName=function(){return this.U};function A(a){return a.G+a.M}function ca(a){var b=4,c="n",d=null;a&&((d=a.match(/(normal|oblique|italic)/i))&&d[1]&&(c=d[1].substr(0,1).toLowerCase()),(d=a.match(/([1-9]00|normal|bold)/i))&&d[1]&&(/bold/i.test(d[1])?b=7:/[1-9]00/.test(d[1])&&(b=parseInt(d[1].substr(0,1),10))));return c+b};function da(a,b){this.a=a;this.j=a.q.document.documentElement;this.I=b;this.f="wf";this.e=new y("-");this.Y=!1!==b.events;this.v=!1!==b.classes}function ea(a){a.v&&t(a.j,[a.e.d(a.f,"loading")]);B(a,"loading")}function C(a){if(a.v){var b=u(a.j,a.e.d(a.f,"active")),c=[],d=[a.e.d(a.f,"loading")];b||c.push(a.e.d(a.f,"inactive"));t(a.j,c,d)}B(a,"inactive")}function B(a,b,c){if(a.Y&&a.I[b])if(c)a.I[b](c.getName(),A(c));else a.I[b]()};function fa(){this.u={}}function ga(a,b,c){var d=[],f;for(f in b)if(b.hasOwnProperty(f)){var e=a.u[f];e&&d.push(e(b[f],c))}return d};function D(a,b){this.a=a;this.A=b;this.g=this.a.createElement("span",{"aria-hidden":"true"},this.A)}function F(a){s(a.a,"body",a.g)}
6
+ function G(a){var b;b=[];for(var c=a.U.split(/,\s*/),d=0;d<c.length;d++){var f=c[d].replace(/['"]/g,"");-1==f.indexOf(" ")?b.push(f):b.push("'"+f+"'")}b=b.join(",");c="normal";"o"===a.G?c="oblique":"i"===a.G&&(c="italic");return"display:block;position:absolute;top:-9999px;left:-9999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:"+b+";"+("font-style:"+c+";font-weight:"+(a.M+"00")+";")}
7
+ D.prototype.remove=function(){var a=this.g;a.parentNode&&a.parentNode.removeChild(a)};function H(a,b,c,d,f,e,g){this.N=a;this.aa=b;this.a=c;this.h=d;this.A=g||"BESbswy";this.p={};this.L=f||3E3;this.S=e||null;this.w=this.o=this.m=null;this.m=new D(this.a,this.A);this.o=new D(this.a,this.A);this.w=new D(this.a,this.A);a=new z("serif",A(this.h));a=G(a);this.m.g.style.cssText=a;a=new z("sans-serif",A(this.h));a=G(a);this.o.g.style.cssText=a;a=new z("monospace",A(this.h));a=G(a);this.w.g.style.cssText=a;F(this.m);F(this.o);F(this.w);this.p.serif=this.m.g.offsetWidth;this.p["sans-serif"]=
8
+ this.o.g.offsetWidth;this.p.monospace=this.w.g.offsetWidth}var I={ga:"serif",fa:"sans-serif",ea:"monospace"},J=null;function K(){if(null===J){var a=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);J=!!a&&(536>parseInt(a[1],10)||536===parseInt(a[1],10)&&11>=parseInt(a[2],10))}return J}
9
+ H.prototype.start=function(){this.da=n();var a=new z(this.h.getName()+",serif",A(this.h)),a=G(a);this.m.g.style.cssText=a;a=new z(this.h.getName()+",sans-serif",A(this.h));a=G(a);this.o.g.style.cssText=a;L(this)};function M(a,b,c){for(var d in I)if(I.hasOwnProperty(d)&&b===a.p[I[d]]&&c===a.p[I[d]])return!0;return!1}
10
+ function L(a){var b=a.m.g.offsetWidth,c=a.o.g.offsetWidth,d;(d=b===a.p.serif&&c===a.p["sans-serif"])||(d=K()&&M(a,b,c));d?n()-a.da>=a.L?K()&&M(a,b,c)&&(null===a.S||a.S.hasOwnProperty(a.h.getName()))?N(a,a.N):N(a,a.aa):ha(a):N(a,a.N)}function ha(a){setTimeout(m(function(){L(this)},a),50)}function N(a,b){a.m.remove();a.o.remove();a.w.remove();b(a.h)};function O(a,b,c){this.a=a;this.s=b;this.J=0;this.W=this.R=!1;this.L=c}O.prototype.Z=function(a){var b=this.s;b.v&&t(b.j,[b.e.d(b.f,a.getName(),A(a).toString(),"active")],[b.e.d(b.f,a.getName(),A(a).toString(),"loading"),b.e.d(b.f,a.getName(),A(a).toString(),"inactive")]);B(b,"fontactive",a);this.W=!0;P(this)};
11
+ O.prototype.$=function(a){var b=this.s;if(b.v){var c=u(b.j,b.e.d(b.f,a.getName(),A(a).toString(),"active")),d=[],f=[b.e.d(b.f,a.getName(),A(a).toString(),"loading")];c||d.push(b.e.d(b.f,a.getName(),A(a).toString(),"inactive"));t(b.j,d,f)}B(b,"fontinactive",a);P(this)};function P(a){0==--a.J&&a.R&&(a.W?(a=a.s,a.v&&t(a.j,[a.e.d(a.f,"active")],[a.e.d(a.f,"loading"),a.e.d(a.f,"inactive")]),B(a,"active")):C(a.s))};function Q(a){this.C=a;this.t=new fa;this.T=0;this.O=this.P=!0}Q.prototype.load=function(a){this.a=new r(this.C,a.context||this.C);this.P=!1!==a.events;this.O=!1!==a.classes;ia(this,new da(this.a,a),a)};
12
+ function ja(a,b,c,d,f){var e=0==--a.T;(a.O||a.P)&&setTimeout(function(){var a=f||null,l=d||null||{};if(0===c.length&&e)C(b.s);else{b.J+=c.length;e&&(b.R=e);for(var k=0;k<c.length;k++){var h=c[k],p=l[h.getName()],q=b.s,E=h;q.v&&t(q.j,[q.e.d(q.f,E.getName(),A(E).toString(),"loading")]);B(q,"fontloading",E);q=null;q=new H(m(b.Z,b),m(b.$,b),b.a,h,b.L,a,p);q.start()}}},0)}
13
+ function ia(a,b,c){var d=[],f=c.timeout;ea(b);var d=ga(a.t,c,a.a),e=new O(a.a,b,f);a.T=d.length;b=0;for(c=d.length;b<c;b++)d[b].load(function(b,c,d){ja(a,e,b,c,d)})};function R(a,b,c){this.H=a?a:b+ka;this.k=[];this.K=[];this.X=c||""}var ka="//fonts.googleapis.com/css";R.prototype.d=function(){if(0==this.k.length)throw Error("No fonts to load!");if(-1!=this.H.indexOf("kit="))return this.H;for(var a=this.k.length,b=[],c=0;c<a;c++)b.push(this.k[c].replace(/ /g,"+"));a=this.H+"?family="+b.join("%7C");0<this.K.length&&(a+="&subset="+this.K.join(","));0<this.X.length&&(a+="&text="+encodeURIComponent(this.X));return a};function S(a){this.k=a;this.V=[];this.F={}}
14
+ var T={latin:"BESbswy",cyrillic:"&#1081;&#1103;&#1046;",greek:"&#945;&#946;&#931;",khmer:"&#x1780;&#x1781;&#x1782;",Hanuman:"&#x1780;&#x1781;&#x1782;"},la={thin:"1",extralight:"2","extra-light":"2",ultralight:"2","ultra-light":"2",light:"3",regular:"4",book:"4",medium:"5","semi-bold":"6",semibold:"6","demi-bold":"6",demibold:"6",bold:"7","extra-bold":"8",extrabold:"8","ultra-bold":"8",ultrabold:"8",black:"9",heavy:"9",l:"3",r:"4",b:"7"},ma={i:"i",italic:"i",n:"n",normal:"n"},na=/^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$/;
15
+ S.prototype.parse=function(){for(var a=this.k.length,b=0;b<a;b++){var c=this.k[b].split(":"),d=c[0].replace(/\+/g," "),f=["n4"];if(2<=c.length){var e;var g=c[1];e=[];if(g)for(var g=g.split(","),l=g.length,k=0;k<l;k++){var h;h=g[k];if(h.match(/^[\w-]+$/))if(h=na.exec(h.toLowerCase()),null==h)h="";else{var p;p=h[1];if(null==p||""==p)p="4";else{var q=la[p];p=q?q:isNaN(p)?"4":p.substr(0,1)}h=h[2];h=[null==h||""==h?"n":ma[h],p].join("")}else h="";h&&e.push(h)}0<e.length&&(f=e);3==c.length&&(c=c[2],e=[],
16
+ c=c?c.split(","):e,0<c.length&&(c=T[c[0]])&&(this.F[d]=c))}this.F[d]||(c=T[d])&&(this.F[d]=c);for(c=0;c<f.length;c+=1)this.V.push(new z(d,f[c]))}};function U(a,b){this.a=a;this.c=b}var oa={Arimo:!0,Cousine:!0,Tinos:!0};U.prototype.load=function(a){for(var b=this.a,c=new R(this.c.api,v(b),this.c.text),d=this.c.families,f=d.length,e=0;e<f;e++){var g=d[e].split(":");3==g.length&&c.K.push(g.pop());var l="";2==g.length&&""!=g[1]&&(l=":");c.k.push(g.join(l))}d=new S(d);d.parse();w(b,c.d());a(d.V,d.F,oa)};function V(a,b){this.a=a;this.c=b;this.Q=[]}V.prototype.B=function(a){var b=this.a;return v(this.a)+(this.c.api||"//f.fontdeck.com/s/css/js/")+(b.q.location.hostname||b.C.location.hostname)+"/"+a+".js"};
17
+ V.prototype.load=function(a){var b=this.c.id,c=this.a.q,d=this;b?(c.__webfontfontdeckmodule__||(c.__webfontfontdeckmodule__={}),c.__webfontfontdeckmodule__[b]=function(b,c){for(var g=0,l=c.fonts.length;g<l;++g){var k=c.fonts[g];d.Q.push(new z(k.name,ca("font-weight:"+k.weight+";font-style:"+k.style)))}a(d.Q)},x(this.a,this.B(b),function(b){b&&a([])})):a([])};function W(a,b){this.a=a;this.c=b}W.prototype.B=function(a){return(this.c.api||"https://use.typekit.net")+"/"+a+".js"};W.prototype.load=function(a){var b=this.c.id,c=this.a.q;b?x(this.a,this.B(b),function(b){if(b)a([]);else if(c.Typekit&&c.Typekit.config&&c.Typekit.config.fn){b=c.Typekit.config.fn;for(var f=[],e=0;e<b.length;e+=2)for(var g=b[e],l=b[e+1],k=0;k<l.length;k++)f.push(new z(g,l[k]));try{c.Typekit.load({events:!1,classes:!1})}catch(h){}a(f)}},2E3):a([])};function X(a,b){this.a=a;this.c=b}X.prototype.B=function(a,b){var c=v(this.a),d=(this.c.api||"fast.fonts.net/jsapi").replace(/^.*http(s?):(\/\/)?/,"");return c+"//"+d+"/"+a+".js"+(b?"?v="+b:"")};X.prototype.load=function(a){var b=this.c.projectId,c=this.c.version;if(b){var d=this.a.q;x(this.a,this.B(b,c),function(c){if(c)a([]);else if(d["__mti_fntLst"+b]){c=d["__mti_fntLst"+b]();var e=[];if(c)for(var g=0;g<c.length;g++)e.push(new z(c[g].fontfamily));a(e)}else a([])}).id="__MonotypeAPIScript__"+b}else a([])};function Y(a,b){this.a=a;this.c=b}Y.prototype.load=function(a){var b,c,d=this.c.urls||[],f=this.c.families||[],e=this.c.testStrings||{};b=0;for(c=d.length;b<c;b++)w(this.a,d[b]);d=[];b=0;for(c=f.length;b<c;b++){var g=f[b].split(":");if(g[1])for(var l=g[1].split(","),k=0;k<l.length;k+=1)d.push(new z(g[0],l[k]));else d.push(new z(g[0]))}a(d,e)};var Z=new Q(this);Z.t.u.custom=function(a,b){return new Y(b,a)};Z.t.u.fontdeck=function(a,b){return new V(b,a)};Z.t.u.monotype=function(a,b){return new X(b,a)};Z.t.u.typekit=function(a,b){return new W(b,a)};Z.t.u.google=function(a,b){return new U(b,a)};var $={load:m(Z.load,Z)};"function"===typeof define&&define.amd?define(function(){return $}):"undefined"!==typeof module&&module.exports?module.exports=$:(window.WebFont=$,window.WebFontConfig&&Z.load(window.WebFontConfig));})(this,document);
30
18
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webfontloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.21
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Carver
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-26 00:00:00.000000000 Z
12
+ date: 2015-05-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -129,8 +129,6 @@ files:
129
129
  - spec/core/fontwatchrunner_spec.js
130
130
  - spec/core/nativefontwatchrunner_spec.js
131
131
  - spec/core/size_spec.js
132
- - spec/core/useragentparser_spec.js
133
- - spec/core/version_spec.js
134
132
  - spec/core/webfont_spec.js
135
133
  - spec/deps.js
136
134
  - spec/fixtures/external_script.js
@@ -158,7 +156,6 @@ files:
158
156
  - spec/modules/monotype_spec.js
159
157
  - spec/modules/typekit_spec.js
160
158
  - src/closure.js
161
- - src/core/browserinfo.js
162
159
  - src/core/cssclassname.js
163
160
  - src/core/domhelper.js
164
161
  - src/core/eventdispatcher.js
@@ -170,9 +167,6 @@ files:
170
167
  - src/core/fontwatchrunner.js
171
168
  - src/core/initialize.js
172
169
  - src/core/nativefontwatchrunner.js
173
- - src/core/useragent.js
174
- - src/core/useragentparser.js
175
- - src/core/version.js
176
170
  - src/core/webfont.js
177
171
  - src/modules.yml
178
172
  - src/modules/custom.js
@@ -1,1301 +0,0 @@
1
- describe('UserAgentParser', function () {
2
- var UserAgentParser = webfont.UserAgentParser,
3
- Version = webfont.Version;
4
-
5
- beforeEach(function () {
6
- this.addMatchers({
7
- toMatchUserAgent: function (expected) {
8
- var actual = this.actual,
9
- notText = this.isNot ? 'not' : '';
10
-
11
- function msg(description, actual, expected) {
12
- return function () {
13
- return 'Expected ' + description + ' ' + actual + notText + ' to match ' + expected;
14
- };
15
- }
16
-
17
- if (actual.getName() !== expected.name) {
18
- this.message = msg('name', actual.getName(), expected.name);
19
- return false;
20
- }
21
-
22
- if (actual.getVersion().ne(expected.version)) {
23
- this.message = msg('parsed version', actual.getVersion(), expected.version);
24
- return false;
25
- }
26
-
27
- if (actual.getPlatform() !== expected.platform) {
28
- this.message = msg('platform', actual.getPlatform(), expected.platform);
29
- return false;
30
- }
31
-
32
- if (actual.getPlatformVersion().ne(expected.platformVersion)) {
33
- this.message = msg('platform parsed version', actual.gePlatformVersion(), expected.platformVersion);
34
- return false;
35
- }
36
-
37
- if (actual.getEngine() !== expected.engine) {
38
- this.message = msg('engine', actual.getEngine(), expected.engine);
39
- return false;
40
- }
41
-
42
- if (actual.getEngineVersion().ne(expected.engineVersion)) {
43
- this.message = msg('engine parsed version', actual.getEngineVersion(), expected.engineVersion);
44
- return false;
45
- }
46
-
47
- if (actual.getDocumentMode() !== expected.documentMode) {
48
- this.message = msg('document mode', actual.getDocumentMode(), expected.documentMode);
49
- return false;
50
- }
51
-
52
- if (actual.getBrowserInfo().hasWebFontSupport() !== expected.browserInfo.hasWebFontSupport) {
53
- this.message = msg('web font support', actual.getBrowserInfo().hasWebFontSupport(), expected.browserInfo.hasWebFontSupport);
54
- return false;
55
- }
56
-
57
- if (actual.getBrowserInfo().hasWebKitFallbackBug() !== expected.browserInfo.hasWebKitFallbackBug) {
58
- this.message = msg('web kit fallback bug', actual.getBrowserInfo().hasWebKitFallbackBug(), expected.browserInfo.hasWebKitFallbackBug);
59
- return false;
60
- }
61
-
62
- if (actual.getBrowserInfo().hasWebKitMetricsBug() !== expected.browserInfo.hasWebKitMetricsBug) {
63
- this.message = msg('web kit metrics bug', actual.getBrowserInfo().hasWebKitMetricsBug(), expected.browserInfo.hasWebKitFallbackBug);
64
- return false;
65
- }
66
-
67
- return true;
68
- }
69
- });
70
- });
71
-
72
- describe('#getPlatformVersionString_', function () {
73
- function parsePlatformVersion(str) {
74
- return new UserAgentParser(str, {}).getPlatformVersionString_();
75
- }
76
-
77
- it('should parse Linux versions correctly', function () {
78
- expect(parsePlatformVersion('(Linux; U; en-us; KFJWI Build/IML74K)')).toEqual('Unknown');
79
- expect(parsePlatformVersion('(Linux i686; U; en)')).toEqual('Unknown');
80
- expect(parsePlatformVersion('(X11; Linux i686; U; Linux Mint; nb)')).toEqual('Unknown');
81
- expect(parsePlatformVersion('(X11; Linux x86_64)')).toEqual('Unknown');
82
- expect(parsePlatformVersion('(X11; U; en-US; rv:2.0; Linux i686 10.1)')).toEqual('10.1');
83
- expect(parsePlatformVersion('(X11; Linux i868 10.1; U; en-US; rv:2.0)')).toEqual('10.1');
84
- expect(parsePlatformVersion('(X11; Linux 10.1; U; en-US)')).toEqual('10.1');
85
- });
86
-
87
- it('should parse ChromeOS versions correctly', function () {
88
- expect(parsePlatformVersion('(X11; CrOS i686 1660.57.0)')).toEqual('1660.57.0');
89
- });
90
- });
91
-
92
- describe('#parse', function () {
93
- function parse(userAgentString, doc) {
94
- return new UserAgentParser(userAgentString, doc || {}).parse();
95
- }
96
-
97
- describe('Adobe Air', function () {
98
- it('should detect Adobe Air', function () {
99
- expect(parse('Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/531.9 (KHTML, like Gecko) AdobeAIR/2.5'))
100
- .toMatchUserAgent({
101
- name: 'AdobeAIR',
102
- version: new Version(2, 5),
103
- platform: 'Macintosh',
104
- platformVersion: new Version(),
105
- engine: 'AppleWebKit',
106
- engineVersion: new Version(531, 9),
107
- documentMode: undefined,
108
- browserInfo: {
109
- hasWebFontSupport: true,
110
- hasWebKitFallbackBug: true,
111
- hasWebKitMetricsBug: true
112
- }
113
- });
114
- });
115
-
116
- it('should detect unsupported Adobe Air browsers', function () {
117
- expect(parse('Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/531.9 (KHTML, like Gecko) AdobeAIR/2.0'))
118
- .toMatchUserAgent({
119
- name: 'AdobeAIR',
120
- version: new Version(2, 0),
121
- platform: 'Macintosh',
122
- platformVersion: new Version(),
123
- engine: 'AppleWebKit',
124
- engineVersion: new Version(531, 9),
125
- documentMode: undefined,
126
- browserInfo: {
127
- hasWebFontSupport: false,
128
- hasWebKitFallbackBug: true,
129
- hasWebKitMetricsBug: true
130
- }
131
- });
132
- });
133
- });
134
-
135
- describe('Firefox', function () {
136
- it('should detect Firefox', function () {
137
- expect(parse('Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.1'))
138
- .toMatchUserAgent({
139
- name: 'Firefox',
140
- version: new Version(3, 6, 3),
141
- platform: 'Macintosh',
142
- platformVersion: new Version(10, 5),
143
- engine: 'Gecko',
144
- engineVersion: new Version(1, 9, 2, 3),
145
- documentMode: undefined,
146
- browserInfo: {
147
- hasWebFontSupport: true,
148
- hasWebKitFallbackBug: false,
149
- hasWebKitMetricsBug: false
150
- }
151
- });
152
-
153
- expect(parse('Mozilla/5.0 (X11; U; Linux i686; ru-RU; rv:1.9.2a1pre) Gecko/20090405 Ubuntu/9.04 (jaunty) Firefox/3.6a1pre'))
154
- .toMatchUserAgent({
155
- name: 'Firefox',
156
- version: new Version(3, 6, null, 'a1pre'),
157
- platform: 'Linux',
158
- platformVersion: new Version(), //'i686'
159
- engine: 'Gecko',
160
- engineVersion: new Version(1, 9, 2, 'a1pre'),
161
- documentMode: undefined,
162
- browserInfo: {
163
- hasWebFontSupport: true,
164
- hasWebKitFallbackBug: false,
165
- hasWebKitMetricsBug: false
166
- }
167
- });
168
- });
169
-
170
- it('should detect Firefox 4 beta', function () {
171
- expect(parse('Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:2.0b1) Gecko/20100630 Firefox/4.0b1'))
172
- .toMatchUserAgent({
173
- name: 'Firefox',
174
- version: new Version(4, 0, null, 'b1'),
175
- platform: 'Macintosh',
176
- platformVersion: new Version(10, 6),
177
- engine: 'Gecko',
178
- engineVersion: new Version(2, 0, 'b1'),
179
- documentMode: undefined,
180
- browserInfo: {
181
- hasWebFontSupport: true,
182
- hasWebKitFallbackBug: false,
183
- hasWebKitMetricsBug: false
184
- }
185
- });
186
- });
187
-
188
- it('should detect Firefox on Android', function () {
189
- // This useragent has been slightly doctored with versions to ensure the right
190
- // info is coming from the right places.
191
- expect(parse('Mozilla/5.0 (Android; Mobile; rv:13.0) Gecko/15.0 Firefox/14.0'))
192
- .toMatchUserAgent({
193
- name: 'Firefox',
194
- version: new Version(14, 0),
195
- platform: 'Android',
196
- platformVersion: new Version(),
197
- engine: 'Gecko',
198
- engineVersion: new Version(13, 0),
199
- documentMode: undefined,
200
- browserInfo: {
201
- hasWebFontSupport: true,
202
- hasWebKitFallbackBug: false,
203
- hasWebKitMetricsBug: false
204
- }
205
- });
206
- });
207
-
208
- it('should detect Firefox without version', function () {
209
- expect(parse('Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.19) Gecko/20081202 Firefox (Debian-2.0.0.19-0etch1)'))
210
- .toMatchUserAgent({
211
- name: 'Firefox',
212
- version: new Version(),
213
- platform: 'Linux',
214
- platformVersion: new Version(), //'i686'
215
- engine: 'Gecko',
216
- engineVersion: new Version(1, 8, 1, 19),
217
- documentMode: undefined,
218
- browserInfo: {
219
- hasWebFontSupport: false,
220
- hasWebKitFallbackBug: false,
221
- hasWebKitMetricsBug: false
222
- }
223
- });
224
- });
225
- });
226
-
227
- describe('Chrome', function () {
228
- it('should detect Chrome', function () {
229
- expect(parse('Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2'))
230
- .toMatchUserAgent({
231
- name: 'Chrome',
232
- version: new Version(5, 0, 342, 9),
233
- platform: 'Macintosh',
234
- platformVersion: new Version(10, 5, 8),
235
- engine: 'AppleWebKit',
236
- engineVersion: new Version(533, 2),
237
- documentMode: undefined,
238
- browserInfo: {
239
- hasWebFontSupport: true,
240
- hasWebKitFallbackBug: true,
241
- hasWebKitMetricsBug: true
242
- }
243
- });
244
- });
245
-
246
- it('should detect Chrome on ChromeOS', function () {
247
- expect(parse('Mozilla/5.0 (X11; CrOS i686 1660.57.0) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.46 Safari/535.19'))
248
- .toMatchUserAgent({
249
- name: 'Chrome',
250
- version: new Version(18, 0, 1025, 46),
251
- platform: 'CrOS',
252
- platformVersion: new Version(1660, 57, 0),
253
- engine: 'AppleWebKit',
254
- engineVersion: new Version(535, 19),
255
- documentMode: undefined,
256
- browserInfo: {
257
- hasWebFontSupport: true,
258
- hasWebKitFallbackBug: true,
259
- hasWebKitMetricsBug: false
260
- }
261
- });
262
- });
263
-
264
- it('should detect Chrome on CromeCast', function () {
265
- expect(parse('Mozilla/5.0 (CrKey armv71 1.6.16664) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.0 Safari/537.36'))
266
- .toMatchUserAgent({
267
- name: 'Chrome',
268
- version: new Version(31, 0, 1650, 0),
269
- platform: 'CrKey',
270
- platformVersion: new Version(1, 6, 16664),
271
- engine: 'AppleWebKit',
272
- engineVersion: new Version(537, 36),
273
- documentMode: undefined,
274
- browserInfo: {
275
- hasWebFontSupport: true,
276
- hasWebKitFallbackBug: false,
277
- hasWebKitMetricsBug: false
278
- }
279
- });
280
- });
281
-
282
- it('should detect Chrome on Android', function () {
283
- expect(parse('Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; Nexus S Build/IML74K) AppleWebKit/535.7 (KHTML, like Gecko) CrMo/16.0.912.75 Mobile Safari/535.7'))
284
- .toMatchUserAgent({
285
- name: 'Chrome',
286
- version: new Version(16, 0, 912, 75),
287
- platform: 'Android',
288
- platformVersion: new Version(4, 0, 3),
289
- engine: 'AppleWebKit',
290
- engineVersion: new Version(535, 7),
291
- documentMode: undefined,
292
- browserInfo: {
293
- hasWebFontSupport: true,
294
- hasWebKitFallbackBug: true,
295
- hasWebKitMetricsBug: false
296
- }
297
- });
298
-
299
- expect(parse('Mozilla/5.0 (Linux; Android 4.2.2; SGH-M919 Build/JDQ39) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.169 Mobile Safari/537.22'))
300
- .toMatchUserAgent({
301
- name: 'Chrome',
302
- version: new Version(25, 0, 1364, 169),
303
- platform: 'Android',
304
- platformVersion: new Version(4, 2, 2),
305
- engine: 'AppleWebKit',
306
- engineVersion: new Version(537, 22),
307
- documentMode: undefined,
308
- browserInfo: {
309
- hasWebFontSupport: true,
310
- hasWebKitFallbackBug: false,
311
- hasWebKitMetricsBug: false
312
- }
313
- });
314
- });
315
-
316
- it('should detect Chrome on iPad', function () {
317
- expect(parse('Mozilla/5.0 (iPad; U; CPU OS 5_1_1 like Mac OS X; en-us) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3'))
318
- .toMatchUserAgent({
319
- name: 'Chrome',
320
- version: new Version(19, 0, 1084, 60),
321
- platform: 'iPad',
322
- platformVersion: new Version(5, 1, 1),
323
- engine: 'AppleWebKit',
324
- engineVersion: new Version(534, 46, 0),
325
- documentMode: undefined,
326
- browserInfo: {
327
- hasWebFontSupport: true,
328
- hasWebKitFallbackBug: true,
329
- hasWebKitMetricsBug: true
330
- }
331
- });
332
- });
333
-
334
- it('should detect Chrome on iPod', function () {
335
- expect(parse('Mozilla/5.0 (iPod; U; CPU iPhone OS 5_1_1 like Mac OS X; en-us) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3'))
336
- .toMatchUserAgent({
337
- name: 'Chrome',
338
- version: new Version(19, 0, 1084, 60),
339
- platform: 'iPod',
340
- platformVersion: new Version(5, 1, 1),
341
- engine: 'AppleWebKit',
342
- engineVersion: new Version(534, 46, 0),
343
- documentMode: undefined,
344
- browserInfo: {
345
- hasWebFontSupport: true,
346
- hasWebKitFallbackBug: true,
347
- hasWebKitMetricsBug: true
348
- }
349
- });
350
- });
351
- });
352
-
353
- describe('Safari', function () {
354
- it('should detect Safari', function () {
355
- expect(parse('Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10'))
356
- .toMatchUserAgent({
357
- name: 'Safari',
358
- version: new Version(4, 0, 4),
359
- platform: 'Macintosh',
360
- platformVersion: new Version(10, 5, 8),
361
- engine: 'AppleWebKit',
362
- engineVersion: new Version(531, 21, 8),
363
- documentMode: undefined,
364
- browserInfo: {
365
- hasWebFontSupport: true,
366
- hasWebKitFallbackBug: true,
367
- hasWebKitMetricsBug: true
368
- }
369
- });
370
-
371
- expect(parse('Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; tr) AppleWebKit/528.4+ (KHTML, like Gecko) Version/4.0dp1 Safari/526.11.2'))
372
- .toMatchUserAgent({
373
- name: 'Safari',
374
- version: new Version(4, 0, null, 'dp1'),
375
- platform: 'Macintosh',
376
- platformVersion: new Version(10, 4, 11),
377
- engine: 'AppleWebKit',
378
- engineVersion: new Version(528, 4),
379
- documentMode: undefined,
380
- browserInfo: {
381
- hasWebFontSupport: true,
382
- hasWebKitFallbackBug: true,
383
- hasWebKitMetricsBug: true
384
- }
385
- });
386
- });
387
-
388
- it('should detect Safari on iPhone', function () {
389
- expect(parse('Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7D11 Safari/528.16'))
390
- .toMatchUserAgent({
391
- name: 'Safari',
392
- version: new Version(4, 0),
393
- platform: 'iPhone',
394
- platformVersion: new Version(3, 1, 2),
395
- engine: 'AppleWebKit',
396
- engineVersion: new Version(528, 18),
397
- documentMode: undefined,
398
- browserInfo: {
399
- hasWebFontSupport: true,
400
- hasWebKitFallbackBug: true,
401
- hasWebKitMetricsBug: true
402
- }
403
- });
404
- });
405
-
406
- it('should detect Safari on iPad', function () {
407
- expect(parse('Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10'))
408
- .toMatchUserAgent({
409
- name: 'Safari',
410
- version: new Version(4, 0, 4),
411
- platform: 'iPad',
412
- platformVersion: new Version(3, 2),
413
- engine: 'AppleWebKit',
414
- engineVersion: new Version(531, 21, 10),
415
- documentMode: undefined,
416
- browserInfo: {
417
- hasWebFontSupport: true,
418
- hasWebKitFallbackBug: true,
419
- hasWebKitMetricsBug: true
420
- }
421
- });
422
-
423
- expect(parse('Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B360 Safari/531.21.10"'))
424
- .toMatchUserAgent({
425
- name: 'Safari',
426
- version: new Version(4, 0, 4),
427
- platform: 'iPad',
428
- platformVersion: new Version(3, 2),
429
- engine: 'AppleWebKit',
430
- engineVersion: new Version(531, 21, 10),
431
- documentMode: undefined,
432
- browserInfo: {
433
- hasWebFontSupport: true,
434
- hasWebKitFallbackBug: true,
435
- hasWebKitMetricsBug: true
436
- }
437
- });
438
-
439
- expect(parse('Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10'))
440
- .toMatchUserAgent({
441
- name: 'Safari',
442
- version: new Version(4, 0, 4),
443
- platform: 'iPad',
444
- platformVersion: new Version(3, 2),
445
- engine: 'AppleWebKit',
446
- engineVersion: new Version(531, 21, 10),
447
- documentMode: undefined,
448
- browserInfo: {
449
- hasWebFontSupport: true,
450
- hasWebKitFallbackBug: true,
451
- hasWebKitMetricsBug: true
452
- }
453
- });
454
- });
455
-
456
- it('should detect Safari on iPod', function () {
457
- expect(parse('Mozilla/5.0 (iPod; U; CPU iPhone OS 2_2_1 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Mobile/5H11a'))
458
- .toMatchUserAgent({
459
- name: 'Unknown',
460
- version: new Version(),
461
- platform: 'iPod',
462
- platformVersion: new Version(2, 2, 1),
463
- engine: 'AppleWebKit',
464
- engineVersion: new Version(525, 18, 1),
465
- documentMode: undefined,
466
- browserInfo: {
467
- hasWebFontSupport: true,
468
- hasWebKitFallbackBug: true,
469
- hasWebKitMetricsBug: true
470
- }
471
- });
472
-
473
- expect(parse('Mozilla/5.0 (iPod; U; CPU iPhone OS 3_1 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7C144 Safari/528.16'))
474
- .toMatchUserAgent({
475
- name: 'Safari',
476
- version: new Version(4, 0),
477
- platform: 'iPod',
478
- platformVersion: new Version(3, 1),
479
- engine: 'AppleWebKit',
480
- engineVersion: new Version(528, 18),
481
- documentMode: undefined,
482
- browserInfo: {
483
- hasWebFontSupport: true,
484
- hasWebKitFallbackBug: true,
485
- hasWebKitMetricsBug: true
486
- }
487
- });
488
- });
489
- });
490
-
491
- describe('Internet Explorer', function () {
492
- it('should detect Internet Explorer', function () {
493
- expect(parse('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)'))
494
- .toMatchUserAgent({
495
- name: 'MSIE',
496
- version: new Version(7, 0),
497
- platform: 'Windows',
498
- platformVersion: new Version(5, 1),
499
- engine: 'Unknown',
500
- engineVersion: new Version(),
501
- documentMode: undefined,
502
- browserInfo: {
503
- hasWebFontSupport: true,
504
- hasWebKitFallbackBug: false,
505
- hasWebKitMetricsBug: false
506
- }
507
- });
508
-
509
- expect(parse('Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; Media Center PC 3.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)'))
510
- .toMatchUserAgent({
511
- name: 'MSIE',
512
- version: new Version(7, 0, null, 'b'),
513
- platform: 'Windows',
514
- platformVersion: new Version(5, 1),
515
- engine: 'Unknown',
516
- engineVersion: new Version(),
517
- documentMode: undefined,
518
- browserInfo: {
519
- hasWebFontSupport: true,
520
- hasWebKitFallbackBug: false,
521
- hasWebKitMetricsBug: false
522
- }
523
- });
524
- });
525
-
526
- it('should detect minimal Internet Explorer', function () {
527
- expect(parse('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'))
528
- .toMatchUserAgent({
529
- name: 'MSIE',
530
- version: new Version(7, 0),
531
- platform: 'Windows',
532
- platformVersion: new Version(5, 1),
533
- engine: 'Unknown',
534
- engineVersion: new Version(),
535
- documentMode: undefined,
536
- browserInfo: {
537
- hasWebFontSupport: true,
538
- hasWebKitFallbackBug: false,
539
- hasWebKitMetricsBug: false
540
- }
541
- });
542
- });
543
-
544
- it('should detect Internet Explorer on Windows Phone', function () {
545
- expect(parse('Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; ARM; Touch; IEMobile/10.0; <Manufacturer>; <Device>; <Operator>)'))
546
- .toMatchUserAgent({
547
- name: 'MSIE',
548
- version: new Version(10, 0),
549
- platform: 'Windows Phone',
550
- platformVersion: new Version(8, 0),
551
- engine: 'Trident',
552
- engineVersion: new Version(6, 0),
553
- documentMode: undefined,
554
- browserInfo: {
555
- hasWebFontSupport: true,
556
- hasWebKitFallbackBug: false,
557
- hasWebKitMetricsBug: false
558
- }
559
- });
560
-
561
- expect(parse('Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; id404) like Gecko'))
562
- .toMatchUserAgent({
563
- name: 'MSIE',
564
- version: new Version(11, 0),
565
- platform: 'Windows Phone',
566
- platformVersion: new Version(8, 1),
567
- engine: 'Trident',
568
- engineVersion: new Version(7, 0),
569
- documentMode: undefined,
570
- browserInfo: {
571
- hasWebFontSupport: true,
572
- hasWebKitFallbackBug: false,
573
- hasWebKitMetricsBug: false
574
- }
575
- });
576
- });
577
-
578
- it('should detect unsupported Internet Explorer on Windows Phone', function () {
579
- expect(parse('Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; SAMSUNG; SGH-i917)'))
580
- .toMatchUserAgent({
581
- name: 'MSIE',
582
- version: new Version(9, 0),
583
- platform: 'Windows Phone',
584
- platformVersion: new Version(7, 5),
585
- engine: 'Trident',
586
- engineVersion: new Version(5, 0),
587
- documentMode: undefined,
588
- browserInfo: {
589
- hasWebFontSupport: false,
590
- hasWebKitFallbackBug: false,
591
- hasWebKitMetricsBug: false
592
- }
593
- });
594
- });
595
-
596
- it('should detect Internet Explorer on Mac', function () {
597
- expect(parse('Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC)'))
598
- .toMatchUserAgent({
599
- name: 'MSIE',
600
- version: new Version(5, 23),
601
- platform: 'Macintosh',
602
- platformVersion: new Version(),
603
- engine: 'Unknown',
604
- engineVersion: new Version(),
605
- documentMode: undefined,
606
- browserInfo: {
607
- hasWebFontSupport: false,
608
- hasWebKitFallbackBug: false,
609
- hasWebKitMetricsBug: false
610
- }
611
- });
612
- });
613
-
614
- it('should detect Internet Explorer with Trident version', function () {
615
- expect(parse('Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; InfoPath.2)', { documentMode: 8 }))
616
- .toMatchUserAgent({
617
- name: 'MSIE',
618
- version: new Version(8, 0),
619
- platform: 'Windows',
620
- platformVersion: new Version(6, 1),
621
- engine: 'Trident',
622
- engineVersion: new Version(4, 0),
623
- documentMode: 8,
624
- browserInfo: {
625
- hasWebFontSupport: true,
626
- hasWebKitFallbackBug: false,
627
- hasWebKitMetricsBug: false
628
- }
629
- });
630
- });
631
-
632
- it('should detect Internet Explorer 11', function () {
633
- expect(parse('Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko', { documentMode: 11 }))
634
- .toMatchUserAgent({
635
- name: 'MSIE',
636
- version: new Version(11, 0),
637
- platform: 'Windows',
638
- platformVersion: new Version(6, 3),
639
- engine: 'Trident',
640
- engineVersion: new Version(7, 0),
641
- documentMode: 11,
642
- browserInfo: {
643
- hasWebFontSupport: true,
644
- hasWebKitFallbackBug: false,
645
- hasWebKitMetricsBug: false
646
- }
647
- });
648
- });
649
- });
650
-
651
- describe('Builtin Browser', function () {
652
- it('should detect Android builtin browser', function () {
653
- expect(parse('Mozilla/5.0 (Linux; U; Android 2.2.1; en-ca; LG-P505R Build/FRG83) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'))
654
- .toMatchUserAgent({
655
- name: 'BuiltinBrowser',
656
- version: new Version(),
657
- platform: 'Android',
658
- platformVersion: new Version(2, 2, 1),
659
- engine: 'AppleWebKit',
660
- engineVersion: new Version(533, 1),
661
- documentMode: undefined,
662
- browserInfo: {
663
- hasWebFontSupport: true,
664
- hasWebKitFallbackBug: true,
665
- hasWebKitMetricsBug: false
666
- }
667
- });
668
- });
669
-
670
- it('should detect unsupported Android builtin browser', function () {
671
- expect(parse('Mozilla/5.0 (Linux; U; Android 2.1-update1; en-us; Nexus One Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17'))
672
- .toMatchUserAgent({
673
- name: 'BuiltinBrowser',
674
- version: new Version(),
675
- platform: 'Android',
676
- platformVersion: new Version(2, 1, null, 'update1'),
677
- engine: 'AppleWebKit',
678
- engineVersion: new Version(530, 17),
679
- documentMode: undefined,
680
- browserInfo: {
681
- hasWebFontSupport: false,
682
- hasWebKitFallbackBug: true,
683
- hasWebKitMetricsBug: false
684
- }
685
- });
686
- });
687
-
688
- it('should detect Samsung Galaxy S4 builtin browser', function () {
689
- expect(parse('Mozilla/5.0 (Linux; Android 4.2.2; sl-si; SAMSUNG GT-I9505 Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Version/1.0 Chrome/18.0.1025.308 Mobile Safari/535.19'))
690
- .toMatchUserAgent({
691
- name: 'Chrome',
692
- version: new Version(18, 0, 1025, 308),
693
- platform: 'Android',
694
- platformVersion: new Version(4, 2, 2),
695
- engine: 'AppleWebKit',
696
- engineVersion: new Version(535, 19),
697
- documentMode: undefined,
698
- browserInfo: {
699
- hasWebFontSupport: true,
700
- hasWebKitFallbackBug: true,
701
- hasWebKitMetricsBug: false
702
- }
703
- });
704
-
705
- expect(parse('Mozilla/5.0 (Linux; Android 4.2.2; en-us; SAMSUNG SGH-M919 Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Version/1.0 Chrome/18.0.1025.308 Mobile Safari/535.19'))
706
- .toMatchUserAgent({
707
- name: 'Chrome',
708
- version: new Version(18, 0, 1025, 308),
709
- platform: 'Android',
710
- platformVersion: new Version(4, 2, 2),
711
- engine: 'AppleWebKit',
712
- engineVersion: new Version(535, 19),
713
- documentMode: undefined,
714
- browserInfo: {
715
- hasWebFontSupport: true,
716
- hasWebKitFallbackBug: true,
717
- hasWebKitMetricsBug: false
718
- }
719
- });
720
- });
721
-
722
- it('should detect Android builtin browser in Desktop mode (Nexus 7)', function () {
723
- expect(parse('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.34 Safari/534.24'))
724
- .toMatchUserAgent({
725
- name: 'Chrome',
726
- version: new Version(11, 0, 696, 34),
727
- platform: 'Linux',
728
- platformVersion: new Version(),
729
- engine: 'AppleWebKit',
730
- engineVersion: new Version(534, 24),
731
- documentMode: undefined,
732
- browserInfo: {
733
- hasWebFontSupport: true,
734
- hasWebKitFallbackBug: true,
735
- hasWebKitMetricsBug: false
736
- }
737
- });
738
- });
739
-
740
- it('should detect Android builtin browser in Mobile mode (Nexus 7)', function () {
741
- expect(parse('Mozilla/5.0 (Linux; U; Android 4.1.2; en-us; sdk Build/MASTER) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30'))
742
- .toMatchUserAgent({
743
- name: 'BuiltinBrowser',
744
- version: new Version(),
745
- platform: 'Android',
746
- platformVersion: new Version(4, 1, 2),
747
- engine: 'AppleWebKit',
748
- engineVersion: new Version(534, 30),
749
- documentMode: undefined,
750
- browserInfo: {
751
- hasWebFontSupport: true,
752
- hasWebKitFallbackBug: true,
753
- hasWebKitMetricsBug: false
754
- }
755
- });
756
- });
757
-
758
- it('should detect Android builtin browser in Desktop mode (Nexus S)', function () {
759
- expect(parse('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.34 Safari/534.24'))
760
- .toMatchUserAgent({
761
- name: 'Chrome',
762
- version: new Version(11, 0, 696, 34),
763
- platform: 'Linux',
764
- platformVersion: new Version(),
765
- engine: 'AppleWebKit',
766
- engineVersion: new Version(534, 24),
767
- documentMode: undefined,
768
- browserInfo: {
769
- hasWebFontSupport: true,
770
- hasWebKitFallbackBug: true,
771
- hasWebKitMetricsBug: false
772
- }
773
- });
774
- });
775
-
776
- it('should detect Android builtin browser in Mobile mode (Nexus S)', function () {
777
- expect(parse('Mozilla/5.0 (Linux; U; Android 4.1.2; en-us; Nexus S Build/JZO54K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30'))
778
- .toMatchUserAgent({
779
- name: 'BuiltinBrowser',
780
- version: new Version(),
781
- platform: 'Android',
782
- platformVersion: new Version(4, 1, 2),
783
- engine: 'AppleWebKit',
784
- engineVersion: new Version(534, 30),
785
- documentMode: undefined,
786
- browserInfo: {
787
- hasWebFontSupport: true,
788
- hasWebKitFallbackBug: true,
789
- hasWebKitMetricsBug: false
790
- }
791
- });
792
- });
793
-
794
- it('should detect BlackBerry 10 as supporting web fonts', function () {
795
- expect(parse('Mozilla/5.0 (BB10; Touch) AppleWebKit/537.3+ (KHTML, like Gecko) Version/10.0.9.388 Mobile Safari/537.3+'))
796
- .toMatchUserAgent({
797
- name: 'BuiltinBrowser',
798
- version: new Version(),
799
- platform: 'BlackBerry',
800
- platformVersion: new Version(10, 0, 9, 388),
801
- engine: 'AppleWebKit',
802
- engineVersion: new Version(537, 3),
803
- documentMode: undefined,
804
- browserInfo: {
805
- hasWebFontSupport: true,
806
- hasWebKitFallbackBug: false,
807
- hasWebKitMetricsBug: false
808
- }
809
- });
810
- });
811
-
812
- it('should detect BlackBerry < 10 as not supporting web fonts', function () {
813
- expect(parse('Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.346 Mobile Safari/534.11+'))
814
- .toMatchUserAgent({
815
- name: 'BuiltinBrowser',
816
- version: new Version(),
817
- platform: 'BlackBerry',
818
- platformVersion: new Version(7, 1, 0, 346),
819
- engine: 'AppleWebKit',
820
- engineVersion: new Version(534, 11),
821
- documentMode: undefined,
822
- browserInfo: {
823
- hasWebFontSupport: false,
824
- hasWebKitFallbackBug: true,
825
- hasWebKitMetricsBug: false
826
- }
827
- });
828
- });
829
-
830
- it('should detect the PS4 browser', function () {
831
- expect(parse('Mozilla/5.0 (PlayStation 4 1.70) AppleWebKit/536.26 (KHTML, like Gecko)'))
832
- .toMatchUserAgent({
833
- name: 'BuiltinBrowser',
834
- version: new Version(),
835
- platform: 'Linux',
836
- platformVersion: new Version(),
837
- engine: 'AppleWebKit',
838
- engineVersion: new Version(536, 26),
839
- documentMode: undefined,
840
- browserInfo: {
841
- hasWebFontSupport: true,
842
- hasWebKitFallbackBug: false,
843
- hasWebKitMetricsBug: false
844
- }
845
- });
846
- });
847
- });
848
-
849
- describe('Amazon Silk', function () {
850
- it('should detect 2nd generation', function () {
851
- expect(parse('Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFOT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/2.6 Mobile Safari/535.19 Silk-Accelerated=false'))
852
- .toMatchUserAgent({
853
- name: 'Silk',
854
- version: new Version(2, 6),
855
- platform: 'Android',
856
- platformVersion: new Version(4, 0, 3),
857
- engine: 'AppleWebKit',
858
- engineVersion: new Version(535, 19),
859
- documentMode: undefined,
860
- browserInfo: {
861
- hasWebFontSupport: true,
862
- hasWebKitFallbackBug: true,
863
- hasWebKitMetricsBug: false
864
- }
865
- });
866
- });
867
-
868
- it('should detect 2nd generation (Desktop mode)', function () {
869
- expect(parse('Mozilla/5.0 (Linux; U; en-us; KFOT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/2.6 Safari/535.19 Silk-Accelerated=false'))
870
- .toMatchUserAgent({
871
- name: 'Silk',
872
- version: new Version(2, 6),
873
- platform: 'Linux',
874
- platformVersion: new Version(),
875
- engine: 'AppleWebKit',
876
- engineVersion: new Version(535, 19),
877
- documentMode: undefined,
878
- browserInfo: {
879
- hasWebFontSupport: true,
880
- hasWebKitFallbackBug: true,
881
- hasWebKitMetricsBug: false
882
- }
883
- })
884
- });
885
-
886
- it('HD 7"', function () {
887
- expect(parse('Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/2.6 Mobile Safari/535.19 Silk-Accelerated=false'))
888
- .toMatchUserAgent({
889
- name: 'Silk',
890
- version: new Version(2, 6),
891
- platform: 'Android',
892
- platformVersion: new Version(4, 0, 3),
893
- engine: 'AppleWebKit',
894
- engineVersion: new Version(535, 19),
895
- documentMode: undefined,
896
- browserInfo: {
897
- hasWebFontSupport: true,
898
- hasWebKitFallbackBug: true,
899
- hasWebKitMetricsBug: false
900
- }
901
- });
902
- });
903
-
904
- it('HD 7" (Desktop mode)', function () {
905
- expect(parse('Mozilla/5.0 (Linux; U; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/2.6 Safari/535.19 Silk-Accelerated=false'))
906
- .toMatchUserAgent({
907
- name: 'Silk',
908
- version: new Version(2, 6),
909
- platform: 'Linux',
910
- platformVersion: new Version(),
911
- engine: 'AppleWebKit',
912
- engineVersion: new Version(535, 19),
913
- documentMode: undefined,
914
- browserInfo: {
915
- hasWebFontSupport: true,
916
- hasWebKitFallbackBug: true,
917
- hasWebKitMetricsBug: false
918
- }
919
- });
920
- });
921
-
922
- it('HD 8.9" Wi-Fi', function () {
923
- expect(parse('Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFJWI Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/2.6 Mobile Safari/535.19 Silk-Accelerated=false'))
924
- .toMatchUserAgent({
925
- name: 'Silk',
926
- version: new Version(2, 6),
927
- platform: 'Android',
928
- platformVersion: new Version(4, 0, 3),
929
- engine: 'AppleWebKit',
930
- engineVersion: new Version(535, 19),
931
- documentMode: undefined,
932
- browserInfo: {
933
- hasWebFontSupport: true,
934
- hasWebKitFallbackBug: true,
935
- hasWebKitMetricsBug: false
936
- }
937
- });
938
- });
939
-
940
- it('HD 8.9" Wi-Fi (Desktop mode)', function () {
941
- expect(parse('Mozilla/5.0 (Linux; U; en-us; KFJWI Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/2.6 Safari/535.19 Silk-Accelerated=false'))
942
- .toMatchUserAgent({
943
- name: 'Silk',
944
- version: new Version(2, 6),
945
- platform: 'Linux',
946
- platformVersion: new Version(),
947
- engine: 'AppleWebKit',
948
- engineVersion: new Version(535, 19),
949
- documentMode: undefined,
950
- browserInfo: {
951
- hasWebFontSupport: true,
952
- hasWebKitFallbackBug: true,
953
- hasWebKitMetricsBug: false
954
- }
955
- });
956
- });
957
-
958
- it('HD 8.9" WAN', function () {
959
- expect(parse('Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFJWA Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/2.6 Mobile Safari/535.19 Silk-Accelerated=false'))
960
- .toMatchUserAgent({
961
- name: 'Silk',
962
- version: new Version(2, 6),
963
- platform: 'Android',
964
- platformVersion: new Version(4, 0, 3),
965
- engine: 'AppleWebKit',
966
- engineVersion: new Version(535, 19),
967
- documentMode: undefined,
968
- browserInfo: {
969
- hasWebFontSupport: true,
970
- hasWebKitFallbackBug: true,
971
- hasWebKitMetricsBug: false
972
- }
973
- });
974
- });
975
-
976
- it('HD 8.9" WAN (Desktop mode)', function () {
977
- expect(parse('Mozilla/5.0 (Linux; U; en-us; KFJWA Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/2.6 Safari/535.19 Silk-Accelerated=false'))
978
- .toMatchUserAgent({
979
- name: 'Silk',
980
- version: new Version(2, 6),
981
- platform: 'Linux',
982
- platformVersion: new Version(),
983
- engine: 'AppleWebKit',
984
- engineVersion: new Version(535, 19),
985
- documentMode: undefined,
986
- browserInfo: {
987
- hasWebFontSupport: true,
988
- hasWebKitFallbackBug: true,
989
- hasWebKitMetricsBug: false
990
- }
991
- });
992
- });
993
-
994
- it('1st generation', function () {
995
- expect(parse('Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Silk/1.0.22.79_10013310) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Silk-Accelerated=false'))
996
- .toMatchUserAgent({
997
- name: 'Silk',
998
- version: new Version(1, 0, 22, '79_10013310'),
999
- platform: 'Android',
1000
- platformVersion: new Version(2, 3, 4),
1001
- engine: 'AppleWebKit',
1002
- engineVersion: new Version(533, 1),
1003
- documentMode: undefined,
1004
- browserInfo: {
1005
- hasWebFontSupport: true,
1006
- hasWebKitFallbackBug: true,
1007
- hasWebKitMetricsBug: false
1008
- }
1009
- });
1010
- });
1011
-
1012
- it('1st generation (Desktop mode)', function () {
1013
- expect(parse('Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.22.79_10013310) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=false'))
1014
- .toMatchUserAgent({
1015
- name: 'Silk',
1016
- version: new Version(1, 0, 22, '79_10013310'),
1017
- platform: 'Macintosh',
1018
- platformVersion: new Version(10, 6, 3),
1019
- engine: 'AppleWebKit',
1020
- engineVersion: new Version(533, 16),
1021
- documentMode: undefined,
1022
- browserInfo: {
1023
- hasWebFontSupport: true,
1024
- hasWebKitFallbackBug: true,
1025
- hasWebKitMetricsBug: true
1026
- }
1027
- });
1028
- });
1029
- });
1030
-
1031
- describe('Opera', function () {
1032
- it('should detect Opera', function () {
1033
- expect(parse('Opera/9.80 (Linux i686; U; en) Presto/2.5.22 Version/10.51'))
1034
- .toMatchUserAgent({
1035
- name: 'Opera',
1036
- version: new Version(10, 51),
1037
- platform: 'Linux',
1038
- platformVersion: new Version(), //'i686'
1039
- engine: 'Presto',
1040
- engineVersion: new Version(2, 5, 22),
1041
- documentMode: undefined,
1042
- browserInfo: {
1043
- hasWebFontSupport: true,
1044
- hasWebKitFallbackBug: false,
1045
- hasWebKitMetricsBug: false
1046
- }
1047
- });
1048
- });
1049
-
1050
- it('should detect Opera with Firefox in useragent', function () {
1051
- expect(parse('Mozilla/5.0 (Linux i686 ; U; en; rv:1.8.1) Gecko/20061208 Firefox/2.0.0 Opera 9.70'))
1052
- .toMatchUserAgent({
1053
- name: 'Opera',
1054
- version: new Version(9, 70),
1055
- platform: 'Linux',
1056
- platformVersion: new Version(), //'i686'
1057
- engine: 'Gecko',
1058
- engineVersion: new Version(1, 8, 1),
1059
- documentMode: undefined,
1060
- browserInfo: {
1061
- hasWebFontSupport: false,
1062
- hasWebKitFallbackBug: false,
1063
- hasWebKitMetricsBug: false
1064
- }
1065
- });
1066
- });
1067
-
1068
- it('should detect Opera before v10', function () {
1069
- expect(parse('Opera/9.64 (X11; Linux i686; U; Linux Mint; nb) Presto/2.1.1'))
1070
- .toMatchUserAgent({
1071
- name: 'Opera',
1072
- version: new Version(9, 64),
1073
- platform: 'Linux',
1074
- platformVersion: new Version(), //'i686'
1075
- engine: 'Presto',
1076
- engineVersion: new Version(2, 1, 1),
1077
- documentMode: undefined,
1078
- browserInfo: {
1079
- hasWebFontSupport: false,
1080
- hasWebKitFallbackBug: false,
1081
- hasWebKitMetricsBug: false
1082
- }
1083
- });
1084
- });
1085
-
1086
- it('should detect Opera Mobile on Android', function () {
1087
- expect(parse('Opera/9.80 (Android 4.1.1; Linux; Opera Mobi/ADR-1207201819; U; en) Presto/2.10.254 Version/12.00'))
1088
- .toMatchUserAgent({
1089
- name: 'Opera',
1090
- version: new Version(12, 0),
1091
- platform: 'Android',
1092
- platformVersion: new Version(4, 1, 1),
1093
- engine: 'Presto',
1094
- engineVersion: new Version(2, 10, 254),
1095
- documentMode: undefined,
1096
- browserInfo: {
1097
- hasWebFontSupport: true,
1098
- hasWebKitFallbackBug: false,
1099
- hasWebKitMetricsBug: false
1100
- }
1101
- });
1102
- });
1103
-
1104
- it('should detect Opera Mini on Android', function () {
1105
- expect(parse('Opera/9.80 (Android; Opera Mini/7.0.29952/28.2144; U; en) Presto/2.8.119 Version/11.10'))
1106
- .toMatchUserAgent({
1107
- name: 'OperaMini',
1108
- version: new Version(7, 0, 29952),
1109
- platform: 'Android',
1110
- platformVersion: new Version(),
1111
- engine: 'Presto',
1112
- engineVersion: new Version(2, 8, 119),
1113
- documentMode: undefined,
1114
- browserInfo: {
1115
- hasWebFontSupport: false,
1116
- hasWebKitFallbackBug: false,
1117
- hasWebKitMetricsBug: false
1118
- }
1119
- });
1120
- });
1121
-
1122
- it('should detect Opera Next (15)', function () {
1123
- expect(parse('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.20 Safari/537.36 OPR/15.0.1147.18 (Edition Next)'))
1124
- .toMatchUserAgent({
1125
- name: 'Opera',
1126
- version: new Version(15, 0, 1147, 18),
1127
- platform: 'Macintosh',
1128
- platformVersion: new Version(10, 8, 3),
1129
- engine: 'AppleWebKit',
1130
- engineVersion: new Version(537, 36),
1131
- documentMode: undefined,
1132
- browserInfo: {
1133
- hasWebFontSupport: true,
1134
- hasWebKitFallbackBug: false,
1135
- hasWebKitMetricsBug: true
1136
- }
1137
- });
1138
- });
1139
- });
1140
-
1141
- describe('WebKit fallback bug', function () {
1142
- it('should detect the bug in older browsers', function () {
1143
- expect(parse('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.9 Safari/536.5'))
1144
- .toMatchUserAgent({
1145
- name: 'Chrome',
1146
- version: new Version(19, 0, 1084, 9),
1147
- platform: 'Linux',
1148
- platformVersion: new Version(),
1149
- engine: 'AppleWebKit',
1150
- engineVersion: new Version(536, 5),
1151
- documentMode: undefined,
1152
- browserInfo: {
1153
- hasWebFontSupport: true,
1154
- hasWebKitFallbackBug: true,
1155
- hasWebKitMetricsBug: false
1156
- }
1157
- });
1158
- });
1159
-
1160
- it('should detect the bug in older browsers', function () {
1161
- expect(parse('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.814.2 Safari/536.11'))
1162
- .toMatchUserAgent({
1163
- name: 'Chrome',
1164
- version: new Version(20, 0, 814, 2),
1165
- platform: 'Linux',
1166
- platformVersion: new Version(),
1167
- engine: 'AppleWebKit',
1168
- engineVersion: new Version(536, 11),
1169
- documentMode: undefined,
1170
- browserInfo: {
1171
- hasWebFontSupport: true,
1172
- hasWebKitFallbackBug: false,
1173
- hasWebKitMetricsBug: false
1174
- }
1175
- });
1176
- });
1177
- });
1178
-
1179
- describe('Invented user agents', function () {
1180
- it('should detect unknown versions of Gecko as supporting web fonts', function () {
1181
- expect(parse('Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:2.5.8) Gecko/20091016 (.NET CLR 3.5.30729)'))
1182
- .toMatchUserAgent({
1183
- name: 'Mozilla',
1184
- version: new Version(),
1185
- platform: 'Windows',
1186
- platformVersion: new Version(5, 1),
1187
- engine: 'Gecko',
1188
- engineVersion: new Version(2, 5, 8),
1189
- documentMode: undefined,
1190
- browserInfo: {
1191
- hasWebFontSupport: true,
1192
- hasWebKitFallbackBug: false,
1193
- hasWebKitMetricsBug: false
1194
- }
1195
- });
1196
- });
1197
-
1198
- it('should detect Gecko with an invalid version number as not supporting web fonts', function () {
1199
- expect(parse('Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.b) Gecko/20091016 (.NET CLR 3.5.30729)'))
1200
- .toMatchUserAgent({
1201
- name: 'Mozilla',
1202
- version: new Version(),
1203
- platform: 'Windows',
1204
- platformVersion: new Version(5, 1),
1205
- engine: 'Gecko',
1206
- engineVersion: new Version(1, null, null, 'b'),
1207
- documentMode: undefined,
1208
- browserInfo: {
1209
- hasWebFontSupport: false,
1210
- hasWebKitFallbackBug: false,
1211
- hasWebKitMetricsBug: false
1212
- }
1213
- });
1214
-
1215
- expect(parse('Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.b) Gecko/20091016 (.NET CLR 3.5.30729)'))
1216
- .toMatchUserAgent({
1217
- name: 'Mozilla',
1218
- version: new Version(),
1219
- platform: 'Windows',
1220
- platformVersion: new Version(5, 1),
1221
- engine: 'Gecko',
1222
- engineVersion: new Version(1, null, null, 'b'),
1223
- documentMode: undefined,
1224
- browserInfo: {
1225
- hasWebFontSupport: false,
1226
- hasWebKitFallbackBug: false,
1227
- hasWebKitMetricsBug: false
1228
- }
1229
- });
1230
-
1231
- expect(parse('Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.9) Gecko/20091016 (.NET CLR 3.5.30729)'))
1232
- .toMatchUserAgent({
1233
- name: 'Mozilla',
1234
- version: new Version(),
1235
- platform: 'Windows',
1236
- platformVersion: new Version(5, 1),
1237
- engine: 'Gecko',
1238
- engineVersion: new Version(1, 9),
1239
- documentMode: undefined,
1240
- browserInfo: {
1241
- hasWebFontSupport: false,
1242
- hasWebKitFallbackBug: false,
1243
- hasWebKitMetricsBug: false
1244
- }
1245
- });
1246
-
1247
- expect(parse('Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:0.10.1) Gecko/20091016 (.NET CLR 3.5.30729)'))
1248
- .toMatchUserAgent({
1249
- name: 'Mozilla',
1250
- version: new Version(),
1251
- platform: 'Windows',
1252
- platformVersion: new Version(5, 1),
1253
- engine: 'Gecko',
1254
- engineVersion: new Version(0, 10, 1),
1255
- documentMode: undefined,
1256
- browserInfo: {
1257
- hasWebFontSupport: false,
1258
- hasWebKitFallbackBug: false,
1259
- hasWebKitMetricsBug: false
1260
- }
1261
- });
1262
-
1263
- expect(parse('Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:0.3.42) Gecko/20091016 (.NET CLR 3.5.30729)'))
1264
- .toMatchUserAgent({
1265
- name: 'Mozilla',
1266
- version: new Version(),
1267
- platform: 'Windows',
1268
- platformVersion: new Version(5, 1),
1269
- engine: 'Gecko',
1270
- engineVersion: new Version(0, 3, 42),
1271
- documentMode: undefined,
1272
- browserInfo: {
1273
- hasWebFontSupport: false,
1274
- hasWebKitFallbackBug: false,
1275
- hasWebKitMetricsBug: false
1276
- }
1277
- });
1278
- });
1279
- });
1280
-
1281
- describe('PhantomJS', function () {
1282
- it('should detect PhantomJS as having web font support', function () {
1283
- expect(parse('Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.0 (development) Safari/534.34'))
1284
- .toMatchUserAgent({
1285
- name: 'PhantomJS',
1286
- version: new Version(1, 9, 0),
1287
- platform: 'Macintosh',
1288
- platformVersion: new Version(),
1289
- engine: 'AppleWebKit',
1290
- engineVersion: new Version(534, 34),
1291
- documentMode: undefined,
1292
- browserInfo: {
1293
- hasWebFontSupport: true,
1294
- hasWebKitFallbackBug: true,
1295
- hasWebKitMetricsBug: true
1296
- }
1297
- });
1298
- });
1299
- });
1300
- });
1301
- });