Anonymous Functions / Mac Browser

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TS

    #1

    Anonymous Functions / Mac Browser

    Does anyone know if the Mac Browsers (IE5 / Safari) support anonymous
    functions or lambda functions? Ive been trying to get a site working
    with the Mac browsers and just cant get it to work. Here is an example
    of what Im trying to do:

    function CSelect(sName, id, bmpReqRO, minOptions, onvalid, isAddr,
    sLabel){
    this.obj = document.getEle mentById(id);
    this.focus = m_focus;
    this.blur = m_blur;
    this.disable = m_disable;
    this.enable = m_enable;

    //alert(sName);

    var slct = makeProps(this, bmpReqRO, id);

    //alert(slct.requ ired);

    if (navigator.appV ersion.indexOf( "Mac") > -1)
    {
    slct.options = slct.obj.option s;
    }
    else
    {
    slct.options = obj.options;
    }

    slct.label = sLabel;
    slct.minOptions = minOptions;
    slct.type = "Select";
    if(onvalid)
    slct.onvalid = new Function(onvali d);
    slct.getValue = function slct_getValue() {
    return slct.obj.value
    }
    if(slct.readOnl y){
    slct.disable();
    }
    //if(slct.obj.get Attribute("OnSe lect")){
    //slct.obj.onchan geFunc = slct.obj.onchan ge;
    //slct.obj.onchan ge = new Function("onIte mSelect(this)") ;
    //}

    if (navigator.appV ersion.indexOf( "Mac") > -1)
    {
    if(slct.obj.get Attribute("OnSe lect")){
    obj.onchangeFun c = slct.obj.onchan ge;
    // THIS LINE DOES NOT WORK WITH THE MAC
    obj.onchange = new Function("onIte mSelect(this)") ;
    }
    }
    else
    {
    if(slct.obj.get Attribute("OnSe lect")){
    slct.obj.onchan geFunc = slct.obj.onchan ge;
    slct.obj.onchan ge = new Function("onIte mSelect(this)") ;
    }
    }


    .. . . Continued . . .

    function onItemSelect(oS elect){

    var oSelected = oSelect[oSelect.selecte dIndex];
    var onselect = oSelected.getAt tribute("onSele ct");

    if(oSelect.onCh angeFunc)
    oSelect.onChang eFunc();

    if(onselect){
    var oSelectedFunc = new Function(onsele ct);
    oSelectedFunc() ;
    }
    }
  • Thomas 'PointedEars' Lahn

    #2
    Re: Anonymous Functions / Mac Browser

    TS wrote:
    [color=blue]
    > Does anyone know if the Mac Browsers (IE5 / Safari) support anonymous
    > functions or lambda functions? Ive been trying to get a site working
    > with the Mac browsers and just cant get it to work. Here is an example
    > of what Im trying to do:
    >
    > [...]
    > if (navigator.appV ersion.indexOf( "Mac") > -1)[/color]

    Nonsense. Read <http://pointedears.de. vu/scripts/test/whatami>
    [color=blue]
    > {
    > if(slct.obj.get Attribute("OnSe lect")){[/color]

    Do not use getAttribute(.. .) but, because of flawed implementations ,
    access the property directly. Besides, I doubt that there is a
    `OnSelect' property in the DOM. J(ava)Script ist case-sensitive, it
    is most certainly `onselect'. And you should test then if the property
    type is not undefined and the value is not null.
    [color=blue]
    > obj.onchangeFun c = slct.obj.onchan ge;
    > // THIS LINE DOES NOT WORK WITH THE MAC[/color]

    "Does not work" is a useless error description. [psf 4.11]

    Please read <3FDBC2B2.10209 08@PointedEars. de>
    [color=blue]
    > obj.onchange = new Function("onIte mSelect(this)") ;[/color]

    If it is really the line that triggers the error it could also mean
    that you cannot overwrite the `onchange' property in the used DOM.
    Since you did not post the error message (see above), one can only guess.


    PointedEars
    --[color=blue]
    > does anyone have any info about how can i make an explorer type menu?[/color]
    Care to be more specific? Windows Explorer? Internet Explorer? Jungle
    Explorer? (Fabian in cljs, <brk1e1$46tab$1 @ID-174912.news.uni-berlin.de>)

    Comment

    • HikksNotAtHome

      #3
      Re: Anonymous Functions / Mac Browser

      In article <3FE4E762.70407 06@PointedEars. de>, Thomas 'PointedEars' Lahn
      <PointedEars@we b.de> writes:
      [color=blue]
      >Please read <3FDBC2B2.10209 08@PointedEars. de>[/color]

      Please use URL's to articles that anyone can gain access to. That does nothing
      for me.
      --
      Randy

      Comment

      • T S

        #4
        Re: Anonymous Functions / Mac Browser

        I guess you kind of missed the point of my post. I really just wanted to
        know if the Mac browser supported anonymous / lambda functions. I do not
        get an error message at all, it just doesnt seem to recognize them. You
        are right about the OnSelect not being part of the DOM, it is an
        anonymous function of select object we created ourselves. It was
        difficult to post all of the code.



        *** Sent via Developersdex http://www.developersdex.com ***
        Don't just participate in USENET...get rewarded for it!

        Comment

        • Thomas 'PointedEars' Lahn

          #5
          Re: Anonymous Functions / Mac Browser

          T S wrote:
          [color=blue]
          > I guess you kind of missed the point of my post.[/color]

          Well, you made it not difficult to miss it.
          [color=blue]
          > I really just wanted to know if the Mac browser supported anonymous /
          > lambda functions.[/color]

          A simple test case will show that. No question here is necessary.

          var x;
          x = new Function("var y = 2;");
          alert(x); // undefined?
          [color=blue]
          > I do not get an error message at all,[/color]

          Then why do you ask? Either the Function constructor is supported or
          it is not. If the latter, the mentioned line should either (better)
          trigger a script error or the value of the property the return value
          of the `new' operation is assigned to does not change.
          [color=blue]
          > it just doesnt seem to recognize them.[/color]

          There can be numerous possibilities why the mentioned line does not
          work. Maybe the event handler `onchange' it is not part of the DOM
          and you have added merely a method being only manually invoked.
          Debugging will show this, follow the message ID that I have posted.
          [color=blue]
          > You are right about the OnSelect not being part of the DOM, it is an
          > anonymous function of select object we created ourselves.[/color]

          You missed the point. JavaScript ist *case-sensitive*. There may
          be `onselect', but it is unlikely that there is `OnSelect'.


          PointedEars

          Comment

          • T S

            #6
            Re: Anonymous Functions / Mac Browser



            Thanks for the response. I tried out your suggestion with the test
            function and it seemed to work fine on MAC IE and Safari. So I guess
            that answers my question about anonymous functions. I still get no
            Javascript error when it processes, I just don't get the desired
            results. I would love to be able to step through a debugger on this but
            as far as I know one doesn't exist for MAC IE5 or Safari. Unfortunately
            this all works really well on Windows IE so I can't debug it over there.
            I tried the onselect change as well with no luck. I will continue to
            look into and post any info as I gather it. Thanks again.

            *** Sent via Developersdex http://www.developersdex.com ***
            Don't just participate in USENET...get rewarded for it!

            Comment

            • Douglas Crockford

              #7
              Re: Anonymous Functions / Mac Browser

              > Thanks for the response. I tried out your suggestion with the test[color=blue]
              > function and it seemed to work fine on MAC IE and Safari. So I guess
              > that answers my question about anonymous functions. I still get no
              > Javascript error when it processes, I just don't get the desired
              > results. I would love to be able to step through a debugger on this but
              > as far as I know one doesn't exist for MAC IE5 or Safari. Unfortunately
              > this all works really well on Windows IE so I can't debug it over there.
              > I tried the onselect change as well with no luck. I will continue to
              > look into and post any info as I gather it. Thanks again.[/color]

              My experience with IE Mac suggests that Microsoft did not put its smartest guys
              on the Mac team. It is considerably bugger than the Windows browser. It has race
              bugs. It will fail silently, or quit with a meaningless error message. It is
              bad, bad stuff.

              Comment

              Working...