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

Polymer components' CSS encapsulation is broken when run e.g. in Chrome when compiled by dart2js #17676

Closed
DartBot opened this issue Mar 21, 2014 · 8 comments
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams.

Comments

@DartBot
Copy link

DartBot commented Mar 21, 2014

This issue was originally filed by ant...@mixbook.com


What steps will reproduce the problem?

  1. Create 2 polymer components, one nested into another, like:

    <polymer-element name="x-parent">
      <template>
        <style>
          .title { color: blue; }
        </style>
        <div class="title">Parent title</div>
        <x-child></x-child>
      </template>
      <script type="application/dart" src="parent.dart"></script>
    </polymer-element>

    <polymer-element name="x-child">
      <template>
        <style>
          .title { background: yellow; }
        </style>
        <div class="title">Child title</div>
      </template>
      <script type="application/dart" src="child.dart"></script>
    </polymer-element>

  1. Compile it to JS by 'pub build', run in Chrome

What is the expected output? What do you see instead?

Expected output - "Child title" should be a black text on yellow background
See instead - "Child title" is blue text on yellow background

What version of the product are you using? On what operating system?
Polymer 0.9.5, Dart 1.2.0 Stable, Mac OS X 10.9

Please provide any additional information below.

It works fine in Dartium, because it has the native Shadow DOM support.
But since it is not yet in Chrome, it creates two CSS rules, like:

    x-parent .title { color: blue }
    x-child .title { background: yellow }

and of course x-parent .title also applies to x-child's title, since x-child is inside x-parent.

But that actually breaks the main idea and the main feature of the polymer elements - their styles are not encapsulated.

@floitschG
Copy link
Contributor

Added Area-Polymer, Triaged labels.

@jmesserly
Copy link

Removed Area-Polymer label.
Added Pkg-Polymer, Area-Pkg labels.

@sigmundch
Copy link
Member

Added this to the 1.6 milestone.
Removed Priority-Unassigned label.
Added Priority-Medium label.

@sigmundch
Copy link
Member

Removed this from the 1.6 milestone.
Added Polymer-P-1 label.

@sigmundch
Copy link
Member

Removed Polymer-P-1 label.
Added Polymer-Milestone-Next label.

@sigmundch
Copy link
Member

Added PolymerMilestone-Next label.

@sigmundch
Copy link
Member

Removed Polymer-Milestone-Next label.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

This issue has been moved to dart-archive/polymer-dart#143.

@DartBot DartBot closed this as completed Jun 5, 2015
@kevmoo kevmoo removed the triaged label Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams.
Projects
None yet
Development

No branches or pull requests

5 participants