Socket
Socket
Sign inDemoInstall

fontfaceobserver

Package Overview
Dependencies
2
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.17 to 1.5.0

21

fontfaceobserver.js

@@ -1,11 +0,12 @@

(function(){'use strict';function f(a){function b(){document.body?a():setTimeout(b,0)}b()};function h(a){this.a=document.createElement("div");this.a.setAttribute("aria-hidden","true");this.a.appendChild(document.createTextNode(a));this.b=document.createElement("span");this.c=document.createElement("span");this.h=document.createElement("span");this.g=document.createElement("span");this.f=-1;this.b.style.cssText="display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;";this.c.style.cssText="display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;";
(function(){'use strict';var f=[];function g(a){f.push(a);1===f.length&&l()}function m(){for(;f.length;)f[0](),f.shift()}if(window.MutationObserver){var n=document.createElement("div");(new MutationObserver(m)).observe(n,{attributes:!0});var l=function(){n.setAttribute("x",0)}}else l=function(){setTimeout(m)};function p(a){this.a=q;this.b=void 0;this.f=[];var b=this;try{a(function(a){r(b,a)},function(a){t(b,a)})}catch(c){t(b,c)}}var q=2;function u(a){return new p(function(b,c){c(a)})}function v(a){return new p(function(b){b(a)})}
function r(a,b){if(a.a===q){if(b===a)throw new TypeError("Promise settled with itself.");var c=!1;try{var d=b&&b.then;if(null!==b&&"object"===typeof b&&"function"===typeof d){d.call(b,function(b){c||r(a,b);c=!0},function(b){c||t(a,b);c=!0});return}}catch(e){c||t(a,e);return}a.a=0;a.b=b;w(a)}}function t(a,b){if(a.a===q){if(b===a)throw new TypeError("Promise settled with itself.");a.a=1;a.b=b;w(a)}}
function w(a){g(function(){if(a.a!==q)for(;a.f.length;){var b=a.f.shift(),c=b[0],d=b[1],e=b[2],b=b[3];try{0===a.a?"function"===typeof c?e(c.call(void 0,a.b)):e(a.b):1===a.a&&("function"===typeof d?e(d.call(void 0,a.b)):b(a.b))}catch(h){b(h)}}})}p.prototype.g=function(a){return this.c(void 0,a)};p.prototype.c=function(a,b){var c=this;return new p(function(d,e){c.f.push([a,b,d,e]);w(c)})};
function x(a){return new p(function(b,c){function d(c){return function(d){h[c]=d;e+=1;e===a.length&&b(h)}}var e=0,h=[];0===a.length&&b(h);for(var k=0;k<a.length;k+=1)a[k].c(d(k),c)})}function y(a){return new p(function(b,c){for(var d=0;d<a.length;d+=1)a[d].c(b,c)})};window.Promise||(window.Promise=p,window.Promise.resolve=v,window.Promise.reject=u,window.Promise.race=y,window.Promise.all=x,window.Promise.prototype.then=p.prototype.c,window.Promise.prototype["catch"]=p.prototype.g);}());
(function(){'use strict';function h(a){function b(){document.body?a():setTimeout(b,0)}b()};function v(a){this.a=document.createElement("div");this.a.setAttribute("aria-hidden","true");this.a.appendChild(document.createTextNode(a));this.b=document.createElement("span");this.c=document.createElement("span");this.h=document.createElement("span");this.g=document.createElement("span");this.f=-1;this.b.style.cssText="display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;";this.c.style.cssText="display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;";
this.g.style.cssText="display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;";this.h.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;";this.b.appendChild(this.h);this.c.appendChild(this.g);this.a.appendChild(this.b);this.a.appendChild(this.c)}
function p(a,b,c){a.a.style.cssText="min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;left:-999px;white-space:nowrap;font-size:100px;font-family:"+b+";"+c}function u(a){var b=a.a.offsetWidth,c=b+100;a.g.style.width=c+"px";a.c.scrollLeft=c;a.b.scrollLeft=a.b.scrollWidth+100;return a.f!==b?(a.f=b,!0):!1}
function v(a,b){a.b.addEventListener("scroll",function(){u(a)&&null!==a.a.parentNode&&b(a.f)},!1);a.c.addEventListener("scroll",function(){u(a)&&null!==a.a.parentNode&&b(a.f)},!1);u(a)};var A=[];function B(a){A.push(a);1===A.length&&C()}function D(){for(;A.length;)A[0](),A.shift()}if(window.MutationObserver){var E=document.createElement("div");(new MutationObserver(D)).observe(E,{attributes:!0});var C=function(){E.setAttribute("x",0)}}else C=function(){setTimeout(D)};function F(a){this.a=G;this.b=void 0;this.c=[];var b=this;try{a(function(a){b.resolve(a)},function(a){b.reject(a)})}catch(c){b.reject(c)}}var G=2;function H(a){return new F(function(b,c){c(a)})}function I(a){return new F(function(b){b(a)})}
F.prototype.resolve=function(a){var b=this;if(b.a===G){if(a===b)throw new TypeError("Promise settled with itself.");var c=!1;try{var e=a&&a.then;if(null!==a&&"object"===typeof a&&"function"===typeof e){e.call(a,function(a){c||b.resolve(a);c=!0},function(a){c||b.reject(a);c=!0});return}}catch(d){c||b.reject(d);return}b.a=0;b.b=a;J(b)}};F.prototype.reject=function(a){if(this.a===G){if(a===this)throw new TypeError("Promise settled with itself.");this.a=1;this.b=a;J(this)}};
function J(a){B(function(){if(a.a!==G)for(;a.c.length;){var b=a.c.shift(),c=b[0],e=b[1],d=b[2],b=b[3];try{0===a.a?"function"===typeof c?d(c.call(void 0,a.b)):d(a.b):1===a.a&&("function"===typeof e?d(e.call(void 0,a.b)):b(a.b))}catch(g){b(g)}}})}F.prototype.f=function(a){return this.then(void 0,a)};F.prototype.then=function(a,b){var c=this;return new F(function(e,d){c.c.push([a,b,e,d]);J(c)})};
function K(a){return new F(function(b,c){function e(c){return function(e){g[c]=e;d+=1;d===a.length&&b(g)}}var d=0,g=[];0===a.length&&b(g);for(var k=0;k<a.length;k+=1)a[k].then(e(k),c)})}function L(a){return new F(function(b,c){for(var e=0;e<a.length;e+=1)a[e].then(b,c)})}
if(window.Promise){var M=window.Promise;M.prototype.then=window.Promise.prototype.then;M.prototype["catch"]=window.Promise.prototype["catch"];M.all=window.Promise.all;M.race=window.Promise.race;M.resolve=window.Promise.resolve;M.reject=window.Promise.reject}else M=F,M.prototype.then=F.prototype.then,M.prototype["catch"]=F.prototype.f,M.all=K,M.race=L,M.resolve=I,M.reject=H;function N(a,b){var c=b||{};this.family=a;this.style=c.style||"normal";this.variant=c.variant||"normal";this.weight=c.weight||"normal";this.stretch=c.stretch||"stretch";this.featureSettings=c.featureSettings||"normal"}var O=null;
N.prototype.a=function(a,b){var c=a||"BESbswy",e=b||3E3,d="font-style:"+this.style+";font-variant:"+this.variant+";font-weight:"+this.weight+";font-stretch:"+this.stretch+";font-feature-settings:"+this.featureSettings+";-moz-font-feature-settings:"+this.featureSettings+";-webkit-font-feature-settings:"+this.featureSettings+";",g=document.createElement("div"),k=new h(c),q=new h(c),r=new h(c),l=-1,m=-1,n=-1,w=-1,x=-1,y=-1,t=this;return new M(function(a,b){function c(){null!==g.parentNode&&g.parentNode.removeChild(g)}
function z(){if(-1!==l&&-1!==m||-1!==l&&-1!==n||-1!==m&&-1!==n)if(l===m||l===n||m===n){if(null===O){var b=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);O=!!b&&(536>parseInt(b[1],10)||536===parseInt(b[1],10)&&11>=parseInt(b[2],10))}O?l===w&&m===w&&n===w||l===x&&m===x&&n===x||l===y&&m===y&&n===y||(c(),a(t)):(c(),a(t))}}f(function(){function a(){if(Date.now()-P>=e)c(),b(t);else{var d=document.hidden;if(!0===d||void 0===d)l=k.a.offsetWidth,m=q.a.offsetWidth,n=r.a.offsetWidth,
z();setTimeout(a,50)}}var P=Date.now();p(k,"sans-serif",d);p(q,"serif",d);p(r,"monospace",d);g.appendChild(k.a);g.appendChild(q.a);g.appendChild(r.a);document.body.appendChild(g);w=k.a.offsetWidth;x=q.a.offsetWidth;y=r.a.offsetWidth;a();v(k,function(a){l=a;z()});p(k,t.family+",sans-serif",d);v(q,function(a){m=a;z()});p(q,t.family+",serif",d);v(r,function(a){n=a;z()});p(r,t.family+",monospace",d)})})};window.FontFaceObserver=N;window.FontFaceObserver.prototype.check=N.prototype.a;}());
function w(a,b,c){a.a.style.cssText="min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;left:-999px;white-space:nowrap;font-size:100px;font-family:"+b+";"+c}function x(a){var b=a.a.offsetWidth,c=b+100;a.g.style.width=c+"px";a.c.scrollLeft=c;a.b.scrollLeft=a.b.scrollWidth+100;return a.f!==b?(a.f=b,!0):!1}
function y(a,b){a.b.addEventListener("scroll",function(){x(a)&&null!==a.a.parentNode&&b(a.f)},!1);a.c.addEventListener("scroll",function(){x(a)&&null!==a.a.parentNode&&b(a.f)},!1);x(a)};function z(a,b){var c=b||{};this.family=a;this.style=c.style||"normal";this.variant=c.variant||"normal";this.weight=c.weight||"normal";this.stretch=c.stretch||"stretch";this.featureSettings=c.featureSettings||"normal"}var B=null;
z.prototype.a=function(a,b){var c=a||"BESbswy",C=b||3E3,k="font-style:"+this.style+";font-variant:"+this.variant+";font-weight:"+this.weight+";font-stretch:"+this.stretch+";font-feature-settings:"+this.featureSettings+";-moz-font-feature-settings:"+this.featureSettings+";-webkit-font-feature-settings:"+this.featureSettings+";",g=document.createElement("div"),l=new v(c),m=new v(c),n=new v(c),d=-1,e=-1,f=-1,q=-1,r=-1,t=-1,p=this;return new Promise(function(a,b){function c(){null!==g.parentNode&&g.parentNode.removeChild(g)}
function u(){if(-1!==d&&-1!==e||-1!==d&&-1!==f||-1!==e&&-1!==f)if(d===e||d===f||e===f){if(null===B){var b=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);B=!!b&&(536>parseInt(b[1],10)||536===parseInt(b[1],10)&&11>=parseInt(b[2],10))}B?d===q&&e===q&&f===q||d===r&&e===r&&f===r||d===t&&e===t&&f===t||(c(),a(p)):(c(),a(p))}}h(function(){function a(){if(Date.now()-D>=C)c(),b(p);else{var A=document.hidden;if(!0===A||void 0===A)d=l.a.offsetWidth,e=m.a.offsetWidth,f=n.a.offsetWidth,
u();setTimeout(a,50)}}var D=Date.now();w(l,"sans-serif",k);w(m,"serif",k);w(n,"monospace",k);g.appendChild(l.a);g.appendChild(m.a);g.appendChild(n.a);document.body.appendChild(g);q=l.a.offsetWidth;r=m.a.offsetWidth;t=n.a.offsetWidth;a();y(l,function(a){d=a;u()});w(l,p.family+",sans-serif",k);y(m,function(a){e=a;u()});w(m,p.family+",serif",k);y(n,function(a){f=a;u()});w(n,p.family+",monospace",k)})})};window.FontFaceObserver=z;window.FontFaceObserver.prototype.check=z.prototype.a;}());

