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

[CLOSED] Wrong parameter suggestions for JavaScript DOM Function #10496

Open
core-ai-bot opened this issue Aug 30, 2021 · 12 comments
Open

[CLOSED] Wrong parameter suggestions for JavaScript DOM Function #10496

core-ai-bot opened this issue Aug 30, 2021 · 12 comments

Comments

@core-ai-bot
Copy link
Member

Issue by 1405570455
Monday Feb 15, 2016 at 04:26 GMT
Originally opened as adobe/brackets#12212


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.

@core-ai-bot
Copy link
Member Author

Comment by petetnt
Monday Feb 15, 2016 at 21:01 GMT


I can confirm, as can #12216. It is there on

https://github.com/ternjs/tern/blob/7606a6448a8f7a2aacd50d10d9752440689803e8/defs/browser.json#L366

and

https://github.com/ternjs/tern/blob/master/defs/browser.json#L1278

though. Weird.

edit: It also works on the demo: http://ternjs.net/doc/demo/#simple

@core-ai-bot
Copy link
Member Author

Comment by 1405570455
Tuesday Feb 16, 2016 at 01:10 GMT


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.

@core-ai-bot
Copy link
Member Author

Comment by petetnt
Tuesday Feb 16, 2016 at 06:46 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by busykai
Thursday Feb 18, 2016 at 01:26 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by petetnt
Thursday Feb 18, 2016 at 06:58 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by busykai
Thursday Feb 18, 2016 at 16:00 GMT


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!

@core-ai-bot
Copy link
Member Author

Comment by busykai
Thursday Feb 18, 2016 at 18:27 GMT


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.

@core-ai-bot
Copy link
Member Author

Comment by petetnt
Thursday Feb 18, 2016 at 19:14 GMT


@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.

@core-ai-bot
Copy link
Member Author

Comment by MiguelCastillo
Thursday Feb 18, 2016 at 21:03 GMT


@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.

@core-ai-bot
Copy link
Member Author

Comment by petetnt
Thursday Feb 18, 2016 at 21:06 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by busykai
Friday Feb 19, 2016 at 00:27 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by MarcelGerber
Friday Aug 26, 2016 at 13:32 GMT


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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant