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.

setAttribute being applied to parent

See original GitHub issue

I have the following code

    div(classes = setOf("alert", "alert-dismissible")) {
                maxWidth = 20.rem
                button(text = "×", classes = setOf("close")) {
                    setAttribute("data-dismiss", "alert")
                }
            }
    }

which I’m expecting to add a data-dismiss attribute to the button, but is actually being applied to the parent div.

Is this correct behaviour? Is it possible to achieve without wrapping the button in another div?

Many Thanks.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
rjaroscommented, Jun 3, 2019

I’ve commited support for custom attributes for the Component interface and the Widget class, so it will be available for all KVision components.

1reaction
rjaroscommented, Jun 20, 2019

Sorry for the late answer but I had to earn some money for my life, and had little time for other things 😉 Now I’m getting ready for KVision and the new release will be very soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

jquery - How do I set a the attribute of a parent element to be ...
It's a fairly odd situation because my google skills have completely failed me, and I know the solution is probably so simple to...
Read more >
Element.setAttribute() - Web APIs | MDN
setAttribute () Sets the value of an attribute on the specified element. If the attribute already exists, the value is updated; otherwise a...
Read more >
Setting attribute in editingDowncast or getting parent element ...
I need to apply attribute proporcja to element based on parent element. Down there is my code. Problem is that this attribute is...
Read more >
Get Attribute of a Parent Node using JavaScript | bobbyhadz
To get an attribute of a parent node, select the child element and use the `parentElement` property to get access to the parent...
Read more >
Reflect JavaScript Properties to HTML Attributes
This example exposes title as a public property. It converts the title to uppercase and uses the property privateTitle to hold the computed...
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