Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/multiselect.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@

(function() {
var multiselectPrototype = Object.create(HTMLElement.prototype);
console.log("Hello");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be removed?


/* Items property accessor */
Object.defineProperty(multiselectPrototype, 'items', {
Expand Down Expand Up @@ -214,6 +215,19 @@
this._field = this._root.querySelector('.multiselect-field');
this._popup = this._root.querySelector('.multiselect-popup');
this._list = this._root.querySelector('.multiselect-list');

var _this = this;
var observer = new MutationObserver(function(mutations) {
_this._root = _this.createRootElement();
_this._control = _this._root.querySelector('.multiselect');
_this._field = _this._root.querySelector('.multiselect-field');
_this._popup = _this._root.querySelector('.multiselect-popup');
_this._list = _this._root.querySelector('.multiselect-list');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe, init block should be extracted to avoid DRY violation. This will also allow us to get rid of _this variable.


_this.render();

});
observer.observe(this, { childList: true });
};

multiselectPrototype.initOptions = function() {
Expand Down