-
Notifications
You must be signed in to change notification settings - Fork 2k
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
on-click doesn't work with bootstrap and jQuery #625
Comments
So Document does not have a getAttribute. That is the correct behavior. The question is whether we for some reason are returning a Document when we should return an Element or if this is an error in jQuery/Sizzle? |
This is the Sizzle.attr method that's failing:
It looks like it's getting the wrong type of element. The elem.nodeName when it crashes is #document -- that's a shadow DOM node, right? Why is getting that? I don't see this error on a page without polymer.js. It could be something strange about how bootstrap.js adds event handlers? I can hack around it by adding |
No, that is just a Document (like window.document). The parentNode of the The suspicious thing is that it gets here. Sizzle should never walk past the documentElement (the root element). |
I have errors with |
I found that |
I think it is not correct, because I've compared how bubbling works in Firefox without Platform, and it stops on |
Just made reproducible case: http://jsfiddle.net/0oekevob/ |
I found fix for this, nevertheless, it should be fixed in Polymer itself. $(document).on('event', 'element', func) to $('html').on('event', 'element', func) and obviously do not forget to rewrite |
what's the status here? |
I don't have the problem with jQuery 2.1.1... with me its when I include bootstrap 3.2.0 |
I'm using fix I mentioned before, also my pull request with similar fix was accepted in UIkit which I'm using instead of bootstrap, so, probably, it was fixed in bootstrap too, can't confirm that. |
I have the latest bootstrap and it doesn't work. I placed the bootstrap JS code inside the following function which fixes it:
The only thing is if I update bootstrap with bower, then I have to maintain it - which seems silly. Alternatively I loaded the |
Here is a workaround that does not require modifying bootstrap's source:
|
Is this issue related or the same issue as Bootstrap dropdowns and other interactive elements not working from within polymer components? @tuespetre 's workaround above either globally or within the component doesn't seem to affect the dropdowns from not working. |
Slight modification of @smasala's fix did it for me with webcomponents.js (v0.5.1). (function(document){
//bootstrap.js - bootstrap.min.js
})(wrap(document)); |
@martingust & @arv - Can we close this issue or do more code fixes need to be applied? |
@Nevraeka that is all I needed to do to get it to work. |
Closing. I've been told that there's no way for Polymer to wrap |
A tedious workaround I just used to get around this annoying problem was to call |
jQuery v2.0.3
Bootstrap v3.0.3
The on-click seems to be sending a wrapped object that causes problems when jQuery tries to look for other click handlers because it doesn't have a getAttribute method.
I have a custom element like this, on a page that includes Bootstrap and jQuery.
When I click it in Firefox 29, I get an error every time in Sizzle.attr = function( elem, name ): elem.getAttribute is not a function
elem is Document { impl=document, treeScope_={...}, documentElement=GeneratedWrapper, more...}
There is no elem.getAttribute method on Document. I thought the event handlers weren't supposed to see the wrapped elements?
Here's the stack trace:
I can reproduce it by adding Bootstrap and jQuery to the tutorial's index.html (after polymer.js); the on-click in post-card.html does the same thing.
The text was updated successfully, but these errors were encountered: