Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
auto-calculate typeExtension.
Browse files Browse the repository at this point in the history
  • Loading branch information
sorvell committed Oct 21, 2013
1 parent d6cf73f commit 515c583
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/ShadowCSS.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ var ShadowCSS = {
// 2. optionally tag root nodes with scope name
// 3. shim polyfill directives /* @polyfill */ and /* @polyfill-rule */
// 4. shim @host and scoping
shimStyling: function(root, name, extendsName, typeExtension) {
shimStyling: function(root, name, extendsName) {
var typeExtension = this.isTypeExtension(extendsName);
// use caching to make working with styles nodes easier and to facilitate
// lookup of extendee
var def = this.registerDefinition(root, name, extendsName);
Expand Down Expand Up @@ -201,6 +202,9 @@ var ShadowCSS = {
}
return def;
},
isTypeExtension: function(extendsName) {
return extendsName && extendsName.indexOf('-') < 0;
},
applyScopeToContent: function(root, name) {
if (root) {
// add the name attribute to each node in root.
Expand Down
6 changes: 3 additions & 3 deletions test/html/styling/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
var typeExtension = extnds && extnds.indexOf('-') < 0;
var names = calcExtendsNames(name);
if (window.ShadowDOMPolyfill) {
shim(templates, names, typeExtension);
shim(templates, names);
}

var config = {
Expand Down Expand Up @@ -45,10 +45,10 @@
return document.querySelector('#' + name);
}

function shim(templates, names, typeExtension) {
function shim(templates, names) {
var n = names[names.length-1];
var template = templateForName(n);
Platform.ShadowCSS.shimStyling(template ? template.content : null, n, extendsRegistry[n], typeExtension);
Platform.ShadowCSS.shimStyling(template ? template.content : null, n, extendsRegistry[n]);
}

scope.register = register;
Expand Down

0 comments on commit 515c583

Please sign in to comment.