[haxe][jquery] basics

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

[haxe][jquery] basics

bubblebenj
I'm wondering how I can do it :

public static function j( _selector : String ) : JQuery
{
return new JQuery( _selector );
}





--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [jquery] basics

bubblebenj
Sorry the end of the mail is missing.
Wait a minute please.


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [jquery] basics

bubblebenj
I'm wondering how I can do it :

public static function j( _selector : String ) : JQuery
{
return new JQuery( _selector );
}

public static setAnEvent() : Void
{
j("myId").mouseover( the_current_iterated_element.show() );
}

Am I forced to iterate like this, or is there a "jquerish" way to do that :

public static setAnEvent() : Void
{
var elements = j("myId");
for ( i in 0 ... elements.length )
{
elements[i].mouseover( elements[i].show() );
}
}

I think what I'm looking for is an equivalent to the $(this) of jquery.

Ben



--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [jquery] basics

Skial Bainn
Take a look at the children() method - that might work - http://api.jquery.com/children/

On Wed, Oct 12, 2011 at 12:39 PM, benjamin Dubois <[hidden email]> wrote:
I'm wondering how I can do it :

public static function j( _selector : String ) : JQuery
{
return new JQuery( _selector );
}

public static setAnEvent() : Void
{
j("myId").mouseover( the_current_iterated_element.show() );
}

Am I forced to iterate like this, or is there a "jquerish" way to do that :

public static setAnEvent() : Void
{
var elements = j("myId");
for ( i in 0 ... elements.length )
{
elements[i].mouseover( elements[i].show() );
}
}

I think what I'm looking for is an equivalent to the $(this) of jquery.

Ben



--
haXe - an open source web programming language
http://haxe.org



--
Skial



--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [jquery] basics

Nicolas Cannasse
In reply to this post by bubblebenj
Le 12/10/2011 13:39, benjamin Dubois a écrit :
> I think what I'm looking for is an equivalent to the$(this)of jquery.

js.JQuery.cur

Best,
Nicolas

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [jquery] basics

clemos
In reply to this post by bubblebenj
Hi,

j("myId").mouseover(function(_){ JQuery.cur.show(); })
should work.

Cheers,
Clément

On Wed, Oct 12, 2011 at 1:39 PM, benjamin Dubois <[hidden email]> wrote:

> I'm wondering how I can do it :
> public static function j( _selector : String ) : JQuery
> {
> return new JQuery( _selector );
> }
> public static setAnEvent() : Void
> {
> j("myId").mouseover( the_current_iterated_element.show() );
> }
> Am I forced to iterate like this, or is there a "jquerish" way to do that :
> public static setAnEvent() : Void
> {
> var elements = j("myId");
> for ( i in 0 ... elements.length )
> {
> elements[i].mouseover( elements[i].show() );
> }
> }
> I think what I'm looking for is an equivalent to the $(this) of jquery.
> Ben
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [jquery] basics

bubblebenj
In reply to this post by Nicolas Cannasse
Thx, Nicolas that's what I was looking for.

coming back to the .children stuff since you raised the subject Skial.
Is there a way to get a jquery object from a dom element like :
public static function domToJquery( domElt : js.Dom ) : JQuery

that would answer the first question asked on http://api.jquery.com/children/
var $kids = $(e.target).children();

Ben

On Wed, Oct 12, 2011 at 1:48 PM, Nicolas Cannasse <[hidden email]> wrote:
Le 12/10/2011 13:39, benjamin Dubois a écrit :

I think what I'm looking for is an equivalent to the$(this)of jquery.

js.JQuery.cur

Best,
Nicolas


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [jquery] basics

Viktor Hesselbom-2
Hmm, maybe I'm not understanding exactly what you mean but the jQuery way to do this would be like this:

public static setAnEvent ()
{
j(".classname").mouseover (elements[i].show);
}

viktor hesselbom



2011/10/12 benjamin Dubois <[hidden email]>
Thx, Nicolas that's what I was looking for.

coming back to the .children stuff since you raised the subject Skial.
Is there a way to get a jquery object from a dom element like :
public static function domToJquery( domElt : js.Dom ) : JQuery

