4 ms·
I agree the question of events still kind of remains. I think they should always be mirrored because they shouldn't be two separate elements. You shouldn't be a
by mminer237 2y ago
I agree the question of events still kind of remains. I think they should always be mirrored because they shouldn't be two separate elements. You shouldn't be able to change the "selectedoption" because it should be a pseudo-element. If the <option> changes, the pseudo-element should immediately change. It gets its content from the option.
You don't need to rearrange the HTML of the "button". You can use ::before, ::after, and general styling to do anything you need to. I'm struggling to see any advantage even if you were okay with using HTML to style pages.
- jaffathecake 2y ago> I think they should always be mirrored because they shouldn't be two separate elements That maintains one of the problems I'm worried about. If you have a mouseenter listener on something in an <option> that triggers a fancy animation, you (surely most of the time) don't want that action repeated in the <selectedoption>, because it's the thing in the <option> that was hovered, not the thing in the <selectedoption>. > You can use ::before, ::after, and general styling to do anything you need to. You don't need to look at too many web sites to see examples where folks have added divs for styling, because pseudo-elements didn't provide enough style hooks.
- mminer237 2y agoYou can always add <div>s to the <option> itself and conditionally check whether it's `select > option` or `select::selected-option`.