Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #36462
| From | "R.Wieser" <address@not.available> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Objects what are they. |
| Date | 2019-04-27 17:45 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <qa1tfk$i7l$1@gioia.aioe.org> (permalink) |
| References | <8e03edae-dc71-4a28-9b80-579934821794@googlegroups.com> <1e0e684f-a0c8-40d9-b43d-9129a7d4b99d@googlegroups.com> <c0s3cep7c7lug1b76jko8g008c9t779crk@4ax.com> <b8a7c580-9fd9-438a-8e4b-358966b2f1fa@googlegroups.com> |
Groovee, > document.getElementById GETS something from the > page, how the hell is it *returning an object*, It does that in the same way a string or an array can be returned: By returning a *pointer* to it. > and why??? Why is that necessary and why do it that way? :-) Because what you are asking for is stored (in the document tree) as an object ? And /why/ its stored as an object ? Thats easy: Those things are flexible. You /can/ just store data into it (and make it look like a run-of-the-mill (associative) array), but you can also create read-only "variables" as well as functions that can do anything you like. > And in fact I don't understand what "document.getElementById" is > in the FIRST place!! Yes you do. Its a function, and you're calling it. The only thing is that all the functions that have something to do with the document are put into a box with that same name. > The document, ie. the HTML page contains ELEMENTS, Correct. But it also tries to maintain the relations between those elements. Which it does in what you named a "tree". The root of it is called "document". The other elements "hang" under it. > not a function called "getElementById"...??!! Why not ? The only place that that function is usable is on a document (HTML or alike), so why not put it in the same box ? Positive side effect: You won't be able to use it on something its not ment for (a non-HTML document). Second positive "side effect" by naming the target first (document) and than the method (getElementById) you also gave it the area (scope) it should work on/in. That means that "document.head.getElementById" will only work in the "head" area of the HTML document (and not the "body"). Compare it with trying to access the "href" propery of a "B" element. It won't work, as the property doesn't exist. The same goes for those functions - which, by the way, for objects are called "methods". Have you ever tried to use the "indexOf" (find a word in some text) method on something thats not a string ? It doesn't work. Why ? Because a non-string object (yes, in the document model strings are objects too :-) ) simply doesn't have that method. > registerHandler(document.blah, foo); (IF at all "document" is required!) Yes, it could have been done that way. If you only have a single document, and only one type of it ... But you /can/ have multiple (though only one displayed), and there certainly are multiple types. The HTML DOM is just one of them. The XML DOM is another. > Well, I guess MY poor little brain can't match Brendan Eich's :) Don't worry about it. When I started programming (in the time of DOS 3.3 and it being single-task) it took me the better part of a year to figure out how the computer could run both the BIOS program (handling the screen, keyboard etc) as well as the program I just wrote. Single task means /one/ program. Running BIOS + my program = brain freeze. Regards, Rudy Wieser
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Objects what are they. jonas.thornvall@gmail.com - 2019-04-25 02:16 -0700
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-25 02:40 -0700
Re: Objects what are they. groovee@cyberdude.com - 2019-04-25 09:12 -0700
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-25 18:37 +0100
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-25 23:41 -0700
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-25 23:56 -0700
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 00:00 -0700
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-26 10:45 +0100
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 04:37 -0700
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-26 19:41 +0100
Re: Objects what are they. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-04-26 21:11 +0200
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 13:23 -0700
Re: Objects what are they. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-04-26 23:32 +0200
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 15:11 -0700
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 15:24 -0700
Re: Objects what are they. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-04-27 11:52 +0200
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-27 11:17 +0100
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-27 05:00 -0700
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-27 05:06 -0700
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-27 11:08 +0100
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-28 05:03 -0700
Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-28 18:11 +0200
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 03:43 -0700
Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-29 14:11 +0200
Re: Objects what are they. John-Paul Stewart <jpstewart@sympatico.ca> - 2019-04-29 11:15 -0400
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 08:41 -0700
Re: Objects what are they. John-Paul Stewart <jpstewart@sympatico.ca> - 2019-04-29 15:16 -0400
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 15:56 -0700
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 16:08 -0700
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 16:30 -0700
Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-29 09:44 -0700
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 08:31 -0700
Re: Objects what are they. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-04-26 13:48 +0200
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 00:25 -0700
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 00:30 -0700
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 01:06 -0700
Re: Objects what are they. groovee@cyberdude.com - 2019-04-26 07:41 -0700
Re: Objects what are they. Jon Ribbens <jon+usenet@unequivocal.eu> - 2019-04-26 15:39 +0000
Re: Objects what are they. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-04-26 23:23 +0200
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-27 11:25 +0100
Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-27 04:10 -0700
Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-27 04:17 -0700
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-27 14:39 +0100
Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-27 10:16 -0700
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-28 10:53 +0100
Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-29 07:08 -0700
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-30 11:03 +0100
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-27 14:43 +0100
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-26 19:36 +0100
Re: Objects what are they. groovee@cyberdude.com - 2019-04-28 08:53 -0700
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-29 10:35 +0100
Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-27 17:45 +0200
Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-27 10:19 -0700
Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-27 20:57 +0200
Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-29 06:53 -0700
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-29 15:08 +0100
Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-29 19:21 +0200
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-29 20:06 +0100
Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-29 23:09 +0200
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-30 10:39 +0100
Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-30 14:06 +0200
Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-30 05:26 -0700
Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-30 19:14 +0200
Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-30 12:07 -0700
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-05-01 14:29 +0100
Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-05-01 07:52 -0700
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-05-01 18:34 +0100
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-30 18:27 +0100
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-30 18:22 +0100
Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-30 22:25 +0200
Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-05-01 15:15 +0100
Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-29 18:31 +0200
Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-29 09:42 -0700
Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-29 19:42 +0200
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 17:35 -0700
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-30 00:18 -0700
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-30 06:00 -0700
Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-30 06:16 -0700
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-30 06:38 -0700
Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-30 06:21 -0700
Re: Objects what are they. groovee@cyberdude.com - 2019-04-28 08:43 -0700
Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-28 19:02 +0200
Re: Objects what are they. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-04-26 23:07 +0200
csiph-web