Commit af02f6ae authored by Phil Hughes's avatar Phil Hughes Committed by Jacob Schatz

Use cloneNode instead of createElement

parent 1a21fa26
......@@ -54,6 +54,11 @@
};
Project.prototype.initRefSwitcher = function() {
var refListItem = document.createElement('li'),
refLink = document.createElement('a');
refLink.href = '#';
return $('.js-project-refs-dropdown').each(function() {
var $dropdown, selected;
$dropdown = $(this);
......@@ -77,15 +82,18 @@
filterByText: true,
fieldName: $dropdown.data('field-name'),
renderRow: function(ref) {
var li = document.createElement('li');
var li = refListItem.cloneNode(false);
if (ref.header != null) {
li.className = 'dropdown-header';
li.textContent = ref.header;
} else {
var link = document.createElement('a');
link.href = '#';
link.className = ref.name === selected ? 'is-active' : '';
var link = refLink.cloneNode(false);
if (ref.name === selected) {
link.className = 'is-active';
}
link.textContent = ref.name;
link.dataset.ref = ref.name;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment