1/*! 2 * viewport-units-buggyfill.hacks v0.6.2 3 * @web: https://github.com/rodneyrehm/viewport-units-buggyfill/ 4 * @author: Zoltan Hawryluk - http://www.useragentman.com/ 5 */ 6 7(function() { 8 (function(root, factory) { 9 'use strict'; 10 if (typeof define === 'function' && define.amd) { 11 // AMD. Register as an anonymous module. 12 define([], factory); 13 } else if (typeof exports === 'object') { 14 // Node. Does not work with strict CommonJS, but 15 // only CommonJS-like enviroments that support module.exports, 16 // like Node. 17 module.exports = factory(); 18 } else { 19 // Browser globals (root is window) 20 root.viewportUnitsBuggyfillHacks = factory(); 21 } 22 }(this, function() { 23 'use strict'; 24 25 var calcExpression = /calc\(/g; 26 var quoteExpression = /["']/g; 27 var userAgent = window.navigator.userAgent; 28 var isBuggyIE = /MSIE [0-9]\./i.test(userAgent); 29 30 // added check for IE10, IE11 and Edge < 20, since it *still* doesn't understand vmax 31 // http://caniuse.com/#feat=viewport-units 32 if (!isBuggyIE) { 33 isBuggyIE = !!navigator.userAgent.match(/MSIE 10\.|Trident.*rv[ :]*1[01]\.| Edge\/1\d\./); 34 } 35 36 // iOS SAFARI, IE9, or Stock Android: abuse "content" if "viewport-units-buggyfill" specified 37 function checkHacks(declarations, rule, name, value) { 38 var needsHack = name === 'content' && value.indexOf('viewport-units-buggyfill') > -1; 39 if (!needsHack) { 40 return; 41 } 42 43 var fakeRules = value.replace(quoteExpression, ''); 44 fakeRules.split(';').forEach(function(fakeRuleElement) { 45 var fakeRule = fakeRuleElement.split(':'); 46 if (fakeRule.length !== 2) { 47 return; 48 } 49 50 var name = fakeRule[0].trim(); 51 if (name === 'viewport-units-buggyfill') { 52 return; 53 } 54 55 var value = fakeRule[1].trim(); 56 declarations.push([rule, name, value]); 57 if (calcExpression.test(value)) { 58 var webkitValue = value.replace(calcExpression, '-webkit-calc('); 59 declarations.push([rule, name, webkitValue]); 60 } 61 }); 62 } 63 64 return { 65 required: function(options) { 66 return options.isMobileSafari || isBuggyIE; 67 }, 68 69 initialize: function() {}, 70 71 initializeEvents: function(options, refresh, _refresh) { 72 if (options.force) { 73 return; 74 } 75 76 if (isBuggyIE && !options._listeningToResize) { 77 window.addEventListener('resize', _refresh, true); 78 options._listeningToResize = true; 79 } 80 }, 81 82 findDeclarations: function(declarations, rule, name, value) { 83 if (name === null) { 84 // KeyframesRule does not have a CSS-PropertyName 85 return; 86 } 87 88 checkHacks(declarations, rule, name, value); 89 }, 90 91 overwriteDeclaration: function(rule, name, _value) { 92 if (isBuggyIE && name === 'filter') { 93 // remove unit "px" from complex value, e.g.: 94 // filter: progid:DXImageTransform.Microsoft.DropShadow(OffX=5.4px, OffY=3.9px, Color=#000000); 95 _value = _value.replace(/px/g, ''); 96 } 97 98 return _value; 99 }, 100 }; 101 })); 102})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.