"DU" <drunclear@hot-R-E-M-O-V-E-mail.com> ha[color=blue]
> Vicomte De Valmont wrote:[color=green]
> > uhm why not using both? I mean an old way of doing > > soemthing doesn't[/color][/color]
age:[color=blue]
> An old way of doing something does not age if it is not > deprecated. Name[/color]
As J.P. Sartre said of those who said that we can do without literature: "of
course we can do without literature - we can do even better, we can do
without mankind".
So, if we should not do without a method simply because it is aged (my
point) we should then do without it when it is deprecated (your point): but
we can do even better than that: we can wait and do without it when it is no
longer included in the interpreters - uh, what do you think? Just following
your algo-rhythm here.
[color=blue]
> attribute for <img> is deprecated in XHTML; accessing the collection
> document.images is not deprecated in XHTML. So there is no contradiction
> here.[/color]
I was answering to an user who saw the contradiction - you're mistaking me
for him: because the COLLECTION can be addrsssed by NAME:
You know my expert friend:
<img name="foo" src="d.jpg">
<script>salert(document.images["foo"].src);</script>
Or maybe you were not aware that collections can be addressed by the name
porperties too besides than with numbers...
I was just following the flow of his own puzzlement - I myself don't see the
contradiction (to the degree I sponsor using both): he saw the contradiction
and I suggested (with an avergae dose of statements like "Of course, feel
free to dismiss my suggestion" and "Of course, eventually do as you prefer")
that it was not necessary to see the things as in conflict. I am happy to
see that you think like me in this field, with a bit more certainties than
me (whenever self confidence is unwarranted, thence absolutism immediately
arises): my speech was open to be debated, yours is absolutist: you are the
holder of the Holy Graal of scripting, and you intervene as such -
GRATUITOUSLY.
document.images is not deprecated in XHTML yet name is? Who cares: in HTML 4
which is what our user uses they are not, and even if soemthing is
deprecated, yet it can be still used ESPECIALLY if the collection which uses
it is NOT deprectaed. I think you're not well aware of what you say. If the
collection is not deprectaed, ONE MORE reason to go on addressing it also by
name, not one less. And in fact - it works. Smoothly. Period.
Moreover, not deprectaing the collection yet deprecating the name which can
key the collection is highly contradictory - and we don't care a bit if it
is the w3c: deprecating the key of a collection but not the collection is a
deprecation that makes little sense: it is like keeping an array which can
be addressed by numerical key refusing to address it any longer by literal
names. And what's the logic in this move - but maybe you've been taught to
respect whatever is done by an authority regardless of the fact it needs not
to be always a terrific or a right move. Which doens't discredit the
authority actually, but reveals the limited level of ciritcal analysys that
you can attain (and sorry for misspellings, english is not my native tongue,
yet it should be clear).
[color=blue][color=green]
> > otherwise you'd have to arrange it yourself, either patching up a[/color][/color]
collection[color=blue][color=green]
> > by repeatedly calling in document.getElementById('image101') or by
> > document.getElementsByTagName("A")
> > the former is highly unpractical[/color]
>
> What's highly unpractical when using, calling, resorting to an attribute
> with a single, unique attribute value in a document?[/color]
I think you shoukld understand what you read before answering - you clearly
didn't.
The topic is: should we use a collection of all the images in a document?
Would such collection be useful?
The assumption is, yes OF COURSE it would ber useful - ya know those cases
when you want for instance apply via script something on all images.
Now, if the user in point refuses to resort to the name property or to
numerically indexed collections of images, and devotes him/herself
exclusively to id, this tantamount to the following: if he/she would one day
rebuild the whole collection in order to iterate it by the id of the images
(having given up the name), he/she'd have to do it calling in all the images
by id (imagine 20 images) and do:
-square brackets: that's an array in this case-
[document.getElementById("image1.jpg").id,
document.getElementById("image2.jpg") etc,
document.getElementById("image3.jpg"),
document.getElementById("image4.jpg"),
document.getElementById("image5.jpg"),
document.getElementById("image6.jpg"),
document.getElementById("image7.jpg"),
document.getElementById("image8.jpg"),
document.getElementById("image9.jpg"),
document.getElementById("image10.jpg"),
document.getElementById("image11.jpg"),
document.getElementById("image12.jpg"),
document.getElementById("image13.jpg"),
document.getElementById("image14.jpg"),
document.getElementById("image15.jpg"),
document.getElementById("image16.jpg"),
document.getElementById("image17.jpg"),
document.getElementById("image18.jpg"),
document.getElementById("image19.jpg"),
document.getElementById("image20.jpg")
]
In my house it is called unpractcal. So I'd rather sponsor:
for(var i in document.images){if(i!="length")alert(document.ima ges[i].src)}
Maybe you cannot see why one should iterate a collection by names instead
than by numerical index, but there are many things which you don't see here,
and by your attitude we could just give up all associative power in arrays
because you see that hey why not just using the numerical indexes and ids? I
think otherwise, I would never nevert give up associative power of the
collections because I know very well how much useful this associative power
can be when making interfaces with server side languages .- an example our
thread here "function EnablerInput() not working".
[color=blue]
> The facts are:
> 1- document.getElementsByName is slower and more memory demanding than[/color]
Excuse me, didn't I say that already?
let me see:
document.getElementsByTagName("A") //correct: IMG
"the second is much slower"
Yes, you speak of ByName - but I have personal reasons to suggest users EVEN
to never use byName (different from byTagName) anyway, regardless of its
speed or slowiness: on IE it grabs only forms and images - perhaps links but
if you give names to layers, it won't ghater the collection.
I mean, fantastic additions, yours: yet I don't understand why you gear them
addressing me. I could have understood "I want to add a few things to the
consideration made by others" and that would have been impersonal and fine -
yet this is not what you do, you're addressing me and contesting things
where there is nothing to contest. I truly don't understand what you're up
to - maybe bad mood who knows.
[color=blue]
> document.getElementById
> 2- document.getElementById is better supported by browsers, more
> reliable, more recommendable and more relevant than
> document.getElementsByName[/color]
I never quoted getElementsByName: i quoted getElementsByTagName, moreover
suggesting NOT to use it.
What is your point, and what the hack are you speaking of? Have you read my
post or you just got irritated by my website? - I found two of guys who did
in the last 3 years and out of that sense of annoynace they felt like they
had to blame me for something - who knows what...
[color=blue]
>
> , the second is much slower than just using[color=green]
> > an object which is already within the built in arrays of a loaded[/color][/color]
document.
And both are more slow than addressign directly the document.images
collection. So, what dio you want from me? I just don't get why you address
me with a set of fantastic allegations - that is a document.getElementByName
which I NEVER mentioned and with statements saying that such methods are
slower which is EXACTLY what I said. mah...
[color=blue]
> The issue was name versus id for <img>. The issue was not id versus
> collection of tagname. The subject line for this thread was clear.[/color]
And so what? The user said: I will from now on use only the id. I stated
that if he doesn't use the name, he could eventually find that he would have
to wage slower methods to grab by name an object that can be easily
retrieved by the document.images collection though its name:
document.images["image1.jpg"] - certainly faster EVEN than getElementById,
but concerns of speed here acquire relevance ONLY if the user would ever
have to LOOP through the images addressing names/ids - which is what I was
highlighting. So what's your problem, my point falls perfectly within the
scope of the thread, what are you lecturing me about here? What gave to you
the impression in me that you can afford lecturing me and telling me that I
should not speak of names and ids and collections in this thread? About the
fact that if an user speak of id and name I cannot suggest in that thread
that he could use both? You're saying to me that's off topic? Wow.
[color=blue]
> Again, name for <img> (and for several other elements) is deprecated in
> XHTML 1.
>
> In HTML 4, name vs id for <a> is a different issue:[/color]
which can be the issue in point: it still falls within the scope of the
thread jimmy, FULLY. And guess what: I am ready to bet that the original
starter of the thread saves his own documents in plain html4 doctype - wanna
bet with me on that, jimmy?
[color=blue]
> "Use id or name? Authors should consider the following issues when
> deciding whether to use id or name for an anchor name:
> * The id attribute can act as more than just an anchor name (e.g.,
> style sheet selector, processing identifier, etc.).
> * Some older user agents don't support anchors created with the id
> attribute.
> * The name attribute allows richer anchor names (with entities)."[/color]
Good points, so what? why the hack you addressed me personally moreover
contesting things I never said and lecturing me on the topic of the thread?
mah, really we have to see weird stuff on newsgroups - you always find some
princess who has to make some very pinpointed specification on the actual
size of the 15th hair on the butt.
You always find guys who cannot just state their points in an objective way
without addressing any one: they have to invent pretexts to bolster their
evidently low self esteem dismissing soemone else first: they just cannot
make their points period, they have to wipe out and destroy first, and if
nothing can be attacked, well let's invent a way.
I speak of getElementsByTagName saying it is slow, he contests that
getElementsByName is slow.
I say it is unpractical arranging a collection by getElementById, he doens't
udnerstand one comma and asks what's unpractical with it. Making a brand new
id (the overtaker of name) addressable collection by it is what does is
unpractical indeed.
I answer to a third guy moreover adding expressions of relativism in my
points, he arrives with the 5th cavalry.
I asnwer in a thread about id and name speaking of name as used in a
collection, he lectures me on the topic of the thread. Some guys just
desperately search their personal bad word - and when they find it they're
capable of trading blame.
The moon suggests: understand what you read, and if you truly want to take
the INITIATIVE of personal attacks, be sure 1) you have arguments 2) you're
speaking of what was written and not of what you imagined 3) choose someone
at your level of knowledge - you know, I'm truly a javascript beginner ,
indeed, I know nothing of javascript, and I just should not speak of name
image properties in a thread dedicated to them: "Re: img name or ID"
Alberto
http://www.unitedscripters.com/