Skip to content

Attribute selector with class-like content paired with @extend generates invalid CSS #605

@max-m

Description

@max-m

The following input generates some broken output.
Tested on version 1.10.5.

Input:

[data-foo='something.data.like'] {
	&[data-show='true'] {
		color: red;
	}
}

[data-foo='something.other.like'] {
	@extend %my-test-class;
}

%my-test-class {
	&[data-show='true'] {
		position: fixed;
	}
}

/////////////////////////////////////////////////////////////////////////////

[data-foo='this-works'] {
	@extend %my-other-class;
}

%my-other-class {
	&[data-show='true'] {
		position: fixed;
	}
}

Output:

[data-foo="something.data.like"][data-show="true"] {
  color: red;
}
data-foo="something.other.like"][[data-show="true"] {
  position: fixed;
}
[data-foo="this-works"][data-show="true"] {
  position: fixed;
}

As you can see, the opening bracket in line 4 got placed after the corresponding closing one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingspec complianceIssues with compliance to the Sass spec

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions