Using CreateElement for adding HTML #12907

Merged
merged 2 commits into from Jan 20, 2017

Projects

None yet

3 participants

@ShreyasSinha
Contributor
ShreyasSinha commented Jan 20, 2017 edited

#12764
Before submitting pull request, please check that every commit:

  • Has proper Signed-Off-By
  • Has commit message which describes it
  • Is needed on it's own, if you have just minor fixes to previous commits, you can squash them
  • Any new functionality is covered by tests
@codecov-io
codecov-io commented Jan 20, 2017 edited

Current coverage is 54.18% (diff: 100%)

Merging #12907 into master will not change coverage

@@             master     #12907   diff @@
==========================================
  Files           466        466          
  Lines         69619      69619          
  Methods        2126       2126          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits          37724      37724          
  Misses        31895      31895          
  Partials          0          0          

Powered by Codecov. Last update 3d056bc...ad0e0aa

@ShreyasSinha ShreyasSinha Using CreateElement for adding HTML
Signed-off-by: Shreyas Sinha <shreyas.sinha14@gmail.com>
756c655
js/functions.js
+ var version_information_message_link = document.createElement('a');
+ version_information_message_link.href = url;
+ version_information_message_link.class = 'disableAjax';
+ version_information_message_link.innerHTML = escapeHtml(data.version);
@nijel
nijel Jan 20, 2017 Member

I think it would be better to use text here to avoid need for escapeHtml....

js/functions.js
}
var $liPmaVersion = $('#li_pma_version');
$liPmaVersion.find('span.latest').remove();
- $liPmaVersion.append(version_information_message);
+ document.getElementById("li_pma_version").appendChild(version_information_message);
@nijel
nijel Jan 20, 2017 Member

Why getting element again, while we already have it as $liPmaVersion?

@nijel nijel self-assigned this Jan 20, 2017
@ShreyasSinha ShreyasSinha Requested Changes
Signed-off-by: Shreyas Sinha <shreyas.sinha14@gmail.com>
3c2c392
@nijel
nijel approved these changes Jan 20, 2017 View changes
@nijel nijel merged commit 278836e into phpmyadmin:master Jan 20, 2017

2 checks passed

Scrutinizer No new issues
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@nijel
Member
nijel commented Jan 20, 2017

Merged, thanks for your contribution!

@nijel nijel added this to the 4.7.0 milestone Jan 20, 2017
@ShreyasSinha ShreyasSinha deleted the ShreyasSinha:refactorcreateelement branch Jan 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment