Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Same... Just had a perfect situation for it and it's just so annoying knowing that it's coming but isn't there yet.
-
what about a unified pseudo class for placeholders, which can be styled with every css property?
-
qbons2028y@Scrumplex i am sorry but i dont really get it. But, could you please explain to me how to apply your method in this simple situation. Lets say you have several <div> in a row which have blue background. But, you want to apply red background if the div contain <strong> tag. And this strong tag randomly placed in any div.
-
@qbons no I spoke about input and the pseudo tags for the placeholder defined for the input. You can use it but only do text modifications.
-
imo if you're doing something where you think you need a parent selector, you might be going about it the wrong way
-
Skipp23448y@qbons that would be a single line of jquery. $('.yourBoldObject').closest('.rowToPutRedOn').addClass('makeRed');
-
brod99258yWouldn't this break the render process though? I've got away without parent selectors this far..
Edit: some native variable media queries would be great tho.. pleeease. -
@qbons first of all you would have to pretty much rewrite every browsers method of painting if you want it to perform well. On top of that the idea is CSS is cascading styles. Waterfalls don't flow up. I can't think of any scenario where I would want to style something and cascade up.
-
Skipp23448y@qbons true. That's why you just add a class that you have styled with css. You don't actually inject inline css. That's just awful.
-
qbons2028y@DoctorDalek no i mean please elaborate when you said "if you need parent selector, it could be im going to the wrong way". Maybe thats not really what you said, but i believe it is what you mean, right?
-
qbons2028y@Skipp nobody talking about injecting CSS code into element here. I already give an example about this condition. Please read my other comment about div and strong tag. If the content is static yes that will be really easy. I am talking about dynamic content which produce quite unpredictable content.
-
@qbons the whole premise of my statement is built around the idea of determining the style at the highest level possible. Using a parent selector violates that principle. To me, using a parent selector is the same as using GOTO
-
Skipp23448y@qbons doesnt make any difference. If the content is static or available on page load - that jquery snippet will work. If you use ajax or partials or whatever makes your DOM change, just shove that single line of Js in a method and call it after you're done manipulating your dom. Simple as that :)
-
Skipp23448y@qbons lol, i'm fully aware of what you're saying but the argument "i don't like it" when everyone is using it since that's the only easy way that works (at the moment) makes this whole discussion a bit redundant 😂
-
@qbons programming is all about principles. There is a reason we don't do things that breaks currently established rules
-
qbons2028y@DoctorDalek please explain, how parent selector will break the rules? Thanks in advance
-
@qbons the whole idea of HTML and CSS is you have a big chunk, and then you whittle that down. There's no HTML element that says that it should really appear higher in the DOM. While this could be useful (stuff like enqueuing scripts in head but calling it in a partial) it breaks execution flow and just general structure. Remember that HTML are relatively dumb document types. They are not meant to be another programming language. While CSS does some seem like every selector has some logic to it (if body has class main, make links red), it's really just a map of styles to elements on the page.
If you want to talk about regression issues, having something like a parent selector has the added potential of frustrating and non-intuitive debugging/behavior. Lets take the behavior. If you do something like a ^ .article {background: black} is that a direct parent or is that going up the tree until you hit .article? It's just confusing and can lead to way too many issues.
I still hoping there will be parent selector in CSS...
undefined
#css #webdev