Skip to content

css attribute selector [title~="flower"] doesn't work with view encapsulation #9644

@esagawe

Description

@esagawe

I'm submitting a ...

[x] bug report
[ ] feature request

Current behavior
I have the following code:

.foo[bar="baz"] {
    color: blue;
}

/* added a tilde an use another attribute value */
.foo[bar~="baz2"] {
    color: red;
}

<div class="foo" bar="baz">
    Test 1
</div>
<div class="foo" bar="baz baz2">
    Test 2
</div>

And Angular create this:

.foo[bar="baz"][_ngcontent-udm-1] {
    color: blue;
}

.foo[bar[_ngcontent-udm-1]~="baz2"][_ngcontent-udm-1] {
    color: red;
}

If I run the code the text color for "Test 1" turns blue and "Test 2" is still black. But if I change the code as followed within the Chrome debugger, "Test 2" will become red.

/* removed [_ngcontent-udm-1] */
.foo[bar~="baz2"][_ngcontent-udm-1] {
    color: red;
}

I don't see the reason for this behavior but for me it seems to be wrong.

The results were the same on Chrome and Firefox on a windows machine with angular rc1 and rc3. If encapsulation is set to ViewEncapsulation.None the css code works as expected, but I need the encapsulation.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions