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

Descendant CSS selector type not supported #10

Open
haydenbleasel opened this issue Apr 5, 2024 · 1 comment
Open

Descendant CSS selector type not supported #10

haydenbleasel opened this issue Apr 5, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@haydenbleasel
Copy link

Hi! Wanted to cross-reference a bug I'm investigating in Tiptap: ueberdosis/tiptap#4089

Currently when parsing the following HTML:

<div data-youtube-video>
        <iframe src="https://www.youtube.com/watch?v=cqHqLQgVCgY"></iframe>
</div>

It results in:

Unknown CSS selector type descendant div[data-youtube-video] iframe [
  { type: 'tag', name: 'div', namespace: null },
  {
    type: 'attribute',
    name: 'data-youtube-video',
    action: 'exists',
    value: '',
    namespace: null,
    ignoreCase: null
  },
  { type: 'descendant' },
  { type: 'tag', name: 'iframe', namespace: null }
]

Looks like descendant support is in the code but commented out, either:

  1. Here:
    // } else if (type === 'descendant') {
  2. or here:
    // else if (type === 'descendant') {

I'll keep digging and hopefully open a PR if I can manage to fix it.

@holtwick
Copy link
Owner

holtwick commented Apr 5, 2024

It's true, descendants are currently not supported. It would indeed be nice to have such a feature.

It might require some recursive calls. The code is already prepared quite well for such an extension.

If you could contribute a PR, I would be more than happy to merge it. Thanks.

@holtwick holtwick self-assigned this Jun 24, 2024
@holtwick holtwick added the enhancement New feature or request label Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants