Skip to content

Why isn't ViewEncapsulation automatically determined based on availability? #7394

Closed

Description

@chaim770

According to the docs, the default component encapsulation is ViewEncapsulation.Emulated.

Why can't the framework automatically determine whether ShadowDOM is indeed supported or not (pretty easy) and act accordingly (by default)?

Activity

  1. zoechi commented on Mar 3, 2016

    @zoechi
    Contributor

    What if you want None to be able to apply styles added to the <head> to the whole page? Or if you want style descentant elements from a component while maintaining encapsulation from outside the component.

  2. chaim770 commented on Mar 3, 2016

    @chaim770
    Author

    @zoechi I never meant to disable the option completely. Obviously, there needs to be a way to control style encapsulation.

    My question is why isn't there an additional (and possibly the default) option that is ViewEncapsulation.Auto that will automatically detect whether native ShadowDOM can be used.

    The currently default value (Emulated) is making sure that native ShadowDOM cannot be leveraged even when it does supported.

  3. zoechi commented on Mar 3, 2016

    @zoechi
    Contributor

    I see. I expected Native to fall back to Emulated if not available.

  4. chaim770 commented on Mar 3, 2016

    @chaim770
    Author

    @zoechi, I doubt that's the case. Also, the documentation doesn't state so (where it really should).

    See:

    nodesParent = DOM.createShadowRoot(hostElement);

  5. zoechi commented on Mar 3, 2016

    @zoechi
    Contributor

    Ok, than it's good you created the issue. I hope my questions helped make it more clear for future visitors what the issue is about instead of obscuring it ;-)

  6. TheLarkInn commented on Mar 9, 2016

    @TheLarkInn
    Member

    +1

  7. zoechi commented on Jul 8, 2016

    @zoechi
    Contributor

    This should now be easier after #7883 has landed.

  8. vicb commented on Jul 8, 2016

    @vicb
    Contributor

    it's not possible because the behavior are not exactly the same (there are edge cases)

  9. angular-automatic-lock-bot commented on Sep 9, 2019

    @angular-automatic-lock-bot

    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.

  10. locked and limited conversation to collaborators on Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions