Skip to content

Commit

Permalink
automatically convert <shadow></shadow> to <shadow><content></content…
Browse files Browse the repository at this point in the history
…></shadow>

See spec bug for discussion: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22460
  • Loading branch information
sorvell committed Nov 4, 2013
1 parent 6428abe commit f8d3ebb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/declaration/prototype.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
this.parseHostEvents();
// install external stylesheets as if they are inline
this.installSheets();
//
this.adjustShadowElement();
//
// TODO(sorvell): install a helper method this.resolvePath to aid in
// setting resource paths. e.g.
// this.$.image.src = this.resolvePath('images/foo.png')
Expand All @@ -83,6 +86,20 @@
this.prototype.registerCallback(this);
}
},
// TODO(sorvell): remove when spec addressed:
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=22460
// make <shadow></shadow> be <shadow><content></content></shadow>
adjustShadowElement: function() {
var content = this.templateContent();
if (content) {
var s$ = content.querySelectorAll('shadow');
for (var i=0, l=s$.length, s; (i<l) && (s=s$[i]); i++) {
if (!s.children.length) {
s.appendChild(document.createElement('content'));
}
}
}
},
// if a named constructor is requested in element, map a reference
// to the constructor to the given symbol
publishConstructor: function() {
Expand Down

0 comments on commit f8d3ebb

Please sign in to comment.