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

Dropdown clickHandlerTypeError #114

Closed
KuroThing opened this issue Feb 13, 2017 · 10 comments
Closed

Dropdown clickHandlerTypeError #114

KuroThing opened this issue Feb 13, 2017 · 10 comments
Labels
bug critical issue

Comments

@KuroThing
Copy link

KuroThing commented Feb 13, 2017

When you click the the body element, this line of code produces this error: TypeError: eventTarget[parentNode][getAttribute] is not a function

Tested on v2.0.3 and v2.0.4 (Commit: cf981a6)

A (imo) dirty hack i found to solve this would be to do something like typeof eventTarget[parentNode] === HTMLDocument and if so, setting hasData to false.

Edit: It should be noted that this error occurs irrelevant of if the dropdown is open or not.

@thednp
Copy link
Owner

thednp commented Feb 13, 2017

Cannot reproduce. Do you have a screenshot?

@KuroThing
Copy link
Author

Using the Fixed Navbar Example for the v4 version of bootstrap, if you had a dropdown on that page and clicked under the div.container element, it would be clicking the body element directly. This is what re-produces the error.

The requested image with the area i'm talking about highlighted in a thin red border w/ some text in it.
image

Does that help?

@thednp
Copy link
Owner

thednp commented Feb 13, 2017

No. The script won't initialize if you inject it on the Bootstrap demo pages on the fly, you need to have it there when the DOM is parsed. This is something jQuery does, we don't do that, we do it the right way:

  • I downloaded the HTML file from source
  • I edited the file, added bootstrap.native CDN link and removed jQuery and it's Bootstrap plugins
  • Loaded the file in browser and it's working as expected, see the screenshot below.

bsn-dropdown-working-properly

@thednp thednp closed this as completed Feb 13, 2017
@thednp thednp added the invalid not related or critical label Feb 13, 2017
@KuroThing
Copy link
Author

I was providing an example using the bootstrap documentation, of course locally i'm including the script straight away, but rather then trying to giving you the segmented parts of my layout i figured using one of the examples from the bootstrap documentation.

If you click on the area below the div.container you'll get a TypeError. Modifying the v4 javascript file in dist to output eventTarget[parentNode] said it was a HTMLDocument.

Here, let me use your own sites documentation then.

Add an absurd height property to the body element, and scroll to the bottom of the page. Open the dev console and go to the inspect area, insure you are over the body element and click a few times. You'll get the error.

Here, have a screenshot of the errors, along with the body being highlighted
image

@thednp thednp added bug critical issue and removed invalid not related or critical labels Feb 13, 2017
@thednp thednp reopened this Feb 13, 2017
thednp added a commit that referenced this issue Feb 13, 2017
thednp added a commit that referenced this issue Feb 13, 2017
@thednp
Copy link
Owner

thednp commented Feb 13, 2017

Please download latest master and test. Thank you.

@thednp thednp closed this as completed Feb 13, 2017
@thednp
Copy link
Owner

thednp commented Feb 13, 2017

@KuroThing all good?

@rafaph
Copy link

rafaph commented Feb 13, 2017

Same here, using the master version solved the problem. Thanks guys!

@yurimdh
Copy link

yurimdh commented Jun 29, 2017

I'm still having this error. It can be reproduced doing what @KuroThing said above: in your own documentation (http://thednp.github.io/bootstrap.native), add an absurd height property to the body element, and scroll to the bottom of the page. Open the dev console and go to the inspect area, insure you are over the body element and click a few times. You'll get the error.

@thednp
Copy link
Owner

thednp commented Jun 29, 2017

OK now, please check the latest master, if we come clean, we publish the new version to the clouds right after.

@AustinBrunkhorst
Copy link

I'm using Aurelia with this library, which makes use of document fragments quite a bit. When a fragment is the parent node, this error occurs.

The latest push to master fixes the issue for me, @thednp. Cheers!

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

No branches or pull requests

5 participants