Giter Site home page Giter Site logo

Missing .clone() API? about appframework HOT 12 CLOSED

intel avatar intel commented on July 27, 2024
Missing .clone() API?

from appframework.

Comments (12)

Indiepath avatar Indiepath commented on July 27, 2024

It's in the new release.

from appframework.

abereznyi avatar abereznyi commented on July 27, 2024

I see clone() in 0.9.1a but it seems to return an HTML element instead of a set.
Seems like a bug to me.

from appframework.

Indiepath avatar Indiepath commented on July 27, 2024

What do you mean by "set" do you mean a deep clone?

from appframework.

abereznyi avatar abereznyi commented on July 27, 2024

By "set" I mean jQuery selector result type to which one can apply jQuery methods.

In jQuery I can write:

var a = $('#someid').clone(); a.removeAttr('id');

but in jQ.Mobi I have to extra wrap .clone() result in $() to do same:

var a= $($('#someid').clone()); a.removeAttr('id');

from appframework.

Indiepath avatar Indiepath commented on July 27, 2024

I see what you mean so you basically want to be able to chain :

$('#someid').clone().removeAttr('id');

I'm sure Ian can manage this, I had a similar request with $('#someid').parent().addClass('blah'); - he sorted it in 2 mins :)

from appframework.

abereznyi avatar abereznyi commented on July 27, 2024

Also .clone() is a deep clone in jQuery - can you make it so in jQ.Mobi?
it's not very useful now without deep cloning.

from appframework.

imaffett avatar imaffett commented on July 27, 2024

clone takes in a parameter "deep" which will copy in all the children. It does not copy events (nor will it).

from appframework.

abereznyi avatar abereznyi commented on July 27, 2024

No events copy is fine, but I'd like to see same behavior as jQuery, where deep=true by defaul.
I am trying to port an app from jQuery and such incompatibilities waste a lot of my debugging time.

Thanks,
Alex

from appframework.

imaffett avatar imaffett commented on July 27, 2024

Got it...I'll make that change. Thanks!

from appframework.

abereznyi avatar abereznyi commented on July 27, 2024

BTW, you are also missing jQuery ().data() API ...

from appframework.

Indiepath avatar Indiepath commented on July 27, 2024

Hardly - it's only an attribute :) But In know what you mean.

$(''selector").attr("data-twaddle");

from appframework.

imaffett avatar imaffett commented on July 27, 2024

Actually it's in the code and has been, just not documented. You get points though because evidently you're the only one to read the actually Readme.md file ;)

We'll have better documentation for the 1.0 release.

from appframework.

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.