Skip to content

Conversation

PhilAndrew
Copy link

This pull request solves this problem.

You should use a MutationObserver
https://developer.mozilla.org/en/docs/Web/API/MutationObserver

If the contents of the web component changes, for example the

        <li value="1" selected>Item 1</li>
        <li value="2">Item 2</li>
        <li value="3" selected>Item 3</li>
        <li value="4">Item 4</li>

If I used Javascript to change the contents of this to

        <li value="1" selected>Item 1</li>
        <li value="2">Item 2</li>

Then it should update the displayed data again. So if I use javascript to change the contents then it should update again.

@@ -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?

_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.

@tabalinas
Copy link
Owner

@PhilAndrew, thank you for the contribution!
Could you please address a couple of comments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants