polymer-2.x

What is the best way to communicate and pass data between child polymer elements?

别说谁变了你拦得住时间么 提交于 2019-12-24 16:18:05
问题 I have a parent polymer element baseline-policies-tab . This, on the UI, represents a tab on my website. In this tab, I have two polymer elements. One is baseline-policies-create which is a polymer element with a button. When this button is pressed, I want to send an event to another child polymer element that is contained within the tab, baseline-policy-ajax . This element will send an ajax request. I've tried dispatchEvent by sending a CustomEvent but it didn't work for me (here is the

Polymer 2.0 custom style property is not working under dom-module

狂风中的少年 提交于 2019-12-24 11:07:41
问题 I have upgraded polymer project to 2.0 version. After that some css class is missing from div. There is a link to iron-flex-layout.html from my-home.html <link rel="import" href="bower_components/iron-flex-layout/iron-flex-layout.html"> And in my-home.html page have some styles like following: <dom-module id="my-home"> <template> <style is="custom-style"> .flex-vertical { @apply --layout-vertical; height: 100vh; } .flexchild-vertical { @apply --layout-flex; @apply --layout-horizontal; } <

How to import stylesheet dynamically Polymer 2.0

倖福魔咒の 提交于 2019-12-24 07:07:03
问题 I want to import my stylesheet with variable inside : <dom-module id="colors-palette"> <template> <style> :host { --dark-gray: #263238; --light-gray: #e6ebed; --light-blue: #00bcd4; --autovision-blue: #174291; --background-box-number-applications: red; --color-box-number-applications: orange; } </style> </template> </dom-module> I want to do it dynamically. My folder structure is : -themes -theme1 -style.html -theme2 -style.html -theme3 -style.html I detect the theme when my-app is ready and

Polymer 2.0 webcomponents-loader.js is missing Edge polyfill

给你一囗甜甜゛ 提交于 2019-12-24 05:09:12
问题 We currently updated a project from Polymer 1 to the Polymer 2/ hybrid version. I know that webcomponents-hi-sd-ce.js is the polyfill for edge. When testing the page on Microsoft Edge I now get an error indicating that webcomponents-hi-sd-ce.js.map could not be found (404). The same error occurs when loading the project with webcomponents-lite.js I couldn't find similar cases so I figured this might be a issue in Polymer 2. I tried importing the script directly by myself but that didn't help

How to access functions defined in js file inside the template of Polymer element?

青春壹個敷衍的年華 提交于 2019-12-23 06:06:33
问题 I have created a function in global.function.js file as function getData(flag) { if (flag === 1) { return "one"; } else { return "not one"; } } which then is imported using custom-js-import.html element: <script src="global.function.js"></script> When I tried to access the above function in custom-element.html , I am able to access it in the script part but not in the template part. Is there any way I can access the function inside the HTML element? <!-- custom-element.html --> <link rel=

How to access functions defined in js file inside the template of Polymer element?

梦想的初衷 提交于 2019-12-23 06:06:14
问题 I have created a function in global.function.js file as function getData(flag) { if (flag === 1) { return "one"; } else { return "not one"; } } which then is imported using custom-js-import.html element: <script src="global.function.js"></script> When I tried to access the above function in custom-element.html , I am able to access it in the script part but not in the template part. Is there any way I can access the function inside the HTML element? <!-- custom-element.html --> <link rel=

How to get Polymer 2.0 ES5 elements working with v1 spec?

情到浓时终转凉″ 提交于 2019-12-14 03:52:48
问题 I've successfully built a number of Polymer 2.0 elements and they run great in ES6 capable browsers. When I try to transpile them to ES5, the browser throws a bunch of errors, like these: Failed to construct 'HTMLElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function. After some research, it looks like you need a native-shim, which comes along with the webcomponentsjs-es5-loader, but after switching to that now I'm getting a new error: Class

Polymer UI element shadow root does not support automation using selenium webdriver

北慕城南 提交于 2019-12-14 03:16:25
问题 I am facing an issue with automating polymer ui page using selenium webdriver. The reason that is blocking to start selenium automation is "shadow root" element in the polymer components. kindly suggest with some examples or ideas to overcome the issue. Does selenium supports polymer ui automation? 回答1: No selenium doesn't support it. Either you will have to use javascript executer in selenium using documant.querySelector(...).shadowRoot or use "/deep/" combinator. The best is "/deep/

Polymer 2.0: What are the prerequisites? [closed]

删除回忆录丶 提交于 2019-12-13 09:02:11
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I'm relatively new to web development and have a basic understanding of JavaScript (loops, functions, objects) and recently I started learning Polymer 2.0 and I have been struggling with it for a while now. So I definitely need to brush up my skills. Please provide some resources that I should refer before

Why doesn't element catch event when using dispatchEvent from sibling polymer element?

☆樱花仙子☆ 提交于 2019-12-13 08:52:20
问题 I have the following polymer element in my UI which has two polymer elements, baseline-policy-create and baseline-policy-domain-ajax. <dom-module id="baseline-policies-tab"> <template> <style include="dfw-styles"> :host { display: block; } </style> <baseline-policy-create></baseline-policy-create> <baseline-policy-domain-ajax></baseline-policy-domain-ajax> </template> <script> class BaselinePoliciesTab extends Polymer.Element { static get is() { return 'baseline-policies-tab'; } static get