@@ -26,3 +26,3 @@ var extend = require('extend');

exec: {
deps: 'calcdeps -i src -i exports.js -p src -p ./vendor/google/base.js -p node_modules/promis/src/ -p node_modules/closure-dom/src/dom.js -o deps > test/deps.js'
deps: 'calcdeps -i src -i exports.js -p src -p ./vendor/google/base.js -p node_modules/closure-dom/src/dom.js -o deps > test/deps.js'
},

@@ -48,3 +48,3 @@ jshint: {

files: {
"fontfaceobserver.js": ['src/**/*.js', 'exports.js', 'node_modules/closure-dom/src/dom.js', 'node_modules/promis/src/**/*.js']
"fontfaceobserver.js": ['src/**/*.js', 'exports.js', 'node_modules/closure-dom/src/dom.js']
},

@@ -57,3 +57,3 @@ options: extend({}, compilerOptions, {

files: {
"build/fontfaceobserver.js": ['src/**/*.js', 'exports.js', 'node_modules/closure-dom/src/dom.js', 'node_modules/promis/src/**/*.js'],
"build/fontfaceobserver.js": ['src/**/*.js', 'exports.js', 'node_modules/closure-dom/src/dom.js'],
},

@@ -66,3 +66,3 @@ options: extend({}, compilerOptions, {

files: {
"build/fontfaceobserver.debug.js": ['src/**/*.js', 'exports.js', 'node_modules/closure-dom/src/dom.js', 'node_modules/promis/src/**/*.js']
"build/fontfaceobserver.debug.js": ['src/**/*.js', 'exports.js', 'node_modules/closure-dom/src/dom.js']
},

@@ -77,3 +77,3 @@ options: extend({}, compilerOptions, {

dist: {
src: ['build/fontfaceobserver.js'],
src: ['node_modules/promis/promise.js', 'build/fontfaceobserver.js'],
dest: 'fontfaceobserver.js'

@@ -80,0 +80,0 @@ }

{
"name": "fontfaceobserver",
"version": "1.4.17",
"version": "1.5.0",
"description": "Detect if web fonts are available",

@@ -22,3 +22,3 @@ "directories": {

"dependencies": {
"promis": "=1.0.8",
"promis": "=1.1.0",
"closure-dom": "=0.0.1"

@@ -25,0 +25,0 @@ },

@@ -5,7 +5,5 @@ goog.provide('fontface.Observer');

goog.require('dom');
goog.require('lang.Promise');
goog.scope(function () {
var Ruler = fontface.Ruler,
Promise = lang.Promise;
var Ruler = fontface.Ruler;

@@ -12,0 +10,0 @@ /**

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc