Skip to content

Commit

Permalink
Fixed IE11 with the text content
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorik Kraaikamp committed Dec 11, 2017
1 parent 0a2244e commit 1cce1ad
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/dual-listbox.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<head>
<title>Dual listbox example</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.5.3/css/bulma.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.8.1/themes/prism.min.css" rel="stylesheet">
Expand Down Expand Up @@ -119,12 +120,13 @@ <h2 class="subtitle">Add options and add eventListeners <span class="source" dat
});

var sources = document.querySelectorAll('.source');
sources.forEach(function(source) {
for(var i = 0; i < sources.length; i++) {
var source = sources[i]
source.addEventListener('click', function(){
var code = document.querySelector('.' + source.dataset.source);
code.classList.toggle('open')
})
})
}
</script>
</body>
</html>
7 changes: 5 additions & 2 deletions src/dual-listbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class DualListbox {
addSelected(listItem) {
let index = this.available.indexOf(listItem);
if (index > -1) {
this.available.splice(index, 1);
// this.available.splice(index, 1);
this.selected.push(listItem);
this._selectOption(listItem.dataset.id);
this.redraw();
Expand Down Expand Up @@ -171,7 +171,10 @@ class DualListbox {
* Update the elements in the listbox;
*/
_updateListbox(list, elements) {
list.innerHTML = '';
while (list.firstChild) {
list.removeChild(list.firstChild);
}

for (let i = 0; i < elements.length; i++) {
let listItem = elements[i];
list.appendChild(listItem);
Expand Down

0 comments on commit 1cce1ad

Please sign in to comment.