Opened 4 years ago
Closed 4 years ago
#13954 closed defect (wontfix)
back-links section appears twice
Reported by: | clemens | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Component: | TracBackLinkPlugin |
Severity: | trivial | Keywords: | patch |
Cc: | Trac Release: | 1.4 |
Description
The TracBackLinkPlugin (revision r17971) appears twice if the HTML file is saved to local file.
Background
This is a minor issue with Java-Script code which inserts HTML elements (such as the TracBackLinkPlugin section) into the DOM. If you use your browser to save the final HTML page to a file, then when viewing the produced HTML file the affected HTML fragment (TracBackLinkPlugin section) appears twice:
- as static HTML as written by the browser
- as dynamically (Java-Script) created HTML.
Of course this issue is not very critical. But sometimes people (like me) save TRAC ticket HTML files.
Patch
The issue is easy to fix. Java-Script shall simply check if the HTML sections to be inserted already exist. I am going to submit a simply patch.
Attachments (3)
Change History (7)
Changed 4 years ago by
Attachment: | backlinks_twice.png added |
---|
Changed 4 years ago by
Attachment: | base.js.diff added |
---|
This is a propose patch for #13954. The Java-Script code simply checks if the HTML section (i.e. #backlinks
) to be inserted already exist in the DOM. We avoid inserting it a second time.
comment:1 Changed 4 years ago by
Keywords: | patch added |
---|
Changed 4 years ago by
Attachment: | duplicated-section-anchors.png added |
---|
comment:2 Changed 4 years ago by
Severity: | normal → trivial |
---|
The issue is well known. Almost of web applications have the same issue. At least, section anchors in Trac are added twice on saved html file.
-
tracbacklink/htdocs/base.js
12 12 return; 13 13 14 14 var content = $('<div>').html(data.content).contents(); 15 var target; 16 var method; 15 17 switch (data.type) { 16 18 case 'ticket': 17 $('div#ticket').after(content); 19 target = 'div#ticket'; 20 method = 'after'; 18 21 break; 19 22 case 'wiki': 20 $('div#content div.wikipage.searchable').after(content); 23 target = 'div#content div.wikipage.searchable'; 24 method = 'after'; 21 25 break; 22 26 case 'milestone': 23 $('div#attachments').before(content); 27 target = 'div#attachments'; 28 method = 'before'; 24 29 break; 30 default: 31 return; 25 32 } 33 target = $(target); 34 if (target.siblings('div#backlinks').length !== 0) 35 return; 36 target[method](content); 26 37 });
comment:4 Changed 4 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
That is a browser issue, not an issue of this plugin. I won't fix it.
TracBackLinkPlugin [17971] duplicate