Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix carousel "load" event bound without any namespace #22079

Closed
wants to merge 1 commit into from

Conversation

futpib
Copy link

@futpib futpib commented Feb 27, 2017

I was trying to do something like this

$(window)
	.off('load.bs.carousel.data-api')
	.on('load.bs.carousel.data-api', function () {
		// something custom
	});

And it did not work because the 'load' event was bound without usual bootstrap carousel data-API namespaces.

@Johann-S
Copy link
Member

It's because Carousel do not have a load event, here Carousel plugin only listen to the load Event of the Window that's all

@futpib
Copy link
Author

futpib commented Feb 27, 2017

@Johann-S Sorry, I don't really understand your comment. Yes, it's the 'load' event on window. It is bound by bootstrap carousel as part of implementation of bootstrap data attribute API. All other data attribute API related events are namespaced accordingly, except this one. I think it should be namespaced as well. PR description provides motivational example.

@Johann-S
Copy link
Member

Johann-S commented Feb 27, 2017

Only Bootstrap Events (events triggered by Bootstrap's Plugins) are prefixed.

For me this event is just for the internal workflow of this plugin so it's not relevant to add a prefix for this event.

Anyway support for v3 has mostly ceased. See : #20631

@bardiharborow
Copy link
Member

The load event is generated by the browser, not Bootstrap. Our code simply listens for it. It should not be namespaced. If you are simply trying to override that particular function, then you'll need to modify the Bootstrap code. I can't think of a good way of dynamically overriding it.

@futpib
Copy link
Author

futpib commented Mar 4, 2017

Well, that sucks.

Weather event is generated by the browser or not says nothing about if it should be namespaced. load.bs.scrollspy.data-api is also namespaced and is also generated by the browser, same goes for click.bs.collapse.data-api and a bunch of other events. v4 also namespaces all events, including load and whatever, despite them being generated by the browser.

I can thing of a perfectly good way of dynamically overriding it, it's shown in the original post (the off + on thing). Actually v3 docs advertise that you can disable data API features by doing .off('.bs.data-api'), so one could argue that this is a bugfix (can't find the exact page that says that right now, since http://getbootstrap.com/ is down for me for some reason).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants