Coder Social home page Coder Social logo

Comments (4)

eavichay avatar eavichay commented on May 20, 2024

@tcmacdonald Thanks for the update.
Which slim.js version are you working with?

Currently there are no automated tests on safari (only in chrome). AFAIK Safari worked just fine as there is a custom detection for non-chrome browsers for a different behaviors with repeaters. I will try to use several versions and see what went wrong (or maybe Safari made an update in their rendering engine).

Meanwhile until this is resolved - as a workaround

If the options are static and no need for real-time binding you could try to do hybrid rendering:

Slim.tag('my-tag', class extends Slim {
  get template() {
    return `<select>${this.items.map(createItemOption)}</select>`
  }
})

function createItemOption (item) {
  return `<option value="${item.value}">${item.label}</option>`
}

if you need a "live update", you can execute render and force it to redraw and re-bind. This is more expansive in terms of CPU but as long as the list is decent (not thousands) the user should not feel anything.

from slim.js.

tcmacdonald avatar tcmacdonald commented on May 20, 2024

Thanks for the feedback @eavichay. I'm using version 3.2.3.

I played around with your suggested workaround. My array of options is being populated asynchronously so a redraw/rebind is really intriguing.

Whenever I invoke render() with a really simple template, it works just fine but when I try to redraw something more complex, it throws the following exception...

this.render(this.template);

// Cannot read property 'chain' of undefined at Function.bind (Slim.js:325)

I assume I'm doing this wrong. Can you point me at any examples?

from slim.js.

eavichay avatar eavichay commented on May 20, 2024

Thanks for the feedback. Please try upgrade to 2.3.4 I just released a fix. Your description may point out another potential bug. If you can please provide your full class code (Are you using Slim.tag or decorators?).

from slim.js.

eavichay avatar eavichay commented on May 20, 2024

@tcmacdonald Sorry, fixed in 2.3.6

from slim.js.

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.