Skip to content

Edge wipes static classname if id is dynamic #221

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

Closed
voces opened this issue Apr 10, 2018 · 6 comments
Closed

Edge wipes static classname if id is dynamic #221

voces opened this issue Apr 10, 2018 · 6 comments

Comments

@voces
Copy link

voces commented Apr 10, 2018

I am unsure if this is specific to hyperHTML, but I've been running into this annoying bug that only seems to occur on Edge. If I specify an element's id dynamically, the class is set to "" if class is statically defined.

The following work as expected:
<div id="test" class="test">Test</div>
<div id=${"test"} class=${"test"}>Test</div>
<div data-test=${"test"} class="test">Test</div>

The following does not:
<div id=${"test"} class="test">Test</div>

Here is a live JSFiddle example.

Generating this minimal, complete, and verifiable example led to working example 2, which is a fine, if ugly, workaround I can live with. I suspect this is entirely a third party (Edge) issue.

@WebReflection
Copy link
Owner

Edge, like the entire IE legacy, has so many workarounds for attributes you'd be surprised ... however, I gotta ask you something: why on earth would you need a dynamic ID ?

IDs are a very static/unique delicate matters on a page, I strongly suggest you don't do that, regardless this bug I'll eventually try to fix.

@WebReflection
Copy link
Owner

WebReflection commented Apr 11, 2018

I am slightly disgusted by the Edge issue I've just filed:
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/16878726/

You can find the minimal amount of code needed to make it fail:
https://codepen.io/WebReflection/pen/dmrKyO?editors=0010

I am not sure this is worth a fix if they act before next Edge upgrade ... IE doesn't seem to be affected though, IE8 works like a charm (probably first time in my life I say that).

@WebReflection
Copy link
Owner

@voces this has been fixed, together with hyper.Component which also was broken in Edge.

The second bug is here: chakra-core/ChakraCore#4970

The ID work around is tested and now covered. The script work around is ... I don't know, today I'm speechless regarding MS Edge.

@voces
Copy link
Author

voces commented Apr 11, 2018

I gotta ask you something: why on earth would you need a dynamic ID ?

Turned out I didn't. I originally had the ID set to something along the lines of `post-${post.id}`. I originally did it for direct linking, but I suppose I could have used name instead. I figured I'd file the bug report either way.

@WebReflection
Copy link
Owner

WebReflection commented Apr 11, 2018

I originally did it for direct linking, but I suppose I could have used name instead

No, this is actually a valid reason I didn't think about.

I figured I'd file the bug report either way.

Thank you for that. Even if this is an Edge bug, I've written a workaround for hyperHTML and file a bug in Edge browser so ... it's fixed!

Everybody wins here 🎉

@alexey13
Copy link

Damn! They not fixed that. Try this pen in Edge https://codepen.io/WebReflection/pen/dmrKyO
I have input in localdev and classname do not get a name.

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

No branches or pull requests

3 participants