User tests: Successful: Unsuccessful:
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Priority | Medium | ⇒ | Low |
Easy | No | ⇒ | Yes |
I have tested this item
This might appear to work but it doesnt. As soon as you click on a new userlevel (eg manager) the class=active is added to that li but the previous userlevel is left with an empty class - just as before
This:
// Initial Active Tab
$active = '';
if ((int) $group->value === 1)
{
$active = ' class="active"';
}
can be replaced with this:
// Initial Active Tab
$active = (int) $group->value === 1 ? ' class="active"' : '';
@brianteeman You are right! I don't know how to fix it with the ajax call. Hopefully someone else can assist with this. In the meantime, I still think this can be merged for the simplify code and the initial state of 1 active class and no empty classes.
Personally, I wouldn't worry about the empty class attribute in the DOM after the page is loaded. I don't know how native JavaScript handles it, but jQuery's removeClass doesn't remove an empty class attribute so you'd have to explicitly check for an empty class attribute and remove it in the JavaScript functions altering the class attribute. Not worth it to me.
I would like it to be merged even though it doesn't address the issue Brian mentioned. I am okay either way.
as it doesnt improve anything why merge it
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-04-13 13:42:30 |
Closed_By | ⇒ | Quy | |
Labels |
Added:
?
|
It improves the HTML response. Empty attributes after the DOM is loaded/manipulated is another issue altogether and as I hinted at probably involves changing core JavaScript behaviors.
Status | Closed | ⇒ | New |
Closed_Date | 2017-04-13 13:42:30 | ⇒ | |
Closed_By | Quy | ⇒ |
Status | New | ⇒ | Pending |
Having empty classes is pointless and simply adds additional bulk to the page. It may also have an impact when querying the DOM
My point was that while this PR correctly removes the empty class on page load it does not stop further emtpy classes being created as soon as you click on a tab. So while I agree there is a bug to fix I dont see that this resolves the bug - my 2c
For that you'd have to get at least jQuery and the various browsers to change their behaviors. I used https://gist.github.com/mbabker/d7c3228a6ee6a96d0e90b382a48794e7 as a testing pad, nothing that removes a class from the DOM also removes an empty attribute (using "current" practices or library versions, I'm sure @dgt41 will tell me I'm doing it wrong
I see this as 2 parts/steps. This PR addresses part 1 with the initial page load of empty class attributes. Part 2 which Brian raised deals with the creation of empty class attributes when interacting with the Permissions tab. I assume that changing permissions is not done very often, therefore, I propose merging part 1 now and addressing part 2 later in a separate PR.
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-04-18 06:41:34 |
Closed_By | ⇒ | rdeutz |
I have tested this item✅ successfully on 98b070e
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15122.