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

pseudo classes selectors on :host element don't works correctly after angular updating 2.0.0 -> 2.1.1 #12730

Closed
holiber opened this issue Nov 5, 2016 · 2 comments · Fixed by #12754
Labels
area: core Issues related to the framework runtime freq2: medium type: bug/fix

Comments

@holiber
Copy link

holiber commented Nov 5, 2016

bug from #12451 discussion

I'm submitting a ... (check one with "x")

[X] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

I have component with 'active' class on :host

@Component({
  selector: 'my-component',
  template: '<div>My component</div>',
  styleUrls: ['./my-component.component.css']
})
export class MyComponent {
  @HostBinding('class') componentClass = 'active';
}

my-component has styles:

:host:after {
  content: 'Component is not active';
  color: red;
}

:host.active:after {
  content: 'Component is active';
  color: green;
}

in angular 2.1.1 component shows wrong result:

image

Expected behavior
In angular 2.0.0 all is ok:

image

Minimal reproduction of the problem with instructions
http://plnkr.co/edit/4xgwW5D8ZqhlHB06MXsQ?p=preview

Please tell us about your environment:

MacOSX 10.11, Node v6.9.1

  • Angular version: 2.1.1
  • Browser: [all ]
  • Language: [TypeScript 1.8]

  • Node (for AoT issues): node --version = v6.9.1

@vicb vicb added type: bug/fix freq2: medium severity3: broken area: core Issues related to the framework runtime labels Nov 5, 2016
@borislemke
Copy link

Same problem in similar case:

:host {

    &.outline {

        &:before {
            ...some styling stuff
        }
    }
}

will compile to:

.outline:before[_nghost-hyp-13] {}

where it should:

[_nghost-hyp-13].outline:before

vicb added a commit to vicb/angular that referenced this issue Nov 7, 2016
vicb added a commit to vicb/angular that referenced this issue Nov 7, 2016
vikerman pushed a commit that referenced this issue Nov 7, 2016
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to the framework runtime freq2: medium type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants