one of the suggested solutions was to use CSS to display: none
However, though there are child elements that can be targeted, the containing element can not be. Thus some of the other child elements will still display.
If one could change the HTML a class or Id could be added, but as it is now there are none.
JavaScript has handy DOM traversing functions like ParentNode and ChildNode but CSS has no ParentNode.
IMHO CSS has advanced into what I would consider to historically be JavaScript territory.
eg. transitions, animations and other “API” methods
it would be giving authors a “gun” to “shoot themselves in the foot with”
As to the first, perhaps not so much of a concern 5 years later?
As to the second, I’m not buying it, there are already plenty of “guns” that cause problems.
So, can anyone come up with a way to go up the DOM using only CSS or is JavaScript the only solution?
I never liked this argument. The same is still somewhat repeated this day about the universal selector. True maybe 5 years ago, but having that selector wouldn’t make or break the speed test in this day and age.
How in the world is this even a valid argument? Every language has hundreds of “guns”.
“Title” (and “Name” too if he had one ) still show.
If the containing element could be targeted (or a way to go up and then back down to other children) the whole enchilada could be removed in one go.
There is a parent selector of sorts on the way—the relational pseudo-class:has()—but it will only be usable via JavaScript (a bit like querySelector()).