Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add :host-context to TSPseudoClass #545

Closed
ghost opened this issue Jul 17, 2023 · 7 comments
Closed

Add :host-context to TSPseudoClass #545

ghost opened this issue Jul 17, 2023 · 7 comments

Comments

@ghost
Copy link

ghost commented Jul 17, 2023

:host is recognized, but :host-context is not. https://developer.mozilla.org/en-US/docs/Web/CSS/:host-context.

@ghost
Copy link
Author

ghost commented Jul 27, 2023

Any chance of this coming in a future update? I need to make a visitor for :host-context(...).

@devongovett
Copy link
Member

Hmm, looking through the link you posted it seems that this is a non-standard Chrome-only selector. According to the linked Firefox issue in the compatibility table, neither Mozilla nor Apple plan on implementing it and it will likely be removed from the spec. See w3c/csswg-drafts#1914. Therefore I'm hesitant to implement it as well. It should already be parsed as PsuedoClass::CustomFunction. Does that work for you?

@Oriblish
Copy link

Oriblish commented Jul 30, 2023 via email

@ghost
Copy link
Author

ghost commented Jul 31, 2023

It's workable... the main issue is the lack of specificity with the arguments. The :host type has selectors, but custom-function's arguments are TokenOrValue[] where a class, for example, is a delim and an ident... so you can see how this is unraveling.

[
  { type: 'ident', value: 'body' },
  { type: 'white-space', value: ' ' },
  { type: 'delim', value: '>' },
  { type: 'white-space', value: ' ' },
  { type: 'delim', value: '.' },
  { type: 'ident', value: 'content' }
]

converting this into selectors is not great

@ghost
Copy link
Author

ghost commented Aug 3, 2023

@Oriblish how did you implement this?

@ghost
Copy link
Author

ghost commented Aug 3, 2023

Tried messing with this more today... no luck, really. I'm basically left to parse the tokens into selector components, but this library already has that capability unexposed (as far as I'm aware). There's no "raw" component type that would just insert a string; even "type" escapes invalid type characters.

@ghost
Copy link
Author

ghost commented Aug 4, 2023

Navigated the issue entirely by avoiding the need for a visitor on this selector.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants