polymer-1.0

MouseEvent.path equivalent in Firefox & Safari

血红的双手。 提交于 2019-12-03 05:15:14
I'm using Polymer 1.0 and when there is a click on a button in Chrome a MouseEvent is generated. This MouseEvent object has a path property which is an ordered array of parent elements to the clicked button. In Firefox & Safari, however, a click is generated which does not have a path property. Is there an equivalent property of the click object which gives me the same information? It's not available, but if you really would like to have this property, then you could extend the native prototype of the Event object like so: if (!("path" in Event.prototype)) Object.defineProperty(Event.prototype

Best way to communicate between instances of the same web component with Polymer?

爷,独闯天下 提交于 2019-12-03 00:58:34
I'm trying to sync some of my web component properties between instances of the same element so if one of this properties changes then the same property gets updated in all the instances with the corresponding binding and events. Note: I want to use the Polymer Data System Concepts for the communications between instances. Example my-element.html <dom-module id="my-element"> <script> Polymer({ is: 'my-element', properties: { myProp: { type: String, notify: true } }); </script> </dom-module> my-other-element.html <dom-module id="my-other-element"> <template> <my-element my-prop="{{otherProp}}">

How to enforce required paper-radio-group in Polymer?

心已入冬 提交于 2019-12-02 22:49:55
问题 What's the best way to enforce require check on paper-radio-group ? I saw another question and answer that uses fallback-selection , here, but I want to force the user to choose "yes" or "no". <paper-radio-group selected="" attr-for-selected="value" data-required="{{question.required}}"> <paper-radio-button name="{{question.id}}" value="yes">Yes</paper-radio-button> <paper-radio-button name="{{question.id}}" value="no">No</paper-radio-button> </paper-radio-group> The only way I can think of,

Polymerfire <firebase-app> element crashes app

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 16:24:32
问题 I just added the new Polymerfire <firebase-app> element to my (Polymer 1.x + Firebase 3.x) project and it crashed the project. I expected to see the home screen load on localhost but, instead, I just get a blank screen and console error. my-element.html <firebase-app auth-domain="my-app-id.firebaseapp.com" database-url="https://my-app-id.firebaseio.com/" api-key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"> </firebase-app> The console log reports the following error: Console.log firebase-app

Stretch image in iron-image element

天涯浪子 提交于 2019-12-02 13:12:12
问题 I have an element inside a div : <div style="width:330px;"><iron-image src="image.png"></iron-image></div> . The image is 315px in width and 237px height. I want this image to stretch and make it 330px in width as it the container that is inside of, and the height to be auto to do not break the image ratio. I have tried this : iron-image { width:330px; height:auto; } iron-image img { width:330px; height:auto; } And : <div style="width:330px;"><iron-image src="image.png" style="width:330px

how to use map.locate with Polymer 1.0 / leaflet-map 1.0

天大地大妈咪最大 提交于 2019-12-02 11:39:22
问题 I am new to both Polymer and Leaflet's web component. I would like to have a button that toggles the geolocation function given by Leaflet. Using Leaflet in a Javascript/HTML/css application I would know how to do this but I can't get it to work using Polymer 1.0. Here is my map element. My attempt to call map.locate is commented out in the element registration: <dom-module id="my-maps"> <style> ... </style> <template> <leaflet-map id="thismap" latitude="{{latitude}}" longitude="{{longitude}}

Polymer this.push not working

谁说我不能喝 提交于 2019-12-02 09:17:28
问题 In Polymer 1.x I am trying to push data from my database to an array, but for whatever reason, it suddenly stopped working. When running this code ready: function(){ var leserbriefRef = firebase.database().ref('leserbriefe'); leserbriefRef.on('value', function(snap) { var n = snap.child('numLeserbriefe').val(); console.log(n); this.lbriefe = []; for(var i=0; i<n; i++){ this.push("lbriefe", snap.child('l'+(n - 1 - i)).val()); } }); } I get this error message: firebase.js:283 Uncaught TypeError

Polymerfire <firebase-app> element crashes app

核能气质少年 提交于 2019-12-02 08:20:44
I just added the new Polymerfire <firebase-app> element to my (Polymer 1.x + Firebase 3.x) project and it crashed the project. I expected to see the home screen load on localhost but, instead, I just get a blank screen and console error. my-element.html <firebase-app auth-domain="my-app-id.firebaseapp.com" database-url="https://my-app-id.firebaseio.com/" api-key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"> </firebase-app> The console log reports the following error: Console.log firebase-app.html:94 Uncaught ReferenceError: firebase is not defined The relevant line of code (line #94) is the

How to enforce required paper-radio-group in Polymer?

天涯浪子 提交于 2019-12-02 07:44:41
What's the best way to enforce require check on paper-radio-group ? I saw another question and answer that uses fallback-selection , here , but I want to force the user to choose "yes" or "no". <paper-radio-group selected="" attr-for-selected="value" data-required="{{question.required}}"> <paper-radio-button name="{{question.id}}" value="yes">Yes</paper-radio-button> <paper-radio-button name="{{question.id}}" value="no">No</paper-radio-button> </paper-radio-group> The only way I can think of, is to run a checker function at the end to check for it specifically. checkAnswers: function() { var

Is Polymer v1.0 compatible with phonegap build?

孤者浪人 提交于 2019-12-02 06:45:14
Is Polymer v1.0 compatible with phonegap build? I tried to build the polymer starter kit but the build was not a success. @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/is-polymer-v1-0-compatible-with-phonegap-build