polymer-1.0

Specify browser location for wct-local test

狂风中的少年 提交于 2019-12-21 12:03:07
问题 The Polymer Starter Kit contains web-component-tester for unit testing your custom elements. In wct.conf.json you can specify the browsers to run the tests in. { "suites": ["app/test"], "plugins": { "local": { "browsers": ["firefox"] } } Unfortunately, when I launch the tests through gulp, wct is not able to find my local Firefox. I read at GitHub that wct uses launchpad to detect local browsers. Afaik, on a Windows machine, launchpad searches for Firefox in the default directory "C:\Program

Polymer deactivating pages when their not in view

▼魔方 西西 提交于 2019-12-21 09:29:20
问题 I'm using the polymer application drawer template from the polymer cli. I'm having some trouble with: When you load a new page, the html element is imported; then it's code executes When I move to another page the code for the previous page is still running. Is there a way to destroy and create the page/element or suspend and enable? Whats the best practice for dealing with this problem? Have the pages implement a create and destroy method and invoke it when changing page? Ie oldPageElement

Polymer deactivating pages when their not in view

可紊 提交于 2019-12-21 09:28:09
问题 I'm using the polymer application drawer template from the polymer cli. I'm having some trouble with: When you load a new page, the html element is imported; then it's code executes When I move to another page the code for the previous page is still running. Is there a way to destroy and create the page/element or suspend and enable? Whats the best practice for dealing with this problem? Have the pages implement a create and destroy method and invoke it when changing page? Ie oldPageElement

Hero Animation in polymer 1.0

﹥>﹥吖頭↗ 提交于 2019-12-21 05:03:14
问题 I am trying to implement hero animation(from neon-elements) to animate to another custom element(element1.html to element2.html) by clicking a red square. I wrote everything that is documented here: https://github.com/PolymerElements/neon-animation#shared-element But nothing happens on click. Please guide me on implementing this. Here are my files: index.html <!DOCTYPE html> <html> <head> <script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"> </script> <link rel="import"

How to filter an iron-list in polymer 1.0?

走远了吗. 提交于 2019-12-21 04:31:18
问题 The dom-repeat element offers a filter attribute. Is there a similar way to filter with iron-list ? For example: Given a list of people, I want to filter the ones born in a specific city. 回答1: As iron-list unfortunately doesn't offer a filter attribute, there is no declarative pattern making this possible. You can either implement your own simple list element making use of dom-repeat 's filter property. (With element inheritance coming back in future releases, you might extend iron-list ).

Firebase Security Rules Block Writing to Firebase

心不动则不痛 提交于 2019-12-20 04:15:59
问题 Note: This question is tagged polymer because the Polymer library is used to generate the Javascript. This question is about two different but related problems dealing with Firebase security. Problem 1 and Problem 2 seem to suggest opposite realities and opposite results when trying to get the Firebase security rules to work. (FWIW: Here is my prior unsuccessful attempt to write this question.) Here is the live code in a JSBin. http://jsbin.com/hinehoyigo/edit?html,output Problem 1 Firebase

polymer error on reloading

本小妞迷上赌 提交于 2019-12-20 04:06:24
问题 i have installed the polymer starter kit and once i load the starter kit every thing gets loaded properly and the url looks like http://127.0.0.1:8887/ then once i click on any view that page gets open and url changes to http://127.0.0.1:8887/view1 but if i reload the browser now, instead of showing the same page it displays the entry not found error.i have tried searching over internet for solution but i didn't find one.what should i do to fix it. 回答1: When you refresh the page (http://127.0

How to access content of dom-if inside a custom element?

狂风中的少年 提交于 2019-12-19 21:47:40
问题 In a custom element I want to access a span and append a child to it but all usual accessors give undefined : <template> <template is="dom-if" if="[[condition]]" restamp> <span id="myspan"></span> </template> </template> ready() { var a = this.$.myspan; //<------- is undefined var b = this.$$.myspan; //<------- is undefined var c = document.getElementById("myspan"); //<------- is undefined var d = this.$$("#myspan"); //<------- is undefined } How to access a span in this case? UPDATE: here is

how to dynamically append an element to dom-if in Polymer?

不羁岁月 提交于 2019-12-19 21:45:11
问题 My goal is to append an element to existing dom-if dynamically. Problem is that after appending I can see appended element in the DOM three but it never reacts on condition and stays always hidden. <template> <template id="domif" is="dom-if" if="[[condition]]" restamp></template> </template> ready() { var el = document.createElement("input"); Polymer.dom(this.$.domif).appendChild(el); Polymer.dom.flush(); } Exploring DOM with hardcoded dom-if and input shows that <input /> element is actually

Polymer.js two-way binding to textarea value

时间秒杀一切 提交于 2019-12-19 17:46:22
问题 In version 0.5 it was easy: <polymer-element name="textarea-tpl" attributes="value placeholder"> <template> <link rel="stylesheet" type="text/css" href="css/index.css"> <textarea id="textarea" value="{{value}}" placeholder="{{placeholder}}"></textarea> <textarea id="hidden_textarea"></textarea> </template> <script> Polymer({ ready: function() { var text = this.$.textarea; var hidden_text = this.$.hidden_textarea; text.onkeyup = function() { hidden_text.value = text.value + "\n"; var height =