Closed dthorne closed 6 years ago
This would be awesome and save some trouble in such cases.
Thanks, but page.js is a generated file. Can you make the change in index.js instead?
@matthewp If the change is made to index.js will the generated page.js reflect that change?
@drewswaycool , yes it will reflect :)
@matthewp Thanks for looking at this. I think it should be good now.
@matthewp any updates?
Here's a temporary workaround for anyone who's currently blocked by this issue.
// TODO: Remove this once v1.8.5 of page.js is released!
// Throw this before any page.js logic is invoked.
if (!('path' in Event.prototype)) {
Object.defineProperty(Event.prototype, 'path', {
get: function() {
return this.composedPath ? this.composedPath() : [this.target];
}
});
}
Before falling back to e.target from e.path use e.composedPath. This allows the onclick handler to work for browsers using ShadyDom AND Polymer 2.
IF I use Polymer 2 and Page.js in FF or Safari then e.path doesn't exist because there is no ShadowDOM. e.target is the Top-most shadow DOM and is therefore not helpful.