-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[CODE STYLING] Fixes code styling in cms-uncompressed.js #16947
Conversation
container = container || document; | ||
|
||
var $showonFields = $(container).find('[data-showon]'); | ||
|
||
// Setup each 'showon' field | ||
for (var is = 0, ls = $showonFields.length; is < ls; is++) { | ||
// Use anonymous function to capture arguments | ||
(function () { | ||
(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't make functions within a loop.
showfield = false; | ||
} | ||
// OR operator: one of the previous and current conditions must be valid | ||
if (condition['op'] === 'OR' && condition['valid'] + jsondata[j-1]['valid'] > 0) | ||
{ | ||
if (condition['op'] === 'OR' && condition['valid'] + jsondata[j - 1]['valid'] > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
['op'] is better written in dot notation.
['valid'] is better written in dot notation.
// AND operator: both the previous and current conditions must be valid | ||
if (condition['op'] === 'AND' && condition['valid'] + jsondata[j-1]['valid'] < 2) | ||
{ | ||
if (condition['op'] === 'AND' && condition['valid'] + jsondata[j - 1]['valid'] < 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
['op'] is better written in dot notation.
['valid'] is better written in dot notation.
if (condition['valid'] === 0) | ||
{ | ||
if (condition['op'] === '') { | ||
if (condition['valid'] === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
['valid'] is better written in dot notation.
{ | ||
if (condition['valid'] === 0) | ||
{ | ||
if (condition['op'] === '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
['op'] is better written in dot notation.
jsondata[j]['valid'] = 1; | ||
} | ||
// "!:" Not equal to one or more of the values condition | ||
if (jsondata[j]['sign'] == '!=' && jsondata[j]['values'].indexOf(itemval[i]) === -1) | ||
{ | ||
if (jsondata[j]['sign'] == '!=' && jsondata[j]['values'].indexOf(itemval[i]) === -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
['sign'] is better written in dot notation.
['values'] is better written in dot notation.
// ":" Equal to one or more of the values condition | ||
if (jsondata[j]['sign'] == '=' && jsondata[j]['values'].indexOf(itemval[i]) !== -1) | ||
{ | ||
if (jsondata[j]['sign'] == '=' && jsondata[j]['values'].indexOf(itemval[i]) !== -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
['sign'] is better written in dot notation.
['values'] is better written in dot notation.
} | ||
|
||
// Convert to array to allow multiple values in the field (e.g. type=list multiple) | ||
// and normalize as string | ||
if (!(typeof itemval === 'object')) | ||
{ | ||
if (!(typeof itemval === 'object')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confusing use of '!'.
itemval = []; | ||
} | ||
// a multi-select <select> $field will return null when no elements are selected so we need to define itemval accordingly | ||
if (itemval == null && $field.prop("tagName").toLowerCase() == "select") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use '===' to compare with 'null'.
RTC on review for 3.7.4 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16947. |
Are the comments of the Hound CI valid ones or will they be ignored? |
None of the issues are introduced with this PR. They're all existing so for the purposes of this PR it's all good. In the long run it should be cleaned up though |
I'll do a cleanup of some of these (dot notation, confusing '!') after this PR is merged. |
@C-Lodder do you think you could do a Hound configuration for 3.x since it seems that's running on all PRs and not just 4.0? |
Sure will do |
This needs a test |
Code styling fixes don't need tests. |
So it is only cosmetic ;-) Merged |
This reverts commit 4f94056.
Fixes code styling in
cms-uncompressed.js