X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=node_modules%2Fvideo.js%2Fes5%2Futils%2Fcomputed-style.js;fp=node_modules%2Fvideo.js%2Fes5%2Futils%2Fcomputed-style.js;h=3b881790bf3ffb618e8469f071e2b92bd6616d09;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/node_modules/video.js/es5/utils/computed-style.js b/node_modules/video.js/es5/utils/computed-style.js new file mode 100644 index 000000000..3b881790b --- /dev/null +++ b/node_modules/video.js/es5/utils/computed-style.js @@ -0,0 +1,42 @@ +'use strict'; + +exports.__esModule = true; +exports['default'] = computedStyle; + +var _window = require('global/window'); + +var _window2 = _interopRequireDefault(_window); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +/** + * A safe getComputedStyle with an IE8 fallback. + * + * This is needed because in Firefox, if the player is loaded in an iframe with + * `display:none`, then `getComputedStyle` returns `null`, so, we do a null-check to + * make sure that the player doesn't break in these cases. + * + * @param {Element} el + * The element you want the computed style of + * + * @param {string} prop + * The property name you want + * + * @see https://bugzilla.mozilla.org/show_bug.cgi?id=548397 + */ +function computedStyle(el, prop) { + if (!el || !prop) { + return ''; + } + + if (typeof _window2['default'].getComputedStyle === 'function') { + var cs = _window2['default'].getComputedStyle(el); + + return cs ? cs[prop] : ''; + } + + return el.currentStyle[prop] || ''; +} /** + * @file computed-style.js + * @module computed-style + */