Giter Site home page Giter Site logo

Observable change error, when loading jquery.observable.js before jsrender.js, and using contextual parameters and sorted {{for}} about jsviews HOT 6 CLOSED

johan-ohrn avatar johan-ohrn commented on September 1, 2024
Observable change error, when loading jquery.observable.js before jsrender.js, and using contextual parameters and sorted {{for}}

from jsviews.

Comments (6)

BorisMoore avatar BorisMoore commented on September 1, 2024

Thanks, Johann. Another good find. That is a bug which arises in the case of having jquery.observable.js and jsrender.js and jquery,views.js as separate files, with jquery.observable.js loaded before jsrender.js. I have repro.

I believe that if you load jsrender.js first or use jsviews.js (single file) the issue will not occur.

I'll work to get a fix, then let you know here...

from jsviews.

johan-ohrn avatar johan-ohrn commented on September 1, 2024

Great! Once I have this fixed I can push the new version into production.

from jsviews.

BorisMoore avatar BorisMoore commented on September 1, 2024

Hi Johan, I think this should fix the issue:

jsviews2.zip

Let me know if it works for you.

(It also includes a fix to jsrender-node.js, and your issue #447 (comment))

from jsviews.

johan-ohrn avatar johan-ohrn commented on September 1, 2024

An other related potential? issue is the following. In jquery.views.js on line 3184:

contextOb = contextOb && $sub.tmplFn(delimOpenChar1 + ":" + contextOb[1] + delimCloseChar0, view.tmpl, true)(linkCtx.data, view);

The compiled function returned by tmplFn() have both j and u input parameters but the call only passes in data and the view. There are a number of places where a similar call is made without passing in the extra parameters. I can't actually remember if I had an issue with it or not.
Just letting you know for your consideration.

from jsviews.

BorisMoore avatar BorisMoore commented on September 1, 2024

You are right!! Thanks...

It is difficult to make a bug scenario that encounters that as an issue, but I managed to do so with this:

{^{on ~util[0].swap ...}}

which I will add to the unit tests.

So I have fixed it in the update below, to pass in $sub:

contextOb = contextOb && $sub.tmplFn(delimOpenChar1 + ":" + contextOb[1] + delimCloseChar0, view.tmpl, true)(linkCtx.data, view, $sub);

The u parameter is intended to be undefined, but in this update I have eliminated the ,u from the generated functions. I previously intended to use u for undefined in generated code, but I don't seem to be leveraging that any more, so I think it is OK to remove it.

Here is the update:

jsviews3.zip

from jsviews.

BorisMoore avatar BorisMoore commented on September 1, 2024

This has been fixed in new release v1.0.7

from jsviews.

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.