polymer

Polymer Chip-to-Card Pattern with core-animated-pages and a Long List

核能气质少年 提交于 2019-12-21 07:03:02
问题 Generally I'm finding it difficult to use the core-animated-pages Polymer element to implement a chip list to card type pattern when I have a very long list that scrolls the page. I think the difficulty is that once the transition has finished, the hidden portion is taken out of the layout and I'm having a hard time figuring out a way around this. Easy Illustration JSFiddle: http://jsfiddle.net/hmknv3jh/ On the output, scroll to the bottom and click a chip, the problem should be obvious.

ContentEditable in Shadow DOM?

有些话、适合烂在心里 提交于 2019-12-21 05:11:18
问题 I'm trying to create a Polymer element for contenteditable. I create a contenteditable div, place this.innerHTML there, and it becomes editable. All good with polyfills, e.g. in Firefox. But it doesn't work in Chrome 35 with native Shadow DOM. Well, it is still editable, but neither document.execCommand nor window.getSelection is working. document.execCommand does nothing. window.getSelection().getRangeAt(0).toString() is defined but empty. No error is shown. So I cannot style the selection.

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 ).

Polymer Iron Ajax - How to access Response from Request after Error Event?

余生颓废 提交于 2019-12-21 03:59:31
问题 I use iron-ajax: <iron-ajax id="postLoginForm" method="POST" verbose url="../../login" content-type="application/json" handle-as="json" on-response="_handleLoginResponse" on-error="_handleErrorResponse"></iron-ajax> The server always responds with an error if the request body is empty: Error: The request failed with status code: 422 This triggers my _handleErrorResponse method in which I would like to access the actual response, which looks like this: {"email":["The email field is required."]

How to make a polymer element draggable

此生再无相见时 提交于 2019-12-21 03:55:14
问题 I'm trying to enable HTML5 drag and drop on a custom polymer element but it doesn't work. Without polymer it's possible to just add the draggable attribute. Here is my code in Dart: my_component.html <polymer-element name="my-component"> <template> <style> @host { :scope { display: block; } } div { background-color: red; width: 200px; height: 200px; } </style> <div> Drag me </div> </template> <script type="application/dart" src="my_component.dart"></script> </polymer-element> my_component

confused about the polymer published attributes

久未见 提交于 2019-12-20 07:24:01
问题 I have dig to the ajax-core element of polymer, code like the follows works fine: <core-ajax url="./ajax-test.txt" auto response="{{resp}}"></core-ajax> <textarea value="{{resp}}"></textarea> I can get the value from {{resp}} in this case. I have dig into the core-ajax source code and find out how it has been done: make response a published attribute by setting attributes="response ..." pass the ajax response to this.response then I tried to build my own ajax component but it didn't worked,

Nested Polymer Components Content Issue

被刻印的时光 ゝ 提交于 2019-12-20 07:14:18
问题 foo.html: <link rel="import" href="bar.html"> <dom-module id="p-foo"> <template> <p-bar> <content select=".myContent"></content> </p-bar> </template> <script> Polymer( { is: 'p-foo', } ) </script> </dom-module> bar.html: <dom-module id="p-bar"> <template> bar open <content select=".myContent"></content> bar closed </template> <script> Polymer( { is: 'p-bar', } ) </script> </dom-module> demo.html: <!DOCTYPE html> <html> <head> ... <link rel="import" href="foo.html"> </head> <body> <p-foo><div

Tutorial: solution for node.js / Polymer i18n based on L20n library

荒凉一梦 提交于 2019-12-20 07:04:16
问题 There is a rather usual problem to implement i18n in node.js web project. The problem seems even worse if you want to: use web components (like Polymer) use single translation file for server-side and client-side files translate some items programmaticaly (like dynamically created strings) Thanks to brand-new L20n library developed by Mozilla team this problem can be solved rather easily. 回答1: Project structure First I created a project structure, that would keep my files separatedly, grouped

Modify iron-form JSON before submitting

百般思念 提交于 2019-12-20 06:30:28
问题 I'm wondering if it is possible to edit the JSON file of an iron-form before submitting it? For instance, if I want to add an array which doesn't come from any of the form input, or if I want to add a unique key in it... If it is possible, I believe it would be during the form pre-submit, but the documentation says nothing about "how to intercept the JSON" or something like that. Thanks! 回答1: You could modify the iron-form 's request object in the iron-form-presubmit event handler. For POST