Skip to content

Selector for element with attribute is lost #299

@kesselb

Description

@kesselb

Hi 👋

We are using htmlpurifier for nextcloud/mail to sanitize the body of html messages and have a bug report that a mail is not rendered correctly (nextcloud/mail#5279).

I debugged the mail body and found that

* img[tabindex="0"] + div { text-align:center }

is rewritten to

* + div { text-align:center }

if ($y === '*' || isset($html_definition->info[$y = strtolower($y)])) {

image

A test case for ExtractStyleBlocksTest:

	public function test_cleanCSS_elementWithAttribute()
	{
		$this->assertCleanCSS(
			"* img[tabindex=\"0\"] + div {\ntext-align:center\n}",
			"* img + div {\ntext-align:center\n}"
		);
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions