Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Wrong parameter suggestions for JavaScript DOM Function #12212

Closed
ghost opened this issue Feb 15, 2016 · 12 comments
Closed

Wrong parameter suggestions for JavaScript DOM Function #12212

ghost opened this issue Feb 15, 2016 · 12 comments

Comments

@ghost
Copy link

ghost commented Feb 15, 2016

As I was coding, I realized that unlike document.getElementsByTagName, when I type in document.getElementsByClassName it is suggested not as a function (as it should), but as a method (like .toLowerCase).

Also, if I ignore the suggestion and keep typing it, brackets recognizes it as the method and proceeds to tell me there are no parameters (when there should be a string 'name').

Here are links to Mozilla's documentation on the document.getElementByClassName:
click here.

If this is truly an issue, the fix probably won't take that long. Thank you.

@petetnt
Copy link
Collaborator

petetnt commented Feb 15, 2016

@ghost
Copy link
Author

ghost commented Feb 16, 2016

Yes the two JSON files you linked to showed it properly implemented. I compared it to the document.getElementsByTagName function, and I did notice while they were both declared as part of the giant prototype section of the JSON, our troubled function, document.getElementsByClassName was also referenced down on line 1278 which leads me to believe the error has something to do with bracket's interpretation of that reference (that similar functions did not have). My best guess is it has to do with brackets 'reading' (for lack of better term) that function differently. Thanks for looking into this issue.

@petetnt
Copy link
Collaborator

petetnt commented Feb 16, 2016

@tjgerot I was thinking the same, but then again querySelector and querySelectorAll work as intended.

@busykai
Copy link
Contributor

busykai commented Feb 18, 2016

It works for me, guys. Do you have any related extensions, such as ternific, installed?

@petetnt
Copy link
Collaborator

petetnt commented Feb 18, 2016

@busykai I can replicate it without using any extensions too. I'm on Release 1.7 development build 1.7.0-0 (master 01737d2a7).

@busykai
Copy link
Contributor

busykai commented Feb 18, 2016

Nope, I was wrong. It does not work for me. I was trying `document.getElementsByTagName' instead. I'll have to look at what happens with our tern. Next week, perhaps. Thanks @tjgerot for reporting this!

@busykai
Copy link
Contributor

busykai commented Feb 18, 2016

Oh, it's been fixed in tern. Our version hasn't been synced for over a year now. We're ternjs/tern@7606a64, so we don't have it. We need to update it.

@petetnt
Copy link
Collaborator

petetnt commented Feb 18, 2016

@busykai cool 👍

I tried to update tern and acorn around a week ago but ran into troubles with acorn, is the package is now browserified which didn't play very nicely with ´requirejs` for some reason. I didn't spend much time with it and it did work on my npm'd version of Brackets in december though so it shouldn't be too hard to figure out when given some more thought.

@MiguelCastillo
Copy link
Contributor

@busykai we have a PR for bringing latest tern... I will take a look tonight to try to merge it soon. I have neglected @marcelgerber on that PR.

@petetnt
Copy link
Collaborator

petetnt commented Feb 18, 2016

Oh yeah, totally forgot about the PR. #11569. It's up-to-date too.

@busykai
Copy link
Contributor

busykai commented Feb 19, 2016

Thanks @MiguelCastillo! Merging that will fix this issue. I'll look into that PR as well.

@marcelgerber
Copy link
Contributor

This is fixed with the merge of #11569 and will come to you in Release 1.8.
Please let us know if it still doesn't work for you when the Release ships.

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

No branches or pull requests

4 participants