Giter Club home page Giter Club logo

distal's People

Contributors

mocking avatar

Watchers

 avatar

distal's Issues

qtext with zero-values

Using qtext when value might be a zero requires a workaround since distal 
assumes the value to be non-existent and hides element instead of showing it 
with a zero.

Example:

{items: []}

<div data-qtext="items.length"></div>

Result: <div> is hidden

Expected result: <div>0</div>

Original issue reported on code.google.com by [email protected] on 24 Sep 2012 at 12:02

Performance

I apologize in advance since this is kindof vague and unfair.  But is there 
anyway to improve performance?  Distal looks simple and promising but based on 
comparative template solutions this is extremely slow.

Take a look at 
http://jsperf.com/transparency-vs-weld-vs-mustache/10
and
http://jsperf.com/transparency-vs-handlebars-finite-list/4
to see what I mean.
Perhaps you can precompile the template or cache it or something along those 
lines for reuse.

Also- And this is really off topic and even more unfair.. I am big fan of SVN 
and all, but github just has so much more exposure for open-source projects 
like this, and allows for forks, and pull-requests, etc.  Also, they have 
hosting which means your nice documentation can also look nice.

Original issue reported on code.google.com by [email protected] on 28 Mar 2012 at 5:37

Modifying data in beforeText

I am looking for a way to manipulate the data for an element in the 
distal.beforeText() callback but is unable to do so.
I suspect this to be because the arguments to the callback is passed as value 
and not by reference.

Please let me know if there's any to achieve what I want, in another way.

best regards.

Original issue reported on code.google.com by [email protected] on 20 Mar 2012 at 3:51

Suggesstion: use a template for repeating elements

The current behaviour of cloning elements containing data-qrepeat is simple and 
great, however, it has some drawbacks:

Some UI toolkits such as jQuery Mobile modify the DOM after it has been loaded. 
Sometimes they modify the structure so hard, that Distal cannot find it's 
data-qrepeat element again, if the app wants to apply distal() on a list a 
second time.

Example: I have an unordered list of jQuery Mobile checkboxes:
<ul id="mylist">
  <li data-qrepeat="e myelements">
    <label data-qtext="e.name"><input type="checkbox></label>
  </li>
</ul>

When I run $("#mylist").distal(json) for the first time, everything is fine: at 
first, Distal expands the DOM, then jQuery Mobile runs its hooks to modify the 
DOM structure to turn the <label> and <input> elements into a series of spans 
and divs that make the checkboxes look good.

However, now we no longer have the "template" DOM element to run Distal again, 
because jQuery removes the <label data-qtext="e.name"> and replaces it with 
another element (or rather, it moves the <label> somewhere down below). 

Since we are on a single page app, it is likely that we want to update the list 
a second time, eg. to display new results. But we can not.

The problem I see here is that Distal modifies the repeating element 
_in-place_. IMHO the element containing data-qrepeat should not be touched. It 
should be used as a template. The problem could be solved like this:

Whenever Distal encounters a data-repeat attribute, it clones the element the 
given number of times and sets the data-qdup attribute on all clones. Second, 
it sets the original template element to display:none! Later on, when Distal is 
run again on the same template element, it removes all qdup children (which it 
does anyway right now) and clones the original template again.

By using this technique you'll still have the TAL benefits, such as, that the 
HTML contains the full template text and can be edited by authoring tools such 
as DreamWeaver. And my proposal doesn't break backward compatibility; existing 
templates continue to work.

What do you think?

Original issue reported on code.google.com by [email protected] on 25 Sep 2013 at 11:44

qtext on <button>

Hey, small issue. When using qtext on a button it changes the value attribute 
instead of innerHTML. While buttons can be used to pass values I don't think 
it's the expected outcome of qtext.

Example:

<button qtext="anything">Text</button>
becomes
<button value="anything">Text</button>
resulting in a button with the text "Text" on it and not "anything" as I 
would've expected.

Workaround is to use "html anything".

Original issue reported on code.google.com by [email protected] on 11 Sep 2012 at 6:56

How to repeat a block of couples input-labels

I have a loop within an array and I'd like to obtain:

...
<input type="checkbox" ... /><label ...>...</label>
<input type="checkbox" ... /><label ...>...</label>
...

As data-qrepeat should be attached to a tag I need an enclosing one, but this 
leads to:

...
<div ...>
  <input type="checkbox" ... /><label ...>...</label>
</div>
<div ...>
  <input type="checkbox" ... /><label ...>...</label>
</div>
...

is there any way to achieve it?

A good solution would be an additional feature to hide a tag, leaving its 
content like:
<div data-qrepeat="m keywords" data-qmode="content">...</div>

where data-qmode could be "full" (default) to set tag and its content, 
"content" to set only content (tag will disappear in generated content).

Original issue reported on code.google.com by [email protected] on 1 Apr 2012 at 5:38

qtext on <label>

qtext does not change innerHTML of labels. I suspect for the same reason as 
<button> didn't work previously. Putting "html" in front of variable name works.

{var: "works"}

<label data-qtext="var"></label>
<label data-qtext="html var">works</label>

Original issue reported on code.google.com by [email protected] on 10 Oct 2012 at 11:26

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.