#12260 closed defect (fixed)
Ticket Show property changes preference has no effect
Reported by: | Ryan J Ollos | Owned by: | Peter Suter |
---|---|---|---|
Priority: | normal | Milestone: | 1.2 |
Component: | general | Version: | |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: |
Fixed regression in Show property changes preference on ticket page, after upgrade to jQuery 1.11.3 (#11019). |
||
API Changes: | |||
Internal Changes: |
Description
The checkbox does not seem to be working on t.e.o (Trac 1.2dev), but it functions correctly on the other Edgewall Trac sites, which run Trac 1.0.9.
I haven't tested whether the problem is reproducible with a clean install of 1.2dev.
Attachments (0)
Change History (10)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Works for me in Firefox, but not in Chrome.
showPropertyChanges.attr('checked') seems to always be "checked"
in Chrome. Maybe showPropertyChanges.prop('checked')
should be used instead?
(Strange that it works with Trac 1.0.9 though.)
comment:3 by , 9 years ago
Milestone: | → 1.2 |
---|---|
Owner: | set to |
Status: | new → assigned |
I see the issue with Chrome 47 and Firefox 42 on Mac OSX. I can reproduce on the trunk, but not on 1.0-stable. The difference in behavior is probably due to the upgrade of the jQuery libraries in #11019.
The proposed fix works well and makes sense to me. I'll push the change in a day or so if there is no other feedback. Thanks!
comment:4 by , 9 years ago
(Ah, probably it only "worked" for me because I still had the old jQuery cached in Firefox.)
.attr() versus .prop() is also mentioned in the jQuery upgrade guide linked in #11019.
comment:5 by , 9 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Fixed in [14372].
comment:6 by , 9 years ago
Owner: | changed from | to
---|
comment:7 by , 9 years ago
It seems that line 34 and 96 have the same issue.
$ grep -n '\.attr(.checked' trac/htdocs/js/*.js trac/htdocs/js/threaded_comments.js:34: var showPropertyChangesChecked = showPropertyChanges.attr('checked'); trac/htdocs/js/threaded_comments.js:36: showPropertyChanges.attr("checked", false); trac/htdocs/js/threaded_comments.js:56: showPropertyChanges.attr("checked", true); trac/htdocs/js/threaded_comments.js:78: .attr('checked', 'checked'); trac/htdocs/js/threaded_comments.js:90: showPropertyChanges.attr('checked', comments_prefs.comments_only == 'false'); trac/htdocs/js/threaded_comments.js:96: ticket_comments_only: !showPropertyChanges.attr('checked'),
comment:8 by , 9 years ago
Thanks for catching that. There is still an issue that the Show property changes state is not preserved when switching between Oldest first and Newest first. For handling checked
, we should just change all attr
to prop
?
-
trac/htdocs/js/threaded_comments.js
diff --git a/trac/htdocs/js/threaded_comments.js b/trac/htdocs/js/threaded_comments.js index 03bd1db..f5fa774 100644
a b jQuery(document).ready(function($){ 31 31 }; 32 32 33 33 var applyOrder = function() { 34 var showPropertyChangesChecked = showPropertyChanges. attr('checked');34 var showPropertyChangesChecked = showPropertyChanges.prop('checked'); 35 35 if (showPropertyChangesChecked) { 36 showPropertyChanges. attr("checked", false);36 showPropertyChanges.prop("checked", false); 37 37 applyShowPropertyChanges(); 38 38 } 39 39 order = $("input[name='trac-comments-order']:checked").val(); … … jQuery(document).ready(function($){ 53 53 }); 54 54 } 55 55 if (showPropertyChangesChecked) { 56 showPropertyChanges. attr("checked", true);56 showPropertyChanges.prop("checked", true); 57 57 applyShowPropertyChanges(); 58 58 } 59 59 }; … … jQuery(document).ready(function($){ 75 75 76 76 $("input[name='trac-comments-order']") 77 77 .filter("[value=" + comments_prefs.comments_order + "]") 78 . attr('checked', 'checked');78 .prop('checked', true); 79 79 applyOrder(); 80 80 $("input[name='trac-comments-order']").change(function() { 81 81 unapplyOrder(); … … jQuery(document).ready(function($){ 87 87 }, dataType: 'text' }); 88 88 }); 89 89 90 showPropertyChanges. attr('checked', comments_prefs.comments_only == 'false');90 showPropertyChanges.prop('checked', comments_prefs.comments_only == 'false'); 91 91 applyShowPropertyChanges(); 92 92 showPropertyChanges.click(function() { 93 93 applyShowPropertyChanges(); 94 94 $.ajax({ url: form.attr('action'), type: 'POST', data: { 95 95 save_prefs: true, 96 ticket_comments_only: !showPropertyChanges. attr('checked'),96 ticket_comments_only: !showPropertyChanges.prop('checked'), 97 97 __FORM_TOKEN: form_token 98 98 }, dataType: 'text' }); 99 99 });
comment:9 by , 9 years ago
comment:10 by , 9 years ago
Summary: | The Show Property Changes checkbox has no effect on t.e.o → Ticket Show property changes preference has no effect |
---|
Also, I don't see any errors in the browser console.