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

nth-of-type #20

Open
LukeTOBrien opened this issue Aug 19, 2020 · 1 comment
Open

nth-of-type #20

LukeTOBrien opened this issue Aug 19, 2020 · 1 comment

Comments

@LukeTOBrien
Copy link

Hello there.

I am creating a WYSIWYG editor in Blazor and am using CSS nth-of-type to create a unique selector.
When I run my code I get the following error:

System.FormatException: Unknown functional pseudo 'nth-of-type'. Only nth-child and nth-last-child are supported.

For simple, non-nested elements, like SECTION H1:nth-of-type(1) I can use a work-around

HtmlNode element = null;
if (sel.Contains("nth-of-type"))
{
	var splitty = sel.Split(':');
	var elements = rootNode.QuerySelectorAll(splitty[0]);
	var n = int.Parse(Regex.Match(splitty[1], @"(\d)").Value);
	element = elements[n - 1];
}

But I hit a snag for more complex structures.
Any change of implementing nth-of-type?
You have nth-child, how much work would it be to have nth-of-type?

Thanks

@atifaziz
Copy link
Owner

This first needs support in Fizzler (atifaziz/Fizzler#28).

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