Skip to content

Commit

Permalink
copy over a selected list of attributes when wrapping non-brick-card …
Browse files Browse the repository at this point in the history
…elements
  • Loading branch information
kentaromiura committed Aug 8, 2014
1 parent e595f8b commit ce6dfc9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/deck.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,16 @@
//ensure the children is a brick-card (or wraps it with one)
function ensureIsCard(child){
if(child.tagName !== 'BRICK-CARD'){
var wrap = card.cloneNode();
var wrap = card.cloneNode(),
attributes = ['selected', 'transition-type'],
attribute;

for(var i=0, max=attributes.length; i<max; i++){
attribute = attributes[i];
if(child.hasAttribute(attribute)){
wrap.setAttribute(attribute, child.getAttribute(attribute));
}
}
child.parentNode.replaceChild(wrap, child);
wrap.appendChild(child);
}
Expand Down

0 comments on commit ce6dfc9

Please sign in to comment.