-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[2.0-preview] dom-bind not working in preview #54
Comments
Same issue with Polymer 2.0.1 and iron-demo-helpers 2.0.0. |
Since the element is hybrid, when it uses Polymer 2 the demo page is broken. It seems this is a known issue related to the [iron-demo-helpers](PolymerElements/iron-demo-helpers#54).
Changing the following function fixes the issue, but I suspect it <demo-snippet>
<dom-bind>
<template>
<input type="checkbox" checked="{{opened::change}}">
<input type="checkbox" checked="{{opened::change}}">
</template>
</dom-bind>
</demo-snippet> demo-snippet.html // ...
_updateMarkdown: function() {
var template = Polymer.dom(this).queryDistributedElements('template')[0];
// Attempt to find any child node that represents a template
// This fixes utilizing dom-bind w/ a template
if (!template) {
template = Polymer.dom(this).querySelector('dom-bind > template, dom-repeat > template, dom-if > template');
}
// If there's no template, render empty code.
if (!template) {
this._markdown = '';
return;
}
var is = template.is || template.parentElement.tagName.toLowerCase();
var snippet = this.$.marked.unindent(template.innerHTML);
// Boolean properties are displayed as checked="", so remove the ="" bit.
snippet = snippet.replace(/=""/g, '');
this._markdown = '```\n' + snippet + '\n' + '```';
// Stamp the template.
if (['dom-if', 'dom-bind', 'dom-repeat'].indexOf(is) === -1) {
// Don't need to listen for more changes (since stamping the template
// will trigger an observeNodes)
Polymer.dom(this.$.content).unobserveNodes(this._observer);
this._observer = null;
Polymer.dom(this).appendChild(document.importNode(template.content, true));
}
},
// ... |
I'm experiencing this in demo-helpers v2.0.0. For example: <demo-snippet>
<template is="dom-bind">
<paper-input value="{{value}}"></paper-input>
<p>Value: <span>[[paper-input]]</span></p>
</template>
</demo-snippet> renders a blank snippet: But if I remove Is it a bug or is it by design? |
Why is this still not fixed? After applying those fixed, the PREVIEW is rendered, but the code snippet is not.. |
I think @masonlouchart means
That is an awfull lot off tags but at least it works ;p |
Using the Polymer v2.0.0-rc.2 with the iron-demo-helpers 2.0-preview, data binding within the template is not working.
This following used to work in Polymer v1.x:
To get this to work now I have to add an additional dom-bind wrapper inside the demo-snippet:
But now the dom-bind wrapping is also shown in the clipboard preview area.
The text was updated successfully, but these errors were encountered: