Specific CSS selector to highlight incomplete stuff
-
- Posts: 176
- Joined: Wed Apr 29, 2009 4:55 pm
Specific CSS selector to highlight incomplete stuff
I'd like to tweak the default Author css file to highlight images without the ALT attribute and also those with the ALT, but containing a comment inside.
Correct:
Incorrect:
Incorrect:
So I have the rule which highlights every image:
And there is a complementary rule which clears highlighting in specific conditions. I am able to detect the existence of the ALT element, but I can't subtract cases when this element contains a comment (to keep the third example highlighted).
Is something like this possible in Oxygen CSS?
Correct:
Code: Select all
<inlinemediaobject>
<imageobject>
<imagedata fileref="icon.svg"/>
</imageobject>
<alt>Print</alt>
</inlinemediaobject>
Code: Select all
<inlinemediaobject>
<imageobject>
<imagedata fileref="icon.svg"/>
</imageobject>
</inlinemediaobject>
Code: Select all
<inlinemediaobject>
<imageobject>
<imagedata fileref="icon.svg"/>
</imageobject>
<alt><!-- FIXME --></alt>
</inlinemediaobject>
Code: Select all
inlinemediaobject {
background-color: coral;
}
Code: Select all
/* this rule doesn't cover the third case
inlinemediaobject:has(alt) {
background-color: inherit;
}
*/
/* this rule also doesn't cover third case
inlinemediaobject:has(alt:not(oxy|comment)) {
background-color: inherit;
}
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Specific CSS selector to highlight incomplete stuff
Post by chrispitude »
Hi honyk,
Would something like this work? (Sorry for any typos, I didn't test it.)
Would something like this work? (Sorry for any typos, I didn't test it.)
Code: Select all
inlinemediaobject:not(:has(alt)),
inlinemediaobject:has(alt:has(oxy|comment)) {
background-color: coral;
}
-
- Posts: 176
- Joined: Wed Apr 29, 2009 4:55 pm
Re: Specific CSS selector to highlight incomplete stuff
Thanks for the different approach. It works with a small tweak. In the first line I had to add * char.
And this helped also in my original approach:
So I can now even choose one of two ways 
Thanks for a hint!
Code: Select all
inlinemediaobject:not(*:has(alt)),
inlinemediaobject:has(alt:has(oxy|comment)) {
background-color: coral;
}
Code: Select all
inlinemediaobject {
background-color: coral;
}
inlinemediaobject:has(alt:not(*:has(oxy|comment))) {
background-color: inherit;
}

Thanks for a hint!
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service