You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use Polymer.import helper to dynamically load some documents with Polymer Elements nested deeper inside. With native HTMLLinkElement#onload I could easyli access imported content to use it:
link.onload=function(){// Insert template into DOM.vartemplate=this.import.querySelector("template");
live example here
And it works like charm, except the problem with
Attributes on my-element were data bound prior to Polymer upgrading the element. This may result in incorrect binding types.
As onload may be called before Polymer upgrades the polymer elements. So I need either to hack it with Polymer's internal queue or at least with Polymer.whenReady like here or finally use Polymer.import which seems nice and clean.
However it does not give a reference to imported document neither with this nor via arguments.
So I need to write every time:
+1. In a current project, I've also been using document.querySelector to get back the import that was added but Polymer.import should just pass this info in the callback.
I'm trying to use
Polymer.import
helper to dynamically load some documents with Polymer Elements nested deeper inside. With nativeHTMLLinkElement#onload
I could easyli access imported content to use it:live example here
And it works like charm, except the problem with
As
onload
may be called before Polymer upgrades the polymer elements. So I need either to hack it with Polymer's internalqueue
or at least withPolymer.whenReady
like here or finally usePolymer.import
which seems nice and clean.However it does not give a reference to imported document neither with
this
nor viaarguments
.So I need to write every time:
live
What doesn't look that nice, and may hit the performance.
I suggest adding array of corresponding
HTMLLinkElement
s as callback argument:So
Polymer.import
could be used as and alternative to native.onload
.The text was updated successfully, but these errors were encountered: