bliss icon indicating copy to clipboard operation
bliss copied to clipboard

Add option in Bliss.full to exclude addEventListener hijacking

Open nevf opened this issue 8 years ago • 5 comments

I'm stuck with using jQuery and would still like to use the _ property on elements and arrays, However if I use Bliss Full I'm running into various issues with addEventListener etc. hijacking.

One way to resolve this is to add a new option: Bliss.NoHijack and wrap if ( !Bliss.NoHijack ){...} around the addEventListener and removeEventListener hijack code. And use <script>self.Bliss = { NoHijack: true };</script> in the html file before bliss loads.

nevf avatar Feb 25 '16 05:02 nevf

We need to think a bit more about the name, but I like the idea.

LeaVerou avatar Feb 25 '16 05:02 LeaVerou

One problem is that it's not enough to add the option and wrap the hijacking with a conditional. The parts that assume hijacking around the code would also need to change (mainly the event-related functions, e.g. unbind).

LeaVerou avatar Feb 25 '16 05:02 LeaVerou

@LeaVerou I've diff'd bliss.shy.js and bliss.js and can't see any difference except the additional code at the end if bliss.js. In other words I can't see any code in unbind() that knows about the hijacking code.

nevf avatar Feb 25 '16 06:02 nevf

Yes, because those parts in Bliss Shy are there regardless, and check if the _ property is available before executing. Eventually they should be moved to Bliss Full and use hooks. Any code that uses this._.bliss.listeners depends on the hijacking.

LeaVerou avatar Feb 25 '16 07:02 LeaVerou

@LeaVerou Ok I understand now. For my use case I can avoid using event() and ``unbind()` as I already have this functionality in code I've written.

That said I can't see that event() add's anything to listeners and if I'm right unbind() won't be affected. ie. It is only the hook functions that add/remove listeners items.

nevf avatar Feb 25 '16 21:02 nevf