polymer

Change youtube video ID without page reloading

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-02 10:34:28
问题 This question is about scripting the main youtube site, client side from javascript. While it looks easy as a click, I found no way to change the current video by a new non in context video ID without reloading. This seems to be related with the polymer library in use, with a lot of shadow dom and some special behavior. Here is the context: I am making for my own use a bookmarklet that load videos from the reddit json api , wich supports CORS calls. So far so good, I can load many videos,

In Polymer 2.0 how to observe edits to properties of an object bound to an element inside dom-repeat?

孤街醉人 提交于 2020-01-02 09:19:10
问题 (This question and code sample is for Polymer 2, but it's possible the same issue is present in 1.x) The Goal: I want to create an element (the Editor) that allows viewing/editing of the properties of certain types of objects, and another element (the List) that displays editable arrays of these objects, delegating the viewing/editing to the Editor element, while retaining control over the addition/removal of obejcts from the list. A to-do list is a good example of this (note: the Polymer to

Polymer JS conflicts with Rails Turbolinks

瘦欲@ 提交于 2020-01-02 06:09:46
问题 Trying to use PolymerJs with a Ruby on Rails project with Turbolinks enabled. The initial loading of Polymer components works,but when I click on a link the new page renders, but my Polymer components are not reinitialized. Instead they look as if no JS has been run on them at all. I am loading polymer components and platform in the header, so they are not loaded with the 'page changes' (this is how turbolinks works - it only reloads the body). I seem to be able to 'fake it' by doing the

Polymer core-ajax won't post JSON?

别来无恙 提交于 2020-01-02 05:19:27
问题 I'm using core-ajax to retrieve JSON data just fine. Turning the component around to post back to the server as JSON is another thing altogether. In all cases, and irrespective of the contentType or handleAs parameters passed in, it appears that my JSON object I'm passing in as an input is being converted back to key=value in the server headers. The code: var ajax = document.querySelector('core-ajax'); ajax.method = 'POST'; ajax.handleAs = 'JSON'; ajax.contentType = 'application/json'; ajax

app-localize-behavior and shared localization cache

只谈情不闲聊 提交于 2020-01-02 03:47:35
问题 According to the polymer documentation for app-localize-behavior Each element that displays content to be localized should add Polymer.AppLocalizeBehavior. All of these elements share a common localization cache, so you only need to load translations once . In the following snippet (adapted from this answer) does not find the shared resources in the tag Maybe I missed something ? <!DOCTYPE html> <html> <head> <base href="https://polygit.org/polymer+:master/components/"> <script src=

Iron Ajax - How to access Response from on-response function?

不问归期 提交于 2020-01-02 03:39:27
问题 I have this element: <template> ... <iron-ajax id="ajax" url="..." handle-as="json" verbose=true last-response={{ajaxResponse}} loading="{{cargando}}" on-response="_handleResponse"> </iron-ajax> <div id="resultado"></div> </template> <script> Polymer({ ... _handleResponse: function(event){ console.log("_handleResponse... "); // this.$.resultado.innerHTML = event.detail.innerHTML; } }); </script> The response I see in Firebug is: <p>Hello word</p> I want to access the response in

What are difference between hostAttributes and properties in polymer?

心不动则不痛 提交于 2020-01-02 01:37:06
问题 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 ? 回答1: 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

How do you bind Polymer elements to a Model in ASP.NET

删除回忆录丶 提交于 2020-01-01 17:26:20
问题 I have no problems displaying my model in a View using Polymer, for example: <paper-icon-item> <iron-icon icon="communication:phone" item-icon></iron-icon> <paper-item-body two-line> <div>@Model.PhoneNumber</div> <div secondary>Phone Number</div> </paper-item-body> </paper-icon-item> but I just do not get the bindings right for input //this does not work <paper-input label="Phone Number">@Model.PhoneNumber</paper-input> //nor this <paper-input is="iron-input" label="Phone Number">@Model

How do you bind Polymer elements to a Model in ASP.NET

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-01 17:26:07
问题 I have no problems displaying my model in a View using Polymer, for example: <paper-icon-item> <iron-icon icon="communication:phone" item-icon></iron-icon> <paper-item-body two-line> <div>@Model.PhoneNumber</div> <div secondary>Phone Number</div> </paper-item-body> </paper-icon-item> but I just do not get the bindings right for input //this does not work <paper-input label="Phone Number">@Model.PhoneNumber</paper-input> //nor this <paper-input is="iron-input" label="Phone Number">@Model

How to two-way bind iron-input to dom-repeat's item?

≯℡__Kan透↙ 提交于 2020-01-01 10:05:56
问题 I just started playing with Polymer 1.0 and am trying to do a very simple binding to collection. I am able to display text within dom-repeat, but the two-way binding to iron-input does not work. I tried array of strings, and objects. No luck. <link rel="import" href="bower_components/polymer/polymer.html"> <link rel="import" href="bower_components/iron-input/iron-input.html"> <dom-module id="hello-world"> <template> <ul> <template is="dom-repeat" items="{{data}}"> <li>{{item.value}}</li> <