Code Monkey home page Code Monkey logo

Comments (11)

Atry avatar Atry commented on May 20, 2024

I don't like tricks like this.
I would suggest you not to use custom tags like that. You should create simple custom functions instead.

from binding.scala.

sb-minimal avatar sb-minimal commented on May 20, 2024

Ok, but how do i get Binding.Scala to emit <ons-page><ons-toolbar></ons-toolbar></ons-page> even with a "simple custom function" ?

from binding.scala.

Atry avatar Atry commented on May 20, 2024

Something like onsPage(onsToolbar())

from binding.scala.

sb-minimal avatar sb-minimal commented on May 20, 2024

Yes, but how to i implement onsPage? It somehow has to produce Binding.Scala compatible tags of the kind <ons-page> on the browser.
Obviously
@dom onsPage() = { <ons-page></ons-page> }
does not work.

from binding.scala.

Atry avatar Atry commented on May 20, 2024

Let your onsPage function return a org.scalajs.dom.raw.Node or Binding[org.scalajs.dom.raw.Node]

from binding.scala.

da-liii avatar da-liii commented on May 20, 2024

@sb-minimal
It seems <ons-page>${innerHTML}</ons-page> is not supported.
But <ons-page></ons-page> is supported.

see my https://github.com/sadhen/Binding-SemanticUI for example

from binding.scala.

Atry avatar Atry commented on May 20, 2024

@sadhen , I guess @sb-minimal means custom HTML tags, which is not what you are talking about.

from binding.scala.

sb-minimal avatar sb-minimal commented on May 20, 2024

guess I am getting something completely wrong.
I tried:

  def onsPage(content: BindingSeq[Node]) = {
    val element=document.createElement("ons-page")
    content.map{ c =>
      element.appendChild(c)
    }
    element
  }


  def onsToolbar(content: Node) = {
    document.createElement("ons-toolbar")
  }

  val pageTitle: Var[String]=Var("Titel")

  @dom
  def app = {
    <div> {
      onsPage(Seq(
        onsToolbar(
          <div class="left">back</div>
          <div class="center">{ pageTitle.get } </div>
        ),
        <p>
          content
        </p>
      ))
      }
    </div>
  }

getting

type mismatch;
[error]  found   : com.thoughtworks.binding.Binding.BindingSeq[org.scalajs.dom.raw.Node]
[error]  required: org.scalajs.dom.raw.Node
[error]   @dom
[error]    ^
[error] one error found

Is document.createElement("ons-page") even the correct way to produce the org.scalajs.dom.raw.Node?
Would be very helpful if you could point me to some example code or could give a simple implementation for onsPage().

from binding.scala.

Atry avatar Atry commented on May 20, 2024

You can use NodeSeqMountPoint at the moment. See https://scalafiddle.io/sf/gII6UlB/0

from binding.scala.

Atry avatar Atry commented on May 20, 2024

However, I guess it would be good if we have a special syntax to disable tag name checking, like the data: prefix for attributes. https://github.com/ThoughtWorksInc/Binding.scala#custom-attributes

from binding.scala.

Atry avatar Atry commented on May 20, 2024

Fixed in #110

from binding.scala.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.