Ticket #5997 (new enhancement)
Opened 4 years ago
Last modified 3 years ago
Clean name-spaces for CSS for 0.11?
| Reported by: | shap@… | Owned by: | rblank |
|---|---|---|---|
| Priority: | normal | Milestone: | next-major-0.1X |
| Component: | general | Version: | devel |
| Severity: | normal | Keywords: | css consider |
| Cc: | |||
| Release Notes: | |||
| API Changes: | |||
Description
I suspect that it may be too late for this, but I think this is a low-risk change.
Trac uses CSS all over the place. This is good. The problem is that I need to pass through some content that *also* uses CSS, and there is a problem of name space collision in the choices of names for the class attribute. Since Trac is cutting over the template system, now is an opportune time to look at CSS issues if there is a desire to do so.
How difficult would it be for Trac to adopt the convention that all class attributes and all id attributes that are emitted from the trac templates would begin with "trac-" so that they are less likely to collide with CSS within content?
In our case, we cannot simply import the incoming content once and have done; it is a reference manual that we need to maintain externally via our version control system. Our goal is to simultaneously make it available within the Wiki for commenting and feedback. I considered re-writing the class attributes on our content using XSLT. It is doable, but it is probably beyond the skills of most XSLT authors.
Attachments
Change History
comment:1 Changed 4 years ago by eblot
comment:2 Changed 4 years ago by cboos
- Keywords consider added
- Milestone set to 0.12
comment:3 follow-up: ↓ 4 Changed 3 years ago by rblank
- Milestone changed from 0.13 to 0.12
- Owner changed from jonas to rblank
#7932 reported a possibly frequent clash with Trac element ids (a heading like === attachments ===, which gets an attribute id="attachments", so the CSS for the attachments <div> matches), which would be solved by a clean namespace for element ids. It was closed as a duplicate.
Prefixing all element ids with e.g. trac- should not be too difficult, as ids are mostly referenced by the style sheets. However, IIRC, element classes are quite often referenced in the code, which would make the change much more painful.
I would like to at least start the process and fix the element ids. Would trac- be a good prefix?
comment:4 in reply to: ↑ 3 ; follow-up: ↓ 5 Changed 3 years ago by eblot
Replying to rblank:
I would like to at least start the process and fix the element ids. Would trac- be a good prefix?
The trouble is that this will break all the customized Trac installations. I guess there are many of them... So either this replacement has to wait for a major release (0.12) or better, provide a Python script to parse and update custom CSS file to match the new naming scheme.
comment:5 in reply to: ↑ 4 Changed 3 years ago by rblank
Replying to eblot:
The trouble is that this will break all the customized Trac installations. I guess there are many of them... So either this replacement has to wait for a major release (0.12)
That was my intention. The CSS file updater sounds like a good idea, too, and it might even facilitate the conversion of Trac's CSS files.
comment:6 Changed 3 years ago by rblank
#8514 was closed as a duplicate.
comment:7 Changed 3 years ago by rblank
- Milestone changed from 0.12 to 0.13
I guess we'll have enough incompatible changes in 0.12 without that. Let's do that later.



See also #4264.