Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28470

Re: Recursive function to find a node in the DOM

From "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it>
Newsgroups comp.lang.javascript
Subject Re: Recursive function to find a node in the DOM
Date 2015-07-25 21:22 +0200
Organization A noiseless patient Spider
Message-ID <mp0njk$10c$1@dont-email.me> (permalink)
References (1 earlier) <5530725.v0RXNFEj4j@PointedEars.de> <mo5gf4$l2m$1@dont-email.me> <4029225.tIX9iqhVEp@PointedEars.de> <mol5k8$v99$1@dont-email.me> <1458271.t0pGGtDH7K@PointedEars.de>

Show all headers | View raw


Il 07/25/2015 02:11 PM, Thomas 'PointedEars' Lahn ha scritto:

>>
>> IE 7 (and IE 8 in compatibility mode) both show a gracious bug.
>
> Which would be?  I must have missed that.

document.forms[n].<substitutedElementName>
or
document.forms[n][<substitutedElementName>]
return undefined.

>
>> At the time I made the test I wrote nodeFind(), that does not fail with
>> any known [by me] browser.
>
> With *your* documents, in *your* environments.

Correct. I just tried it on a large document downloaded from somewhere 
and it seems to fail (returns undefined). I'll try to understand why. 
Anyway it doesn't crash. :-)

>
>> JFC, here are some issues I remember I had to face in last years, apart
>> the previously described one:
>> - getElementsByName/getElementsByTagName not implemented
>
> Name one.

>
>> - mysterios bug in Opera in printing a frame
>> - bug in Opera in iframes readystate
>> - bug in IE about the test for the existence of a method in designmode
>> - bug in Firefox if trying to get a specific property of a window
>
> Specify.

I filed a report to Opera's guys, but it remained unanswered. I had a 
page with 2 frames and a couple of frames in turn in every "main" frame. 
Trying to print a sub-frame resulted in an empty page. I think this is 
true for all version with Presto.

With Opera 9.<something> IIRC I was trying to implement a function to 
load a html page in a DIV. I made the thing creating an hidden IFRAME 
and then copying the elements from the IFRAME to the DIV, but due to the 
inconsistent state of the onreadystatechange (IIRC) I wasn't able to 
detect when the IFRAME was completely loaded, so I had to resort to a 
workaround, injecting a script at the end of the IFRAME... there has 
been a thread here time ago about script injection.

In IE the test when a IFRAME is put in designmode queryCommandSupported 
or queryCommandEnabled (I don't remember the details) is wrongly 
implemented.

>
>> - try... catch not implemented
>
> Not since IE/MSHTML/JScript 5.5 and Mozilla 1.0.  See the ES Matrix.

Happily many problems have been solved, and now they are only ghosts of 
the past. Nevertheless when I started to tinker with ECMAscript 
implementations in browsers, the landscape was scaring. It is also 
possible I had access to incomplete/imprecise informations.

>
>> - the old problem of knowing if a page is completely loaded and rendered
>
> Yes, but in most cases the problem with that was a wrong approach.

The point being, it was complicated for a medium-weight programmer, very 
hard for a novice.

Anyway, of course you know better than me the incompatibilities, 
moreover I did not trace all the cats I had to skin, so my list is 
widely incomplete.

>
> You cannot set the “type” property of “input” elements that are in the
> document, everywhere, so you need to replace the input[type="text"] with an
> input[type="file"] in any case.  So what do you need the (supposedly) *read-
> only* input[type="text"] for in the first place?  Go with a div, or
> something like that, instead.

Not so easy, mr. Spock! :-)
Forms are generated server side by a general purpose function, and I 
implemented only form controls, so it would be messy to try to modify 
the function, while the Input element is supported, so I use an input 
(readonly) and I can live with it, as long as I can do a replaceChild(). 
In perspective, after discovering the IE bug and after having devised 
and written nodeFind() to circumvent it, I must admit that it would have 
been less work - but c'est la vie!..

Dan
-- 
"Everybody should pay taxes with a smile"
I tried, but they want money.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-15 09:59 +0200
  Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-15 11:59 +0200
    Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-15 12:03 +0200
    Re: Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-15 13:36 +0200
      Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-19 12:27 +0200
        Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-19 12:34 +0200
        Re: Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-21 12:08 +0200
          Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-25 14:11 +0200
            Re: Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-25 21:22 +0200
              Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-27 16:12 +0200
    Re: Recursive function to find a node in the DOM "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-08-08 04:50 +0200
      Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-08-08 09:33 +0200
        Re: Recursive function to find a node in the DOM "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-08-12 00:48 +0200
          Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-08-12 01:18 +0200
            Re: Recursive function to find a node in the DOM "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-08-13 23:26 +0200
              Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-08-16 08:48 +0200
                Re: Recursive function to find a node in the DOM "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-08-20 02:11 +0200
  Re: Recursive function to find a node in the DOM Scott Sauyet <scott.sauyet@gmail.com> - 2015-07-18 15:59 -0700
    Re: Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-21 12:30 +0200
      Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-21 13:53 +0200
        Re: Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-21 14:51 +0200
          Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-21 16:05 +0200
            Re: Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-21 20:35 +0200
            Re: Recursive function to find a node in the DOM Scott Sauyet <scott.sauyet@gmail.com> - 2015-07-30 22:10 -0700
              Re: Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-08-06 10:07 +0200
                Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-08-06 20:15 +0200
                Re: Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-08-08 01:21 +0200
        Re: Recursive function to find a node in the DOM Scott Sauyet <scott.sauyet@gmail.com> - 2015-07-30 22:09 -0700
  Re: Recursive function to find a node in the DOM Denis McMahon <denismfmcmahon@gmail.com> - 2015-07-29 03:04 +0000
    Re: Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-08-06 10:20 +0200

csiph-web