Hi everyone,
I am experiencing a strange problem with latest HEAD revision (d8439ae4a). Here is some test code which used to work before SelectTest is a subclass of Widget. SelectTest>>renderOn: html |select| select := html select with: [ html option with: '--'; value: 'abc'. html option with: '++'; value: 'def'. ]. select onChange: [:event | Transcript show: (select element); cr. Transcript show: (select element value); cr. Transcript show: (select element value value); cr. ]. Append this Widget to the body using SelectTest new appendToJQuery: ('body' asJQuery) The output is: [object HTMLSelectElement] [object HTMLSelectElement] [object HTMLSelectElement] However, at least the second line should produce a different output on the Transcript. Depending on the selected item it should either be 'abc' or 'def'. If you do an inspect on (select element) there is definitely a 'value' property with the correct value. But inspecting (select element value) leads to the same inspector and not to the value object. Any ideas? Best, Manfred |
Hi!
What if you inspect "select element" on change event? Nico 2012/11/1 Manfred Kröhnert <[hidden email]> Hi everyone, |
Hi Nico,
On Fri, Nov 2, 2012 at 1:02 PM, nicolas petton <[hidden email]> wrote: Hi! Yes, that is what I already did. I put the following two lines inside of the on change event handling block:
(select element) inspect. (select element value) inspect. Both of them open the same inspector entitled "[object HTMLSelectElement]" and each showing the correct value for the "value" property.
Doing a "self value inspect" in the inspectors source area also opens the same inspector again and does not show a value "object". Manfred
|
Hi,
I think I have the same error. If I do: (<document.getElementById('textToView').value>) -> 'text' (document getElementById: 'textToView') value -> [object HTMLTextAreaElement] Cheers, Vanessa. On 11/02/2012 05:13 PM, Manfred Kröhnert [via Smalltalk] wrote:
|
In reply to this post by Manfred Kröhnert
Hi,
I think I might have found what lead to the following error: On Thu, Nov 1, 2012 at 4:12 PM, Manfred Kröhnert <[hidden email]> wrote: Hi everyone, Commit 85133ae99027d728a616f50f7cbcc88ba45c98d5 introduced the method Object>>value which returns 'self'. Since (select element) is of type Object the statement (select element value) will always return 'self'.
This leads to the multiple output of [object HTMLSelectElement] since each >>value message now answers self. The inspector on the other hand does not use the >>value message to print the contents of the object and hence it displays the correct string when selecting 'value'.
Now the question is how to deal with this problem since most HTML seem to have a member named 'value' and accessing it does not conform to the rules on how to access object properties of non-Smalltalk objects.
Best, Manfred
-- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
Manfred Kröhnert wrote: > Hi, > > I think I might have found what lead to the following error: > > On Thu, Nov 1, 2012 at 4:12 PM, Manfred Kröhnert > <[hidden email] <mailto:[hidden email]>> wrote: > > Hi everyone, > > I am experiencing a strange problem with latest HEAD revision > (d8439ae4a). > > Here is some test code which used to work before > SelectTest is a subclass of Widget. > > SelectTest>>renderOn: html > |select| > select := html select with: [ > html option > with: '--'; > value: 'abc'. > html option > with: '++'; > value: 'def'. > ]. > select onChange: [:event | > Transcript show: (select element); cr. > Transcript show: (select element value); cr. > Transcript show: (select element value value); cr. > ]. > > Append this Widget to the body using > > SelectTest new appendToJQuery: ('body' asJQuery) > > The output is: > > [object HTMLSelectElement] > [object HTMLSelectElement] > [object HTMLSelectElement] > > However, at least the second line should produce a different output on > the Transcript. > Depending on the selected item it should either be 'abc' or 'def'. > > If you do an inspect on (select element) there is definitely a 'value' > property with the correct value. > But inspecting (select element value) leads to the same inspector and > not to the value object. > > Any ideas? > > Best, > Manfred > > > Commit 85133ae99027d728a616f50f7cbcc88ba45c98d5 introduced the method > Object>>value which returns 'self'. > Since (select element) is of type Object the statement (select element > value) will always return 'self'. > This leads to the multiple output of [object HTMLSelectElement] since > each >>value message now answers self. > > The inspector on the other hand does not use the >>value message to > print the contents of the object and hence it displays the correct > string when selecting 'value'. > > Now the question is how to deal with this problem since most HTML seem > to have a member named 'value' and accessing it does not conform to the > rules on how to access object properties of non-Smalltalk objects. Either 1. learn to use attr: 'value', at: 'value', basicAt: 'value' etc. or 2. rewrite JSObjectProxy's value to try JS .value first > Best, > Manfred Herby -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
It can be quite inconvenient. That's the problem of using a semi-transparent proxy. OTOH, it is consistent with Smalltalk. Maybe JSObjectProxy >> value could handle this? Do you think it may be worth it? Nico Herby Vojčík <[hidden email]> writes: > Manfred Kröhnert wrote: >> Hi, >> >> I think I might have found what lead to the following error: >> >> On Thu, Nov 1, 2012 at 4:12 PM, Manfred Kröhnert >> <[hidden email] <mailto:[hidden email]>> wrote: >> >> Hi everyone, >> >> I am experiencing a strange problem with latest HEAD revision >> (d8439ae4a). >> >> Here is some test code which used to work before >> SelectTest is a subclass of Widget. >> >> SelectTest>>renderOn: html >> |select| >> select := html select with: [ >> html option >> with: '--'; >> value: 'abc'. >> html option >> with: '++'; >> value: 'def'. >> ]. >> select onChange: [:event | >> Transcript show: (select element); cr. >> Transcript show: (select element value); cr. >> Transcript show: (select element value value); cr. >> ]. >> >> Append this Widget to the body using >> >> SelectTest new appendToJQuery: ('body' asJQuery) >> >> The output is: >> >> [object HTMLSelectElement] >> [object HTMLSelectElement] >> [object HTMLSelectElement] >> >> However, at least the second line should produce a different output on >> the Transcript. >> Depending on the selected item it should either be 'abc' or 'def'. >> >> If you do an inspect on (select element) there is definitely a 'value' >> property with the correct value. >> But inspecting (select element value) leads to the same inspector and >> not to the value object. >> >> Any ideas? >> >> Best, >> Manfred >> >> >> Commit 85133ae99027d728a616f50f7cbcc88ba45c98d5 introduced the method >> Object>>value which returns 'self'. >> Since (select element) is of type Object the statement (select element >> value) will always return 'self'. >> This leads to the multiple output of [object HTMLSelectElement] since >> each >>value message now answers self. >> >> The inspector on the other hand does not use the >>value message to >> print the contents of the object and hence it displays the correct >> string when selecting 'value'. >> >> Now the question is how to deal with this problem since most HTML seem >> to have a member named 'value' and accessing it does not conform to the >> rules on how to access object properties of non-Smalltalk objects. > > Either > 1. learn to use attr: 'value', at: 'value', basicAt: 'value' etc. or > 2. rewrite JSObjectProxy's value to try JS .value first > >> Best, >> Manfred > > Herby > > -- > You received this message because you are subscribed to the Google Groups "amber-lang" group. > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- Nicolas Petton http://nicolas-petton.fr -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
Hi, I can make a pull request to add a >>value method to JSObjectProxy which its able to handle this case. The question is if this is a wanted addition and if make the same changes if other cases like this one appear. Best, Am 20.02.2013 16:11 schrieb "Nicolas Petton" <[hidden email]>:
--
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
we need to decide if it's the case of an inspector bug? is it the behavior rigth if no inspectors are involved? (I remember cases involving proxies and tools making weird stuff in other smalltalks) sebastian o/ -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
In reply to this post by Manfred Kröhnert
It's a complicated topic. The thing is that JSObjectProxy is not 100% transparent. Usually in Pharo/Squeak similar proxies are made as transparent as possible. So, I would vote for it. Nico Manfred Kröhnert <[hidden email]> writes: > Hi, > > I can make a pull request to add a >>value method to JSObjectProxy which > its able to handle this case. > > The question is if this is a wanted addition and if make the same changes > if other cases like this one appear. > Or, if we tell people accessing JS objecs through a proxy to always use >>>at:. > > Best, > Manfred > Am 20.02.2013 16:11 schrieb "Nicolas Petton" <[hidden email]>: > >> >> It can be quite inconvenient. That's the problem of using a >> semi-transparent proxy. OTOH, it is consistent with Smalltalk. >> >> Maybe JSObjectProxy >> value could handle this? Do you think it may be >> worth it? >> >> Nico >> >> >> Herby Vojčík <[hidden email]> writes: >> >> > Manfred Kröhnert wrote: >> >> Hi, >> >> >> >> I think I might have found what lead to the following error: >> >> >> >> On Thu, Nov 1, 2012 at 4:12 PM, Manfred Kröhnert >> >> <[hidden email] <mailto:[hidden email]>> >> wrote: >> >> >> >> Hi everyone, >> >> >> >> I am experiencing a strange problem with latest HEAD revision >> >> (d8439ae4a). >> >> >> >> Here is some test code which used to work before >> >> SelectTest is a subclass of Widget. >> >> >> >> SelectTest>>renderOn: html >> >> |select| >> >> select := html select with: [ >> >> html option >> >> with: '--'; >> >> value: 'abc'. >> >> html option >> >> with: '++'; >> >> value: 'def'. >> >> ]. >> >> select onChange: [:event | >> >> Transcript show: (select element); cr. >> >> Transcript show: (select element value); cr. >> >> Transcript show: (select element value value); cr. >> >> ]. >> >> >> >> Append this Widget to the body using >> >> >> >> SelectTest new appendToJQuery: ('body' asJQuery) >> >> >> >> The output is: >> >> >> >> [object HTMLSelectElement] >> >> [object HTMLSelectElement] >> >> [object HTMLSelectElement] >> >> >> >> However, at least the second line should produce a different output >> on >> >> the Transcript. >> >> Depending on the selected item it should either be 'abc' or 'def'. >> >> >> >> If you do an inspect on (select element) there is definitely a >> 'value' >> >> property with the correct value. >> >> But inspecting (select element value) leads to the same inspector >> and >> >> not to the value object. >> >> >> >> Any ideas? >> >> >> >> Best, >> >> Manfred >> >> >> >> >> >> Commit 85133ae99027d728a616f50f7cbcc88ba45c98d5 introduced the method >> >> Object>>value which returns 'self'. >> >> Since (select element) is of type Object the statement (select element >> >> value) will always return 'self'. >> >> This leads to the multiple output of [object HTMLSelectElement] since >> >> each >>value message now answers self. >> >> >> >> The inspector on the other hand does not use the >>value message to >> >> print the contents of the object and hence it displays the correct >> >> string when selecting 'value'. >> >> >> >> Now the question is how to deal with this problem since most HTML seem >> >> to have a member named 'value' and accessing it does not conform to the >> >> rules on how to access object properties of non-Smalltalk objects. >> > >> > Either >> > 1. learn to use attr: 'value', at: 'value', basicAt: 'value' etc. or >> > 2. rewrite JSObjectProxy's value to try JS .value first >> > >> >> Best, >> >> Manfred >> > >> > Herby >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups "amber-lang" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> an email to [hidden email]. >> > For more options, visit https://groups.google.com/groups/opt_out. >> > >> > >> >> -- >> Nicolas Petton >> http://nicolas-petton.fr >> >> -- >> You received this message because you are subscribed to the Google Groups >> "amber-lang" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [hidden email]. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- > You received this message because you are subscribed to the Google Groups "amber-lang" group. > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- Nicolas Petton http://nicolas-petton.fr -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
Ok, here is the pull request:
Manfred
--
On Fri, Feb 22, 2013 at 3:17 PM, Nicolas Petton <[hidden email]> wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
In reply to this post by sebastianconcept
A patch has been integrated into master to address the problem with the >>value method on JSObjectProxy.
The Inspector was not at fault here since Object>>value was evaluated on JSObjectProxy before the JS property.
Best, Manfred On Fri, Feb 22, 2013 at 2:02 PM, sebastian <[hidden email]> wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
Free forum by Nabble | Edit this page |