? Pending

User tests: Successful: Unsuccessful:

avatar Quy
Quy
6 Apr 2017

Summary of Changes

Don't output empty class attribute.

Testing Instructions

Edit an article.
Click on Permissions tab.
View page source.

Before:

emptyclass

After:

fixedclass

avatar Quy Quy - open - 6 Apr 2017
avatar Quy Quy - change - 6 Apr 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 6 Apr 2017
Category Libraries
avatar franz-wohlkoenig franz-wohlkoenig - test_item - 6 Apr 2017 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 6 Apr 2017

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.

avatar franz-wohlkoenig franz-wohlkoenig - change - 6 Apr 2017
Priority Medium Low
Easy No Yes
avatar brianteeman brianteeman - test_item - 6 Apr 2017 - Tested unsuccessfully
avatar brianteeman
brianteeman - comment - 6 Apr 2017

I have tested this item ? unsuccessfully on 98b070e

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 comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15122.

avatar C-Lodder
C-Lodder - comment - 6 Apr 2017

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"' : '';
avatar Quy
Quy - comment - 6 Apr 2017

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

avatar mbabker
mbabker - comment - 6 Apr 2017

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.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 13 Apr 2017

@Quy what to do with PR?

avatar Quy
Quy - comment - 13 Apr 2017

I would like it to be merged even though it doesn't address the issue Brian mentioned. I am okay either way.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 13 Apr 2017

one more Test and @rdeutz decide.

avatar brianteeman
brianteeman - comment - 13 Apr 2017

as it doesnt improve anything why merge it

avatar Quy Quy - change - 13 Apr 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-04-13 13:42:30
Closed_By Quy
Labels Added: ?
avatar Quy Quy - close - 13 Apr 2017
avatar mbabker
mbabker - comment - 13 Apr 2017

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.

avatar rdeutz rdeutz - change - 13 Apr 2017
Status Closed New
Closed_Date 2017-04-13 13:42:30
Closed_By Quy
avatar rdeutz rdeutz - change - 13 Apr 2017
Status New Pending
avatar rdeutz rdeutz - reopen - 13 Apr 2017
avatar C-Lodder
C-Lodder - comment - 13 Apr 2017

Having empty classes is pointless and simply adds additional bulk to the page. It may also have an impact when querying the DOM

avatar brianteeman
brianteeman - comment - 13 Apr 2017

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

avatar mbabker
mbabker - comment - 13 Apr 2017

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 ? ).

avatar Quy
Quy - comment - 18 Apr 2017

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.

avatar rdeutz rdeutz - change - 18 Apr 2017
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-04-18 06:41:34
Closed_By rdeutz
avatar rdeutz rdeutz - close - 18 Apr 2017
avatar rdeutz rdeutz - merge - 18 Apr 2017

Add a Comment

Login with GitHub to post a comment