krambuhl / custom-event-polyfill Goto Github PK
View Code? Open in Web Editor NEWPolyfill for creating CustomEvents on IE9/10/11 if native implementation is missing.
License: MIT License
Polyfill for creating CustomEvents on IE9/10/11 if native implementation is missing.
License: MIT License
If you are interested in taking ownership of this github repo and the NPM module, please respond in this thread.
@kumarharsh you already have a good thing (https://github.com/kumarharsh/custom-event-polyfill), are you interested?
The typeof window.CustomEvent === 'function'
test returns false for Safari. This Safari bug incorrectly reports constructable types as "object" rather than "function", which causes the polyfill to override Safari's native support for the CustomEvent
constructor.
Another way to detect support for the constructor is to call it and trap any resulting errors. This would work around the bug in Safari.
function supported() {
try {
var event = new CustomEvent('test', {detail: 'supported'})
return event.detail === 'supported'
} catch (error) {
return false
}
}
“If it isn’t tested, it’s broken”
There are tests, but you're not running them anywhere and users can't be sure that the polyfill tests are passing. AppVeyor is the default solution for IE tests.
CustomEvent.prototype = window.Event.prototype;
in custom-event-polyfill\custom-event-polyfill.js:42
ReferenceError: window is not defined
Hi,
As CustomeEvent is not supported in IE11, so added polyfill from MDN and also tested this polyfill.
That is working fine in other browser(Chrome, Firefox) and even IE11 but it stops triggering/listening event after very specific steps. That is download a PDF and trigger "change" event.
Please check demo in IE11/Win7.
Steps to reproduce the bug:
1 - Download PDF
2 - Change Checkbox, it will call native "change" event but CustomEvent does not trigger.
NOTE: Open DevTool's console to visualize console.logs.
Again Demo URL - https://goo.gl/bYYRHf
Also reported this issue at Microsoft's community.
Kindly suggest alternative polyfill/solution/suggestion. Thanks
The polyfill test always fails and as a result the browser never uses the native implementation even when it is available.
The issue is with this code:
custom-event-polyfill/custom-event-polyfill.js
Lines 7 to 15 in 71749f0
Instead of
var ce = new window.CustomEvent('test');
is should be
var ce = new window.CustomEvent('test', {cancelable: true});
otherwise ce.defaultPrevented
always equals to false
and the error is always thrown.
master
branch failed. 🚨I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.
You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.
Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master
branch. You can also manually restart the failed CI job that runs semantic-release.
If you are not sure how to resolve this, here is some links that can help you:
If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.
semantic-release cannot push the version tag to the branch master
on remote Git repository.
Please refer to the authentication configuration documentation to configure the Git credentials on your CI environment.
Good luck with your project ✨
Your semantic-release bot 📦🚀
Would you accept a PR for bundling this for module usage? I'm thinking, particularly, plugging it into something like https://github.com/umdjs/umd/blob/master/returnExportsGlobal.js.
First, it's not "Useage".
Second, how should one use it?
I suppose something like this (should be in the readme):
require('custom-event-polyfill')
// or
import CustomEvent from 'custom-event-polyfill'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.