I have a Polymer v2 web component defined below. In the main page I include a CSS file which defines style named n-action-button
. When I open the main page in FireFox or IE the style is applied to the web component, but when I do the same in Chrome the content of the web component is not styled.
Everything was working fine when the application was using Polymer v1 library. It has changed when I upgraded to Polymer v2. I've read in docs on the net that externally-defined styles should be applied to web components. I have no idea why it isn't working under Google Chrome browser.
<link rel="import" href="../polymer/polymer-element.html">
<dom-module id="login-form">
<template>
<h1>
Use your username & password to sign in.
</h1>
<form id="form" method="post" action="j_security_check">
<input id="username" name="j_username" type="text" placeholder="username"/>
<input type="submit" id="submit" value="Log In" class="n-action-button">
</form>
</template>
<script>
class LoginForm extends Polymer.Element {
static get is() { return 'login-form'; }
}
window.customElements.define(LoginForm.is, LoginForm);
</script>
</dom-module>
EDIT: The style looks like this:
.n-action-button,
.n-action-button:hover,
.n-action-button:focus,
.n-action-button:active,
.n-action-button:visited,
.n-action-button[disabled],
.z-button.n-action-button,
.z-button.n-action-button:hover,
.z-button.n-action-button:focus,
.z-button.n-action-button:active,
.z-button.n-action-button:visited,
.z-button.n-action-button[disabled] {
display: inline-block;
color: #fff;
text-shadow: none;
text-decoration: none;
padding: 15px 30px;
line-height: 22px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
border: 0;
-webkit-transition: color .25s, background .25s;
-moz-transition: color .25s, background .25s;
-o-transition: color .25s, background .25s;
transition: color .25s, background .25s;
}
.n-action-button,
.n-action-button:visited,
.z-button.n-action-button,
.z-button.n-action-button:visited {
background: #49b87b;
}
.n-action-button:hover,
.n-action-button:focus,
.n-action-button:active,
.z-button.n-action-button:hover,
.z-button.n-action-button:focus,
.z-button.n-action-button:active {
color: #fff;
background: #4bbe7f;
}
.n-action-button[disabled],
.z-button.n-action-button[disabled],
.z-button.n-action-button[disabled]:hover,
.z-button.n-action-button[disabled]:focus,
.z-button.n-action-button[disabled]:active {
color: #fff;
background: #b1b1b1;
}