LeaVerou/parsel

Parsing `html|*` reports it is a Compound Selector

bramus opened this issue · 4 comments

Output for parsing a namespaced * is this:

{
	"type": "compound",
	"list": [
		{
			"type": "type",
			"content": "html",
			"name": "html",
			"pos": [
				0,
				4
			]
		},
		"|",
		{
			"type": "type",
			"content": "*",
			"pos": [
				5,
				6
			]
		}
	]
}

This is incorrect. It’s simply namespaced universal selector.

Regular namespaced selectors – such as html|p – work fine:

{
	"type": "type",
	"content": "html|p",
	"namespace": "html",
	"name": "p",
	"pos": [
		0,
		6
	]
}

While drafting this issue, I noticed same thing happens when trying to parse html|. It’s also reported as Compound Selector.

Regular namespaced selectors – such as html|p – work fine:

{
	"type": "compound",
	"list": [
		{
			"type": "type",
			"content": "html",
			"name": "html",
			"pos": [
				0,
				4
			]
		},
		"|",
		{
			"type": "type",
			"content": "*",
			"pos": [
				5,
				6
			]
		}
	]
}

I think you pasted the wrong code, this is what's produced (which is indeed correct):

{
	"type": "type",
	"content": "html|p",
	"namespace": "html",
	"name": "p",
	"pos": [
		0,
		6
	]
}

I think you pasted the wrong code

That was a copy-paste error on my part indeed. I have updated the original post to include the correct snippet.

I think this one is already fixed in this PR

@david-luna Correct. Added an extra test in #46, verifying this.