that would answer the first question asked on http://api.jquery.com/children/
var $kids = $(e.target).children();

Ben

On Wed, Oct 12, 2011 at 1:48 PM, Nicolas Cannasse <[hidden email]> wrote:
Le 12/10/2011 13:39, benjamin Dubois a écrit :

I think what I'm looking for is an equivalent to the$(this)of jquery.

js.JQuery.cur

Best,
Nicolas


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [jquery] basics

bubblebenj
I think Clemos and Nicolas have given a satisfying answer to my question.
Maybe there are more concise way to do that but that's concise enough for me.

Ben

On Wed, Oct 12, 2011 at 2:07 PM, Viktor Hesselbom <[hidden email]> wrote:
Hmm, maybe I'm not understanding exactly what you mean but the jQuery way to do this would be like this:

public static setAnEvent ()
{
j(".classname").mouseover (elements[i].show);
}

viktor hesselbom



2011/10/12 benjamin Dubois <[hidden email]>
Thx, Nicolas that's what I was looking for.

coming back to the .children stuff since you raised the subject Skial.
Is there a way to get a jquery object from a dom element like :
public static function domToJquery( domElt : js.Dom ) : JQuery

that would answer the first question asked on http://api.jquery.com/children/
var $kids = $(e.target).children();

Ben

On Wed, Oct 12, 2011 at 1:48 PM, Nicolas Cannasse <[hidden email]> wrote:
Le 12/10/2011 13:39, benjamin Dubois a écrit :

I think what I'm looking for is an equivalent to the$(this)of jquery.

js.JQuery.cur

Best,
Nicolas


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [jquery] basics

Nicolas Cannasse
In reply to this post by bubblebenj
Le 12/10/2011 13:57, benjamin Dubois a écrit :
> Thx, Nicolas that's what I was looking for.
>
> coming back to the .children stuff since you raised the subject Skial.
> Is there a way to get a jquery object from a dom element like :
> public static function domToJquery( domElt : js.Dom ) : JQuery
>

