Skip to content

Commit

Permalink
Merge pull request #1599 from Polymer/1542-fix
Browse files Browse the repository at this point in the history
Make `dom-bind` not scope element classes. Fixes #1542
  • Loading branch information
kevinpschaaf committed May 23, 2015
2 parents ee6d397 + 218fb79 commit d198c4e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
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

0 comments on commit d198c4e

Please sign in to comment.