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

Refactoring init.js of Designer #15338

Merged
merged 1 commit into from Jun 18, 2019

Conversation

Projects
None yet
5 participants
@Bournvita1998
Copy link
Contributor

commented Jun 17, 2019

Signed-off-by: Bournvita1998 mohit.kuri@research.iiit.ac.in

Description

Refactoring in the init.js of the designer section

Fixes #

Before submitting pull request, please review the following checklist:

  • Make sure you have read our CONTRIBUTING.md document.
  • Make sure you are making a pull request against the correct branch. For example, for bug fixes in a released version use the corresponding QA branch and for new features use the master branch. If you have a doubt, you can ask as a comment in the bug report or on the mailing list.
  • Every commit has proper Signed-off-by line as described in our DCO. This ensures that the work you're submitting is your own creation.
  • Every commit has a descriptive commit message.
  • Every commit is needed on its own, if you have just minor fixes to previous commits, you can squash them.
  • Any new functionality is covered by tests.
Refactoring init.js of Designer
Signed-off-by: Bournvita1998 <mohit.kuri@research.iiit.ac.in>
@shucon

shucon approved these changes Jun 17, 2019

@ibennetch ibennetch merged commit 0509497 into phpmyadmin:gsoc-db-designer Jun 18, 2019

2 of 3 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
Codacy/PR Quality Review Up to standards. A positive pull request.
Details
DCO DCO
Details
@ibennetch

This comment has been minimized.

Copy link
Member

commented Jun 18, 2019

Good job.

@@ -54,22 +54,22 @@ AJAX.registerOnload('designer/init.js', function () {
}

$('#query_Aggregate_Button').on('click', function () {
document.getElementById('query_Aggregate').style.display = 'none';
$('#query_Aggregate').style.display = 'none';

This comment has been minimized.

Copy link
@devenbansod

devenbansod Jun 18, 2019

Member

@Bournvita1998 shouldn't we be using $("#id").css("display", "none"); or $("#id").hide(); here?

This comment has been minimized.

Copy link
@Bournvita1998

Bournvita1998 Jun 28, 2019

Author Contributor

@devenbansod I didn't find a good article comparing the difference between these 3. I know they all does the same job but no idea what's the difference. Can you help me knowing the difference between them?

This comment has been minimized.

Copy link
@Bournvita1998

Bournvita1998 Jul 1, 2019

Author Contributor

@devenbansod, for now, I am thinking of moving ahead making the changes in a similar way as I have done here. If required, we will change them again.

This comment has been minimized.

Copy link
@devenbansod

devenbansod Jul 1, 2019

Member

@Bournvita1998 have you tested this in the browser?

AFAIK, $('selector') returns an array-like JQuery-native object and doesn't return a native DOM element. So if I'm not mistaken, this code change would throw an error: Uncaught TypeError: Cannot set property 'display' of undefined in the console.

Ref for the css API: https://api.jquery.com/css/

This comment has been minimized.

Copy link
@Bournvita1998

Bournvita1998 Jul 4, 2019

Author Contributor

@devenbansod Yeah you are right here. $('selector') will return an array of all possible matches but document.getElementById('ID') returns just the first match it finds. To resolve this error we can either do the things as you suggested in your first comment or we can change $('selector') to $('selector')[0]. I found this on stackoverflow explaining the difference between jQuery object and DOM elements.

Also, I found the same issue in my previously created PRs too, which need to be changed soon. I am thinking of replacing them using the css format like: $("#id").css("display", "none"); is that fine to move ahead?

This comment has been minimized.

Copy link
@devenbansod

devenbansod Jul 7, 2019

Member

Sure, please go ahead 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.