polyfills

Show me a Javascript implementation of webkitConvertPointFromPageToNode

旧巷老猫 提交于 2019-12-07 10:22:19
问题 The webkitConvertPointFromPageToNode(in Node node, in WebKitPoint p) method is awesome; give it a DOM node and a point in page-coordinates (say, the mouse cursor position) and it will give a coordinate back to you in that node's local coordinate system. Unfortunately, it's currently only available in webkit. # Choose a node into which we'll map the mouse coordinates node = $('#subjectElement').get(0) handleMouseMove = (e) -> # Convert the mouse position to a Point mousePoint = new WebKitPoint

Vue 3 CLI - How to add babel polyfill for Object.entries

假如想象 提交于 2019-12-07 04:59:02
问题 I have a dependency (vue2-google-maps) which is causing issues with my Vue app in older browsers, throwing an error with Object.entries . Reading the Vue CLI Docs on polyfills, I see it mention trying to load the polyfill in babel.config.js . My babel.config.js : module.exports = { presets: [ ['@vue/app', { polyfills: [ 'es6.object' ] }] ] } Throws an error: Module build failed (from ./node_modules/babel-loader/lib/index.js): TypeError: [BABEL] /PROJECT_DIR/src/main.js: Cannot read property

Polyfill file input with accept capture (using getUserMedia to capture?)

二次信任 提交于 2019-12-07 03:30:35
问题 I want to enable image (& audio & video) uploads in a survey framework. To do so, input file is nearly sufficient for my purposes. On some mobile browsers <input type="file" accept="image/*;capture=camera"> is a really simple way of letting users choose to upload an existing image or to take a new one. Of course the UI for viewing and choosing among the pictures is provided too. Desktop browsers did not go this route. Instead, some pretty nice stuff seems to be possible using getUserMedia() .

Add polyfill code in Angular 2

ぐ巨炮叔叔 提交于 2019-12-07 01:44:59
问题 How would I add code of a polyfill in a Angular 2 cli-project? For example, I would like to use the following polyfill from Mozilla MDN: if (!Array.prototype.includes) { Object.defineProperty(Array.prototype, 'includes', { value: function(searchElement, fromIndex) { if (this == null) { throw new TypeError('"this" is null or not defined'); } var o = Object(this); var len = o.length >>> 0; if (len === 0) { return false; } var n = fromIndex | 0; var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0

Is there a polyfill for link download with data uri?

大城市里の小女人 提交于 2019-12-07 00:38:33
I have some code should be generated by the server: <a download="test.csv" href="data:text/plain;charset=utf-8;base64,w4FydsOtenTFsXLFkXTDvGvDtnJmw7p0w7Nnw6lwLg=="> teszt </a> It works with current chrome, firefox, opera. I'd like it to support MSIE11. Afaik msSaveBlob is the solution for that. Is there an existing js polyfill I could use, or should I write it? Okay I made a simple polyfill based on the code I found in SO answers and here . I tested it on MSIE11, it works. It does not support file download with XHR , just data URIs. I recommend to use the Content-Disposition response header

how can I use babel polyfill to support all IE11 issues with gulp

不问归期 提交于 2019-12-07 00:38:03
问题 I've been piecing together support for IE11 by adding plugins for transform-object-assign and array-includes and now I'm getting a symbol error for using for of loops. Instead of just tackling them one at a time, is it possible for me to work babel polyfill into my build below and future proof it? I've read several related questions but still am not clear on how I'd fit babel-polyfill into the gulp build below: return gulp.src(input) // Grab the input files .pipe($.babel({ presets: ['es2015']

Babel polyfill with webpack

99封情书 提交于 2019-12-06 06:11:35
问题 Do I need to include import "babel-polyfill" to the top of each entry file, or is it enough to have babel-polyfill rule just in webpack.config file? I am confused by polyfill docs and still getting following error: only one instance of babel-polyfill is allowed My webpack.config in short: entry1: ['babel-polyfill', 'homepage.js'], entry2: ['babel-polyfill', 'not-homepage.js'], entry3: ['babel-polyfill', 'contacts.js'] 回答1: You are getting the error because you are calling multiple instances

Conditionally load polyfills

╄→гoц情女王★ 提交于 2019-12-06 00:09:43
问题 I'm building a website which my target group is very general (ages 13-oo, so hello IE9, hello ancient android browser), so I need polyfills for some stuff (viewport, calc etc). Before I used Modernizr and some conditionals user agents to target IOS 6-7 etc. Then with yepnope.js I was loading the specific polyfills. Now that modernizr 3.0 is out, I noticed that the Modernizr.load() is deprecated. Also the yepnope.js library is deprecated. As they say on their website "There are new best

Why is ES7/array polyfill needed despite the tsconfig target is set to ES5

拈花ヽ惹草 提交于 2019-12-05 20:31:49
I have the following settings in the tsconfig.json . I added "es2017" to use Array.includes .: { "compilerOptions": { "lib": [ "es6", "es2017", "dom" ], "module": "es6", "target": "es5" } } Now, I realized, that I have to add import 'core-js/es7/array'; to the polyfills.ts , to use Array.includes also for the Internet Explorer 11. The target in the tsconfig.json is set to es5 , which does not have Array.includes . Why do I need to add the polyfill? TypeScript does not auto-polyfill code. The "official" reason from the relevant GitHub issue seems to be, as @RyanCavanaugh said : Having the

Show me a Javascript implementation of webkitConvertPointFromPageToNode

岁酱吖の 提交于 2019-12-05 12:03:13
The webkitConvertPointFromPageToNode(in Node node, in WebKitPoint p) method is awesome; give it a DOM node and a point in page-coordinates (say, the mouse cursor position) and it will give a coordinate back to you in that node's local coordinate system. Unfortunately, it's currently only available in webkit . # Choose a node into which we'll map the mouse coordinates node = $('#subjectElement').get(0) handleMouseMove = (e) -> # Convert the mouse position to a Point mousePoint = new WebKitPoint(e.pageX, e.pageY) # Convert the mouse point into node coordinates using WebKit nodeCoords =