Welcome to WebmasterWorld Guest from 54.162.213.67

Forum Moderators: open

Message Too Old, No Replies

datejs and jquery .clone() conflict?

     
7:37 pm on Sep 12, 2012 (gmt 0)

Full Member

5+ Year Member

joined:June 30, 2008
posts: 318
votes: 0


hi all,

I'm interested in using the datejs library but i noticed that it defines a ".clone()" method that looks exactly like jQuery's ".clone()" method.

Won't datejs mess up my use of jQuery's .clone() method if i install datejs on my site?

thanks.
3:27 am on Sept 13, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 3, 2005
posts:1585
votes: 0


I assume the .clone() in datejs is not a method of a jQuery defined object, so there be no conflict ?
4:00 pm on Sept 13, 2012 (gmt 0)

Full Member

5+ Year Member

joined:June 30, 2008
posts: 318
votes: 0


I just don't see how there would not be a conflict. How would the browser's interpreter know which library to use (datejs or jquery) when it incounters ".clone()"?
11:56 pm on Sept 13, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 3, 2005
posts:1585
votes: 0


datejs usage of clone() is like

var myDate = new Date();
var cloneDate = myDate.clone();

It has added a method called 'clone' to objects created with the Date Constructor.

So objects NOT created with the Date Constructor will not be effected, and are free to have a clone property of there own.

".clone()" only has meaning in the context of what object it follows.
12:26 am on Sept 14, 2012 (gmt 0)

Full Member

5+ Year Member

joined:June 30, 2008
posts: 318
votes: 0


interesting, i guess i don't understand how the interpreter figures it out so i'll take your word for it.

However, i'll try asap.

thanks.