bliss
bliss copied to clipboard
Add option in Bliss.full to exclude addEventListener hijacking
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.
We need to think a bit more about the name, but I like the idea.
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 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.
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 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.