Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
nitrogen 'me', anchor and target
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dmitriy Kargapolov  
View profile  
 More options Oct 23 2012, 8:28 pm
From: Dmitriy Kargapolov <dmitriy.kargapo...@gmail.com>
Date: Tue, 23 Oct 2012 17:28:11 -0700 (PDT)
Local: Tues, Oct 23 2012 8:28 pm
Subject: nitrogen 'me', anchor and target

Hi All,
Nitrogen.$anchor(Anchor, Target) is used to set $anchor_path and
$target_path for current context. It called, for example, when wf:wire/2
invoked for some element.
The docs mentioned "me" nitrogen selector which is set to current anchor
and assumed to point to the element. But after calling wf:wire/2 (and
subsequent Nitrogen.$anchor(Anchor, Target)) element path is saved in
$target_path, not in $anchor_path. This make unusable "me" selector, which
keeps 'page' reference but not the element...
At the same time I grep-ed for $target_path through the nitrogen code and
didn't find any use of it.
Shouldn't be 'me' selector meaning revised? Or, otherwise, might be
wf:wire/2 should set anchor to the element given, not to the 'page'?
Thanks.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jesse Gumm  
View profile  
 More options Oct 23 2012, 11:55 pm
From: Jesse Gumm <g...@sigma-star.com>
Date: Tue, 23 Oct 2012 22:54:54 -0500
Local: Tues, Oct 23 2012 11:54 pm
Subject: Re: nitrogen 'me', anchor and target
Hi Dmitriy,

I'm not seeing any of this behavior. Calling wf:wire/2 will set both
the target_path and the anchor_paths to the provided Target (since
wf:wire(Target, Action) is the same as wf:wire(Target, Target,
Action).

Could you provide a sample module of this behavior in action?

-Jesse

On Tue, Oct 23, 2012 at 7:28 PM, Dmitriy Kargapolov

--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dmitriy Kargapolov  
View profile  
 More options Oct 24 2012, 12:34 am
From: Dmitriy Kargapolov <dmitriy.kargapo...@gmail.com>
Date: Tue, 23 Oct 2012 21:34:05 -0700 (PDT)
Local: Wed, Oct 24 2012 12:34 am
Subject: Re: nitrogen 'me', anchor and target

Jesse,
wf:wire(Target, Action) calls wf:wire(Target, Target, Action) substituting
1st Trigger element. (this is confusing btw).
Then later calls action_wire:fire/3, where Achor is set
from wf_context:anchor(), not from any arguments.

My code tests simple comet:

body() ->
...
    wf:comet(fun update_time/0),
...

update_time() ->
    timer:sleep(1000),
    {{_, _, D}, {H, M, S}} = calendar:local_time(),
    Time = lists:concat([D, "/", H, ":", M, ":", S]),
    Script = wf:f("objs('##timeStamp>span>span').text('~s');", [Time]),
    wf:wire(timeStamp, Script),
    wf:flush(),
    update_time().

Where I assume I could use 'me' instead of '##timeStamp', because Script
used in context of timeStamp element in wf:wire/2 call. At least I'd like
to think so. In practice 'me' translated to 'page' anchor...

(ugly '>span>span' is a temp workaround for jQuery button-link text update)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jesse Gumm  
View profile  
 More options Oct 24 2012, 2:48 am
From: Jesse Gumm <g...@sigma-star.com>
Date: Wed, 24 Oct 2012 01:47:40 -0500
Local: Wed, Oct 24 2012 2:47 am
Subject: Re: nitrogen 'me', anchor and target
I see. You're right, I confused even myself with my explanation of
wf:wire/2. Neither of the first two args of wf:wire/3 are Anchor.
It's Trigger and Target. Anchor is the element from which the action
is called.

And as you say, the anchor is retrieved from the context (which in
comet, being it's own process, has its own context).

You *could* set the anchor of the comet process with
wf_context:anchor(timeStamp), then any uses of 'me' called from the
comet process should point where you expect them to point.

I definitely see why this is confusing, and I'm not sure the best
solution for this. As you mentioned, $target_path does not seem to be
used anywhere, so there's an obvious candidate for a solution of some
sort.  This is definitely something I'm willing to explore further.

Thanks,

-Jesse

On Tue, Oct 23, 2012 at 11:34 PM, Dmitriy Kargapolov

--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dmitriy Kargapolov  
View profile  
 More options Oct 24 2012, 9:07 am
From: Dmitriy Kargapolov <dmitriy.kargapo...@gmail.com>
Date: Wed, 24 Oct 2012 06:07:01 -0700 (PDT)
Local: Wed, Oct 24 2012 9:07 am
Subject: Re: nitrogen 'me', anchor and target

One way to solve this would be:

- leave 'me' as it is, for compatibility, but mark it as deprecated
- add new selector, which unambiguously substituted with $target_path
- add one more selector, for $anchor_path
- use new selectors instead of 'me' over the Nitrogen code

Names might be '##target' or '##element' or '##self' and '##anchor', for
example.

Thank you.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »