polymer

How to implement long-press event using Polymer1.0?

三世轮回 提交于 2020-01-24 04:34:26
问题 It seems like long-press event is not part of the Polymer's specifications. How would you implement that ? I thought about using a behavior and using down and up event with some debounce tricks to manage such a new event but that means I have to make a custom element to use this behavior and can't for example use it directly on any elements I want like : <div on-long-press="_cheese">...</div> which is not convenient. Would you have other solutions ? 回答1: You don't have to make a custom

polymer search input text from icon

南笙酒味 提交于 2020-01-23 12:25:47
问题 I am trying to do have a button (search) once click it would open a search box. It's pretty much the same thing that the polymer website does today: https://www.polymer-project.org/0.5/ How can I achieve that ? Thanks 回答1: Here is a solution based on the app-bar used in Polymers 1.0 documentation: <link rel="import" href="bower_components/polymer/polymer.html"> <link rel="import" href="bower_components/paper-icon-button/paper-icon-button.html"> <link rel="import" href="bower_components/iron

Is Polymer v1.0 compatible with phonegap build?

倾然丶 夕夏残阳落幕 提交于 2020-01-22 00:24:51
问题 Is Polymer v1.0 compatible with phonegap build? I tried to build the polymer starter kit but the build was not a success. 回答1: @Ahemed, Polymer is new and experimental. It works with only a few browsers. Phonegap, at this time, does NOT support polymer. Your questions are best directed to the one and only (as of the moment) meetup group in Silicon Valley on this subject. http://www.meetup.com/Web-Components-Silicon-Valley-Meetup/ Best of Luck. 来源: https://stackoverflow.com/questions/31636632

How to check if a browser supports shadow DOM

安稳与你 提交于 2020-01-21 10:50:26
问题 One way would be to check if there is a .shadowRoot property on an element, however I need to return a boolean before the page is rendered. 回答1: One simple feature test would be: if (document.head.createShadowRoot || document.head.attachShadow) { // I can shadow DOM } else { // I can't } This will work even if you include the script in the head section and assumes no malicious scripts were added prior to yours (a safe assumption). Currently, Chrome, Opera, and derived browsers (like Android

Converting HTML Entities from JSON to String

[亡魂溺海] 提交于 2020-01-16 22:24:22
问题 I'm using polymer and I'm new to it (just started using it today) and I have some troubles displaying data coming from JSON like   , ’ , &#8220 etc. HTML <news-card> <h1>{{summary.title}}</h1> <img src="{{summary.thumbnail}}"></img> <span>{{summary.published}}</span> <p>{{summary.summary}}</p> </news-card> Ex. JSON: { title: '’ This is a title', thumbnail: 'test.jpg', published: 'October 15' summary: '“    ' } Ex. Output: ’ This is a title October 15 “     回答1: I used custom filters to

Styling Polymer Web Components

人盡茶涼 提交于 2020-01-16 18:48:07
问题 How would you go about styling or refactoring this list, so that the clickable areas of the checkboxes do not interfere with each other? Is there a grouping container I am not aware of? <div layout vertical> <div layout horizontal> <paper-checkbox></paper-checkbox> <paper-item label="item 1"></paper-item> </div> <div layout horizontal> <paper-checkbox></paper-checkbox> <paper-item label="item 2"></paper-item> </div> <div layout horizontal> <paper-checkbox></paper-checkbox> <paper-item label=

Migrating Polymer project .5 to 1.0 error

半世苍凉 提交于 2020-01-16 05:53:05
问题 I am trying to migrate my project from polymer .5 to polymer 1.0. I have installed new version of polymer library, iron element & paper element. But I am getting following error: polymer-micro.html:63 Uncaught TypeError: prototype.registerCallback is not a function This page does not have any code like: Polymer('shape-menu',... Also, I have noticed that directory structure remains same for core elements. It did not changed to iron/ neon elements. So my code uses the same line to import htmls.

Polymer <paper-drawer-panel> nest 'drawer' inside 'main'

别来无恙 提交于 2020-01-16 05:23:04
问题 Alright, so as I see it, the proper element nesting for paper-drawer-panel should be something like this: <paper-drawer-panel> <paper-header-panel drawer> <!-- Side bar content --> <paper-menu>......</paper-menu> </paper-header-panel> <paper-scroll-header-panel main> <paper-toolbar class="tall"> </paper-toolbar> <div class="main-content"> <!-- Main app body content here --> </div> <!-- Main body content --> </paper-drawer-panel> The above hierarchy will give you something like this (current

Can't get website image

隐身守侯 提交于 2020-01-16 04:32:20
问题 I am using PhantomJS to capture an image of a website built using Polymer. Here is my capture.js file: var page = require('webpage').create(); page.open('https://www.gosizzle.io/token/recruiting/957e73c45b55129b1a', function() { page.render('test1.png'); phantom.exit(); }); However when I run phantomjs capture.js my test1.png only contains the footer of the website: 来源: https://stackoverflow.com/questions/35610392/cant-get-website-image

paper-ripple mouseDown event handler downAction Override

爱⌒轻易说出口 提交于 2020-01-16 03:41:23
问题 Polymer 1.1 In paper ripple source code they have the mouseDown event handler: /** @param {Event=} event */ downAction: function(event) { var xCenter = this.containerMetrics.width / 2; var yCenter = this.containerMetrics.height / 2; In documentation it states: paper-ripple listens to "mousedown" and "mouseup" events so it would display ripple effect when touches on it. You can also defeat the default behavior and manually route the down and up actions to the ripple element However, in my