Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Add more serialization blacklisted classes; this is ad hoc until we h…
Browse files Browse the repository at this point in the history
…ave a better way to do this.
  • Loading branch information
sorvell committed Apr 28, 2014
1 parent 1e4620a commit c7095e3
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions elements/x-dom-serializer/x-dom-serializer.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<polymer-element name="x-serializer">
<script>
(function() {
Polymer('x-serializer', {
tab: ' ',
attributesBlacklist: ['style', 'tabindex', 'role', 'classname'],
Expand Down Expand Up @@ -102,9 +103,11 @@
}
}
var v = attributes['class'];
v = v ? v.replace(/selected-element/g, '') : null;
if (v && (v.trim() == 'selected')) {
v = '';
if (v) {
for (var i=0, c; (c=blackListedClasses[i]); i++) {
v = v.replace(c, '');
}
v = v.trim();
}
attributes['class'] = v || null;
},
Expand All @@ -113,6 +116,13 @@
return binding ? '{{ ' + binding + ' }}' : node.textContent;
}
});

// TODO(sorvell): This is ad hoc. We need a way to know what classes
// should not be serialized.
var blackListedClasses = ['selected-element', 'core-selected',
'core-light-theme', 'core-dark-theme'];

})();
</script>
</polymer-element>

Expand Down

0 comments on commit c7095e3

Please sign in to comment.