Skip to content
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

Make dom-bind not scope element classes. Fixes #1542 #1599

Merged
merged 1 commit into from
May 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/lib/template/dom-bind.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@
// where template content is filled in after creation
},

// avoid scoping elements as we expect dom-bind output to be in the main
// document
_scopeElementClass: function(element, selector) {
if (this.dataHost) {
return this.dataHost._scopeElementClass(element, selector);
} else {
return selector;
}
},

attached: function() {
if (!this._children) {
this._template = this;
Expand Down
14 changes: 14 additions & 0 deletions test/unit/styling-scoped.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@

<x-dynamic-scope></x-dynamic-scope>

<template id="bind" is="dom-bind">
<div id="dom-bind-static" class="static">static</div>
<span id="dom-bind-dynamic" class$="[[dynamic]]">[[dynamic]]</span>
</template>

<script>
suite('scoped-styling', function() {

Expand Down Expand Up @@ -178,6 +183,15 @@
assertComputed(styled.$.circle, '1px', 'strokeWidth');
});

test('dom-bind content is unscoped', function() {
var e = document.querySelector('#bind');
e.dynamic = 'dynamic';
var staticClassEl = document.querySelector('#dom-bind-static');
assert.equal(staticClassEl.className, 'static');
var dynamicClassEl = document.querySelector('#dom-bind-dynamic');
assert.equal(dynamicClassEl.className, 'dynamic');
})

if (window.Polymer && !Polymer.Settings.useNativeShadow) {

suite('scoped-styling-shady-only', function() {
Expand Down