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.

Customize tags with inner html

See original GitHub issue

For example, https://ant.design/components/popconfirm/

// confirm, cancel are functions
<Popconfirm title="Are you sure delete this task?" onConfirm={confirm} onCancel={cancel} okText="Yes" cancelText="No">
    <a href="#">Delete</a>
</Popconfirm>

What I expect:

class Popconfirm(title: String, okText: String, cancelText: String, onConfirm: Event => Unit, onCancel: Event => Unit) extend SomeTrait {
  @some_anno override def render(body: Element): Element = ???
}

here render is the function used in macros.

But this test case(https://github.com/ThoughtWorksInc/Binding.scala/blob/11.0.x/fxml/.js/src/test/scala/com/thoughtworks/binding/DateSpec.scala) shows that <Date></Date> is Binding[Date] or another type relating to Date. It seems @fxml is not suitable for customizing tags to create something like Ant Design.

In https://github.com/ThoughtWorksInc/Binding.scala/issues/4#issuecomment-273739769 , there are tricks to make custom tags work, but it is without any inner html (eg. <a href="#">Delete</a>).

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
skaz1970commented, Oct 19, 2018

Is the syntax difference between custom tags and custom functions important for you?

If it is not important for you, you can simply create a popconfirm function and use it like this:

popconfirm(title="Are you sure delete this task?",
           onConfirm=confirm,
           onCancel=cancel,
           okText="Yes",
           cancelText="No") {
  <a href=" ">Delete</a >
}

Please, show the body (with return type) of popconfirm

0reactions
darcy-shencommented, Dec 30, 2018

I’m trying to implement the inner html feature in https://github.com/sadhen/Binding-SemanticUI

Read more comments on GitHub >

github_iconTop Results From Across the Web

innerHTML is not working for some tags like button or custom ...
Closed 4 years ago. Problem in interpolation when I assign some html tags(like button) or custom tag by angular interpolation then its not ......
Read more >
Element.innerHTML - Web APIs | MDN
The innerHTML property can be used to examine the current HTML source of the page, including any changes that have been made since...
Read more >
HTML DOM Element innerHTML Property - W3Schools
The innerHTML property returns: The text content of the element, including all spacing and inner HTML tags. The innerText property returns: Just the...
Read more >
JavaScript innerHTML
Summary: in this tutorial, you will learn how to use the JavaScript innerHTML property of an element to get or set an HTML...
Read more >
innerHTML and compatibility - Xul.fr
innerHTML is a property of any HTML element which has for value the content that is between the opening tag and ending tag....
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