polymer

Create Anchor Element in polymer

送分小仙女□ 提交于 2019-12-05 05:12:16
问题 Is it possible to create an element that will be used as an anchor in polymer. So for example <template repeat="{{ content in contentitems }}"> <div id="{{ content.id }}">{{content.stuff}}</div> </template> Would it be possible to create a hyperlink to the content#id anchor like http://example.com/#someid Alternatively, we can query that element with querySelector like the below and then scroll it into view if necessary with JavaScript. I'd rather not have to use a JS router however for

Polymer 1.0: Does <iron-meta> support binding to dynamic variables?

梦想与她 提交于 2019-12-05 04:46:41
I can get my <iron-meta> instance to work properly when using a static value. But when I bind the value to a dynamic variable (using {{}} ) it <iron-meta> no longer behaves as expected. Does <iron-meta> support binding its value to dynamic variables? <iron-meta id="meta" key="info" value="foo/bar"></iron-meta> // works <iron-meta id="meta" key="info" value="{{str}}"></iron-meta> // fails Previous work This question is a refinement of this question in order to clarify that the ONLY thing causing the problem is the change from a static string value to a dynamic string value binding. I was

polymer unit test mocking dependencies

耗尽温柔 提交于 2019-12-05 04:17:42
Im just starting on polymer. Im trying to unit test a custom element that has dependencies and I would like to fake/mock these out. I've found Scott Miles recommendation on how to mock the core-ajax implementation. I thought I could follow that pattern easily but this only works as long as my element does not import the about to be mocked (core-ajax in this case) element. If it does import it, then when the test tries to run I get 'Uncaught NotSupportedError: Failed to execute 'registerElement' on 'Document': Registration failed for type 'core-ajax'. A type with that name is already registered

What are difference between hostAttributes and properties in polymer?

≡放荡痞女 提交于 2019-12-05 03:28:32
I'm doing migration from 0.5 to 1.0. While reading, I notice 2 different way on declaring attributes, using hostAttributes and properties . What are difference between those 2 ? Host attributes are attributes that do not match to an element's corresponding Javascript property (which you declare in properties ). This includes attributes like class , tabindex , data-* attributes, aria-roles, etc. To declare them during create-time, you must set them in the hostAttributes object. If you are going to bind values into them, you must use $= (which calls Element.setAttribute ) rather than = . Sources

Access shadow DOM properties (polymer) with javascript/jquery?

前提是你 提交于 2019-12-05 03:00:39
I'm currently using polymer's core-scaffold & co. to create an header/sidebar with a content area. I'm currently having the problem that I cannot access certain properties of the content element, such as scrollTop. (since the actual scrollTop property that I need to access is defined in the shadow DOM.) This conflicts with a lazyload jquery plugin I'm using. The plugin is checking the window.scrollTop but changing the plugin to check the scrollTop of my content (that scrolls instead of the window) won't have any affect, since the scrollTop is "hidden" in the shadow DOM. Is there a way to

Flux architecture with polymer elements

微笑、不失礼 提交于 2019-12-05 02:48:32
问题 A flux architecture is trending in web applications and so is polymer elements. Is there any example how to make a polymer application, which use flux architecture? 回答1: I've been thinking about using the Flux pattern with (Polymer) Web Components. Up to date I have come up with three possible solutions, all different from your way, so here they are: DISCLAIMER I use Reflux library and not the Facebook's one. Actions and Stores as elements My first attempt was to make Flux pattern into

How to set baseUrl in Polymer Starter Kit?

谁都会走 提交于 2019-12-05 02:18:56
问题 How to set baseUrl in Polymer Starter Kit(light version)? (similar: Serving Polymer App to a /path not at root) I want to run it in subfolder (dl and unzipped PSK there, server is xampp): http://localhost/test/psk/app/ When I go to that URL, app is redirecting to: http://localhost/ with this note: Can't find: http://localhost/test/psk/app/#!/test/psk/app/. Redirected you to Home Page Ok There are no console errors, app work fine except the URL problem. Here are app.js : // Sets app default

How to use paper-dialog polymer element?

折月煮酒 提交于 2019-12-05 02:05:21
I am using the element by adding opening and closing tags <paper-dialog><p>This is it</p></paper-dialog> but it is not getting shown up. Do I need to add some script on top of it so that it should be triggered on some event? Or is there some another way to make it visible ? atomikolex The dialog itself is autohidden. You usually toggle it with a button. For example, give the dialog an id="dialog" and make the button on-tap="toggleDialog" , which would be toggleDialog: () => { this.$.dialog.toggle(); }, Karthik <base href="https://polygit.org/polymer+polymer+v1.11.2/components/" /> <script src=

How can I refresh/reload Polymer element, when page changes?

怎甘沉沦 提交于 2019-12-05 01:53:22
问题 I created few custom elements. When they get ready(triggered by ready() ), they start downloading JSON data from API, and show to the users. Want to use them in Single Page Application, and to download data when it becomes visible. Right now, it downloads all the data of all the pages first, because I used ready() event. Is it possible to fire an event every time they become visible? 回答1: I found a solution. But, it's a little bit tricky. First, I added a function called isEqual . app.isEqual

polymer 3.0 uncaught reference error on paper drop-down click

时光怂恿深爱的人放手 提交于 2019-12-05 01:13:22
问题 after importing these: import '@polymer/paper-dropdown-menu/paper-dropdown-menu.js'; import '@polymer/paper-listbox/paper-listbox.js'; import '@polymer/paper-item/paper-item.js'; The dropdown does not produce an error when left alone but when clicked on (will repeat on multiple clicks) it will produce it. Uncaught ReferenceError: KeyframeEffect is not defined at HTMLElement.configure (fade-in-animation.js:32) at HTMLElement._configureAnimations (neon-animation-runner-behavior.js:42) at