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.

Adding reflectToAttribute to the demo doesn't work

See original GitHub issue
      static get properties() {
        return {
          foo: String,
          bar: Number,
          whales: { type: Number, reflectToAttribute: true }
        }
      }
whales: 🐳🐳🐳🐳🐳🐳🐳
          
$0.whales
7
$0.getAttribute("whales")
"0"

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
sorvellcommented, May 1, 2018

This is by design. With LitElement we explicitly wanted to make “properties” less powerful and more straightforward.

Property defaults should be set in the standard way, in the constructor. This is generally better for performance.

We also elected not to support observers or reflectToAttribute from PolymerElement instead preferring users to write this pretty standard code explicitly.

3reactions
sundar-rajavelucommented, May 29, 2018

Where in a heaven are these documented? I was breaking my head 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding reflectToAttribute to the demo doesn't work #10 - GitHub
@blikblum Here's how you can implement basic reflection (proof of concept, won't work with inherited properties). _shouldRender(props, changedProps ...
Read more >
setAttribute() doesn't work the way I expect it to - Stack Overflow
Documentation says this: Using setAttribute() to modify certain attributes, most notably value in XUL, works inconsistently, as the attribute ...
Read more >
Web Components API: Definition, Attributes And Props
Reflecting properties to attributes (and vice-versa). In some way, we have already described the relation between properties and attributes. Properties are the ...
Read more >
<input>: The Input (Form Input) element - HTML
The <input> HTML element is used to create interactive controls for web-based forms in order to accept data from the user; a wide...
Read more >
Proxy and Reflect - The Modern JavaScript Tutorial
A Proxy object wraps another object and intercepts operations, like reading/writing properties and others, optionally handling them on its ...
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