new js.JQuery(domElt) works
(because of overloads, which doesn't show yet in the api documentation)

Nicolas

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [jquery] basics

clemos
In reply to this post by bubblebenj
For Dom => JQuery you have :
var jq = JQuery.of( dom );
But I think this works too:
var jq = new JQuery( dom );

Cheers
Clément

On Wed, Oct 12, 2011 at 1:57 PM, benjamin Dubois <[hidden email]> wrote:

> Thx, Nicolas that's what I was looking for.
> coming back to the .children stuff since you raised the subject Skial.
> Is there a way to get a jquery object from a dom element like :
> public static function domToJquery( domElt : js.Dom ) : JQuery
> that would answer the first question asked
> on http://api.jquery.com/children/
> var $kids = $(e.target).children();
> Ben
>
> On Wed, Oct 12, 2011 at 1:48 PM, Nicolas Cannasse
> <[hidden email]> wrote:
>>
>> Le 12/10/2011 13:39, benjamin Dubois a écrit :
>>>
>>> I think what I'm looking for is an equivalent to the$(this)of jquery.
>>
>> js.JQuery.cur
>>
>> Best,
>> Nicolas
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [jquery] basics

Viktor Hesselbom-2
In reply to this post by Viktor Hesselbom-2
Oops, I feel tired today...

viktor hesselbom



2011/10/12 Viktor Hesselbom <[hidden email]>
Hmm, maybe I'm not understanding exactly what you mean but the jQuery way to do this would be like this:

public static setAnEvent ()
{
j(".classname").mouseover (elements[i].show);
}

viktor hesselbom



2011/10/12 benjamin Dubois <[hidden email]>
Thx, Nicolas that's what I was looking for.

coming back to the .children stuff since you raised the subject Skial.
Is there a way to get a jquery object from a dom element like :
public static function domToJquery( domElt : js.Dom ) : JQuery

that would answer the first question asked on http://api.jquery.com/children/
var $kids = $(e.target).children();

Ben

On Wed, Oct 12, 2011 at 1:48 PM, Nicolas Cannasse <[hidden email]> wrote:
Le 12/10/2011 13:39, benjamin Dubois a écrit :

I think what I'm looking for is an equivalent to the$(this)of jquery.

js.JQuery.cur

Best,
Nicolas


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org



--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [jquery] basics

bubblebenj
In reply to this post by clemos
I tried the new JQuery( dom ) way but had compilation errors. wrong type...
Maybe I should not have used the jquery lib from haxelib.
I've discovered only recently that jquery is part of haxe.js api.

I'll try this.

On Wed, Oct 12, 2011 at 2:24 PM, clemos <[hidden email]> wrote:
For Dom => JQuery you have :
var jq = JQuery.of( dom );
But I think this works too:
var jq = new JQuery( dom );

Cheers
Clément

On Wed, Oct 12, 2011 at 1:57 PM, benjamin Dubois <[hidden email]> wrote:
> Thx, Nicolas that's what I was looking for.
> coming back to the .children stuff since you raised the subject Skial.
> Is there a way to get a jquery object from a dom element like :
> public static function domToJquery( domElt : js.Dom ) : JQuery
> that would answer the first question asked
> on http://api.jquery.com/children/
> var $kids = $(e.target).children();
> Ben
>
> On Wed, Oct 12, 2011 at 1:48 PM, Nicolas Cannasse
> <[hidden email]> wrote:
>>
>> Le 12/10/2011 13:39, benjamin Dubois a écrit :
>>>
>>> I think what I'm looking for is an equivalent to the$(this)of jquery.
>>
>> js.JQuery.cur
>>
>> Best,
>> Nicolas
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [jquery] basics

bubblebenj
That works.

Why is there still jquery (not jqueryExtern) in haxelib since it is in haxe.js now ?

Ben

On Wed, Oct 12, 2011 at 2:38 PM, benjamin Dubois <[hidden email]> wrote:
I tried the new JQuery( dom ) way but had compilation errors. wrong type...
Maybe I should not have used the jquery lib from haxelib.
I've discovered only recently that jquery is part of haxe.js api.

I'll try this.

On Wed, Oct 12, 2011 at 2:24 PM, clemos <[hidden email]> wrote:
For Dom => JQuery you have :
var jq = JQuery.of( dom );
But I think this works too:
var jq = new JQuery( dom );

Cheers
Clément

On Wed, Oct 12, 2011 at 1:57 PM, benjamin Dubois <[hidden email]> wrote:
> Thx, Nicolas that's what I was looking for.
> coming back to the .children stuff since you raised the subject Skial.
> Is there a way to get a jquery object from a dom element like :
> public static function domToJquery( domElt : js.Dom ) : JQuery
> that would answer the first question asked
> on http://api.jquery.com/children/
> var $kids = $(e.target).children();
> Ben
>
> On Wed, Oct 12, 2011 at 1:48 PM, Nicolas Cannasse
> <[hidden email]> wrote:
>>
>> Le 12/10/2011 13:39, benjamin Dubois a écrit :
>>>
>>> I think what I'm looking for is an equivalent to the$(this)of jquery.
>>
>> js.JQuery.cur
>>
>> Best,
>> Nicolas
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org



--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [jquery] basics

Juraj Kirchheim
On Wed, Oct 12, 2011 at 4:37 PM, benjamin Dubois <[hidden email]> wrote:
> That works.
> Why is there still jquery (not jqueryExtern) in haxelib since it is in
> haxe.js now ?
> Ben

Some people might be using older versions of haXe together with that
library. You never know ;)

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [jquery] basics

bubblebenj
You mean we should keep every old version of any package in haxelib because people might use it ?

Ben

On Wed, Oct 12, 2011 at 11:13 PM, Juraj Kirchheim <[hidden email]> wrote:
On Wed, Oct 12, 2011 at 4:37 PM, benjamin Dubois <[hidden email]> wrote:
> That works.
> Why is there still jquery (not jqueryExtern) in haxelib since it is in
> haxe.js now ?
> Ben

Some people might be using older versions of haXe together with that
library. You never know ;)

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org