-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 0.10.0-pre.8 extends dom element custom style no effect #18171
Comments
Added Area-Polymer, Triaged labels. |
This comment was originally written by joo...@gmail.com There are concerns that it? |
Removed Area-Polymer label. |
Added this to the 1.6 milestone. |
Removed this from the 1.6 milestone. |
Removed Polymer-P-1 label. |
Added PolymerMilestone-Next label. |
Removed Polymer-Milestone-Next label. |
This comment was originally written by @almstrand This may not be specific to extending DOM elements as I was able to confirm the behaviour when extending custom elements using Polymer Dart 0.12.0-dev (Jul 11, 2014) and Dart SDK version 1.5.3. It also seems this issue occurs only in certain browsers. I previously reported this behaviour on Stack Overflow: http://stackoverflow.com/questions/24835686/custom-parent-elements-style-not-applied-to-child I created a custom Polymer Dart element that extends another custom element. The parent element has a style defined containing a :host selector. When adding the parent element to the DOM, the style is applied as expected. When extending the parent element and adding the child element to the DOM, the style defined for the parent element is not always applied. When testing the following code in Dartium v36.0.1985.97 (280598) or Chrome v35.0.1916.153, both elements are displayed with the proper style applied. When tested in Firefox 28.0 and Chrome v34.0.1847.116 Ubuntu 14.04 aura (260972), only the parent element has the style applied. pubspec.yaml: name: myapp
index.html: <!DOCTYPE html> <html> <body> <link rel="import" href="packages/polymer/polymer.html"> <!-- parent element --> <!-- child element --> <p><my-parent>RED? (parent elment)</my-parent> <script type="application/dart">export 'package:polymer/init.dart';</script> </body> Output in Dartium v36.0.1985.97 (280598) and Chrome v35.0.1916.153: http://s30.postimg.org/8j3x3l2m9/Dartium.png Output in Firefox 28.0 and Chrome v34.0.1847.116 Ubuntu 14.04 aura (260972): http://s1.postimg.org/f210lwhj3/Firefox.png |
Set owner to @jakemac53. |
This looks like a bug with the ShadowDom CSS polyfill. The style gets translated to effectively: my-parent { But extended elements do not get the same treatment, it should be the following (or some equivalent): my-parent, my-child { The weird thing though is I can confirm that making them noscript elements does in fact fix the issue. This leads me to believe it has something to do with polymer.dart specifically, not the polyfill itself. I am going to see if I can get a repro at all on the JS side of things. |
Looks like we had an optimization to not call the shadowdom css shim if there is no template present, but it wasn't taking into account the parent element. I just sent out https://codereview.chromium.org/524673002/ to remove this optimization, this is now consistent with the JS side of things as well. |
fixed in r39707 Added Fixed label. |
This issue has been moved to dart-archive/polymer-dart#163. |
This issue was originally filed by joo.ts...@gmail.com
follow example show button font color red.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sample app</title>
<link rel="import" href="packages/polymer/polymer.html">
</head>
<body>
<polymer-element name="x-button" extends="button" noscript>
<template>
<style>
:host {
color: red;
}
</style>
<content></content>
</template>
</polymer-element>
<button is="x-button">test</button>
</body>
</html>
follow example show button font color normal(gray).
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sample app</title>
<link rel="import" href="packages/polymer/polymer.html">
</head>
<body>
<polymer-element name="x-button" extends="button">
<template>
<style>
:host {
color: red;
}
</style>
<content></content>
</template>
<script type="application/dart;component=1">
import 'dart:html';
import 'package:polymer/polymer.dart';
@CustomTag('x-button')
class XButton extends ButtonElement with Polymer, Observable {
XButton.created(): super.created() {
polymerCreated();
}
}
</script>
</polymer-element>
<button is="x-button">test</button>
</body>
</html>
noscript meet expectations, has script do not meet expectations.
The text was updated successfully, but these errors were encountered: