Skip to content

Commit

Permalink
final
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurovrata V committed May 18, 2021
1 parent 955490c commit a73ca70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions hybrid-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,8 @@ GitHub: https://github.com/aurovrata/hybrid-html-select
_.init(false); //invole init function but do not initialise.
}
//method to initialise options.
hsProtype.extractOptions = function(list,idx=0){
let _ = this,
opts = [],
defhso;
hsProtype.extractOptions = function(list,opts=[]){
let _ = this, defhso, idx=opts.length;
[].forEach.call(list,(o,i) => {
//TODO: check if o is optgrp, and loop over.
if(_.opt.listOption(o,i+idx) !== true) return;
Expand All @@ -140,7 +138,8 @@ GitHub: https://github.com/aurovrata/hybrid-html-select
hso.innerHTML =_.opt.optionLabel(o.label);
hso.classList.add('hybrid-option-group');
opts[opts.length] = hso;
opts = opts.concat(_.extractOptions(o.children, opts.length));
// opts = opts.concat(_.extractOptions(o.children, opts));
_.extractOptions(o.children, opts);
break;
default:
//preserve select options attributes.
Expand Down
4 changes: 2 additions & 2 deletions test.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ <h1 class="title">Custom Select: "Hybrid Select"</h1>
sel= document.querySelectorAll('.select-native');
sel.forEach((s)=>{
new HybridSelect(s,{
dropdown: 'landscape'
})
// dropdown: 'landscape'
});
})
});
document.querySelector('.button').addEventListener('click', (e)=>{
Expand Down

0 comments on commit a73ca70

Please sign in to comment.