question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Boolean attribute rendering differs from Preact

See original GitHub issue

Hi,

Boolean attribute rendering seems to differ from Preact itself (4.8.0 at least).

For example with the JSX: <div aria-hidden={true} />

preact: <div aria-hidden="true"></div> preact-render-to-string: <div aria-hidden></div>

http://jsfiddle.net/28ckgyzj/1/ (see console log)

(With ARIA attributes presence doesn’t indicate truth as it does with the checked attribute for example).

Thanks

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sventschuicommented, Jun 2, 2020

Thanks for the heads up @marvinhagemeister , that makes me confident to do the same workaround here as well. Will PR in a second

0reactions
marvinhagemeistercommented, Jun 2, 2020

We did a change in core a while back for aria attributes specifically. They need to be handled differently.

See https://github.com/preactjs/preact/pull/2347/files

Read more comments on GitHub >

github_iconTop Results From Across the Web

Boolean attribute rendering differs from Preact #4 - GitHub
Hi,. Boolean attribute rendering seems to differ from Preact itself (4.8.0 at least). ... (With ARIA attributes presence doesn't indicate truth as ...
Read more >
API Reference | Preact: Fast 3kb React alternative with the ...
The render() function is required for all components. It can inspect the props and state of the component, and should return a Preact...
Read more >
Using boolean-value of attributes in JSX - Stack Overflow
According to the HTML spec, there is no difference between data-enable-item=true and ...
Read more >
Knowledge: Attributes and properties - Open Web Components
preact does some detection to see if a property exists on the element, and will set the property instead of the attribute. When...
Read more >
Documentation - SolidJS · Reactive Javascript Library
assume this code is in a component function, so is part of a rendering ... The main difference is when you call the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found