The implementation of my web component in Polymer v2 is causing a styling issue specifically in Google Chrome. Despite including a CSS file that defines a style called n-action-button
, the styling is not being applied to the content of the web component in Chrome. Interestingly, the same styling works perfectly in FireFox and IE.
Prior to upgrading to Polymer v2, everything functioned correctly with the use of Polymer v1. According to the documentation I have consulted, externally-defined styles should be applied to web components. I am perplexed as to why this is not functioning as expected in the 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: This is how the style has been defined:
.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;
}