-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
select attr is "reset" with FF #148
Comments
this is the most horrifying Firefox bug I've ever seen to date: |
Filed a bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1421260 |
Argh! Will get it prioritized and fixed. |
I saw the bug has been confirmed. In the meantime my ugly workaround is the following one: class Foo {
static init() {
const render = hyperHTML.bind(document.querySelector("foo"));
const state = {
items: [
{ id: 1, text: "foo" },
{ id: 2, text: "bar" },
{ id: 3, text: "baz" }
],
selectedItem: 2
};
const node = render`
<select>${
state.items.map(item => hyperHTML.wire()`
<option value="${item.id}">
${item.text}
</option>
`)
}</select>
`;
document.querySelector(`option[value='${state.selectedItem}']`).selected = true;
}
}
setInterval(Foo.init, 100); Live example: https://plnkr.co/edit/6Guxg7nEIYPzJmt5IaZR?p=preview Tested also in my complex use case and it works correctly. |
it's a diffing algorithm issue, if you use majinbuu engine instead, everything is fine without needing workarounds. |
Bug resolved in FF 58.0b8. :) P.S. No, I am sorry, I see ghosts. It is not resolved. Sorry for the noise. |
I am planning to implement domdiff as universal solution for hyperHTML so that current engine will go and majinbuu won't be needed. That should also, hopefully, solve, this issue forever, even on older FF. |
actually ... never mind: https://codepen.io/WebReflection/pen/EbMwwV?editors=0010 this bug affects Vue.js and Preact with keyed elements too ... this is very bad |
P.S. @albertosantini if you used wires properly thought, you wouldn't have experienced any of this. You are trashing options every time. It's still a FF bug, but you should never trash nodes when it's possible. |
What is the reason behind this decision? |
nobody is writing hyperHTML engines and AFAIK nobody uses hyperhtml-majinbuu but the point is that current default engine doesn't scale in terms of performance and neither does majinbuu. Instead of having all these hybrid, not fully usable solutions for this or that case, I'd rather use what Vue.js On top of that, removing complexity and abstractions with 3rd parts engines, will reduce the library size closer to 4K instead of 5K |
in case anyone is curious about engine-less edition of hyperHTML: |
Work-around for WebReflection/hyperHTML#148 - Resolves #46
In FF (57+) the selected item toggles between the correct one,
bar
, and the first onefoo
.With Chrome (62.x), it works as expected:
bar
is always selected (and displayed).I read again the documentation about boolean attrs. :)
Am I missing anything here?
Live example: https://plnkr.co/edit/evFbsDnoN7iwooJpqw33?p=preview
The text was updated successfully, but these errors were encountered: