From ebf31cac3535de1e9719dc70e2408d136954155d Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Mon, 19 Sep 2016 14:42:32 -0700 Subject: [PATCH] Add support for slot->content transformation. Need to bikeshed opt-in attribute (currently "auto-content") --- src/lib/annotations/annotations.html | 18 +++++++++++++ test/unit/polymer-dom-content.html | 40 ++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/src/lib/annotations/annotations.html b/src/lib/annotations/annotations.html index dcc2fd6a80..14c980f977 100644 --- a/src/lib/annotations/annotations.html +++ b/src/lib/annotations/annotations.html @@ -233,6 +233,9 @@ !node.hasAttribute('preserve-content')) { this._parseTemplate(node, i, list, annote); } + if (node.localName == 'slot' && node.hasAttribute('auto-content')) { + node = this._replaceSlotWithContent(node); + } // collapse adjacent textNodes: fixes an IE issue that can cause // text nodes to be inexplicably split =( // note that root.normalize() should work but does not so we do this @@ -267,6 +270,21 @@ } }, + _replaceSlotWithContent: function(slot) { + var content = slot.ownerDocument.createElement('content'); + var attrs = slot.attributes; + for (var i=0; i + + + + +