[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

"getElementsByTagName" and namespaces

ram

1/4/2016 4:56:00 PM

The DOM4 specification of the W3C says:

»The getElementsByTagName(localName) method must return
the list of elements with local name localName for the
context object. Note: Thus, in an HTML document,
document.getElementsByTagName("FOO") will match FOO
elements that are not in the HTML namespace, and foo
elements that are in the HTML namespace, but not FOO
elements that are in the HTML namespace.«

So, why will the uppercase argument »FOO« match
lowercase names from the HTML namespace but not
uppercase names from it?

PS: With regard to »foo«, I wrote this post
[edited »recommandation« to »recommendation« here]:

Newsgroups: alt.usage.english
Subject: "foo" indecent?
Message-ID: <foo-20160104172956@ram.dialup.fu-berlin.de>

I encounter the character sequence »foo« even in formal
technical documents (like the W3C DOM) today.

Isn't »foo« an indecent word?

Some persons like to use »foo« and »bar« in
technical examples as »meaningless words«.

I assume that this »foo« and »bar« comes from »FUBAR«,
which in turn refers to a word that starts with »f« and
clearly /is/ indecent.

Given that »foo« is hinting at this clearly-indecent
f-word, is it appropriate to use it in technical
recommendations that are intended to be read by people
of all kinds, genders and ages?

3 Answers

Jeff

11/20/2010 6:19:00 PM

0

On Nov 20, 3:54 am, brilton <notl...@yacht.net> wrote:
> On 20/11/10 5:50 PM, who? wrote:
>
>
>
>
>
>
>
>
>
> > On Nov 20, 3:42 am, brilton<notl...@yacht.net>  wrote:
> >> Hoo boy. I know this has been mentioned in this forum previously.
>
> >> But if you want to waste an hour and a half of your life doing something
> >> you will regret, then there must be better ways of doing so than
> >> watching this.
>
> >> It's like an alternate history of the Beatles written by a primary
> >> school student and narrated by someone who sounds almost but not
> >> entirely unlike George Harrison.
>
> >> There are some pretty cool new "clues" in there though, and some of the
> >> graphics where they manipulate album cover artwork are quite snazzy,
> >> but, if you had a choice between watching this and having a nine inch
> >> nail driven up through your nostril into your brain, I would counsel
> >> seriously considering the latter.
>
> >> There's a bonus featurette where the film-maker interviews Al Aronowitz
> >> talking about Bob Dylan, and they have to put subtitles up because he is
> >> speaking so indistinctly.
>
> > Is there a link?
>
> Sorry, it was a DVD I watched last night.

Oh, yeah. I saw at least part of that a while back on Youtube.
It was a joke.

Aleksandro

1/4/2016 6:38:00 PM

0

On 04/01/16 13:55, Stefan Ram wrote:
> Newsgroups: alt.usage.english
> Subject: "foo" indecent?
> Message-ID: <foo-20160104172956@ram.dialup.fu-berlin.de>
>
> I encounter the character sequence »foo« even in formal
> technical documents (like the W3C DOM) today.
>
> Isn't »foo« an indecent word?
>
> Some persons like to use »foo« and »bar« in
> technical examples as »meaningless words«.
>
> I assume that this »foo« and »bar« comes from »FUBAR«,
> which in turn refers to a word that starts with »f« and
> clearly /is/ indecent.
>
> Given that »foo« is hinting at this clearly-indecent
> f-word, is it appropriate to use it in technical
> recommendations that are intended to be read by people
> of all kinds, genders and ages?

?I like offending people, because I think people who get offended should
be offended?
Linus Torvalds.

Thomas 'PointedEars' Lahn

1/4/2016 9:45:00 PM

0

Stefan Ram wrote:

> The DOM4 specification of the W3C says:
>
> »The getElementsByTagName(localName) method must return
> the list of elements with local name localName for the
> context object. Note: Thus, in an HTML document,
> document.getElementsByTagName("FOO") will match FOO
> elements that are not in the HTML namespace, and foo
> elements that are in the HTML namespace, but not FOO
> elements that are in the HTML namespace.«
>
> So, why will the uppercase argument »FOO« match
> lowercase names from the HTML namespace but not
> uppercase names from it?

Again you should have cited your reference and given the URI of the quoted
specification, <http://www.w3.org/TR/2015/REC-dom-20151119/#dom-document-getelementsbyt....

Why getElementsByTagName() is supposed to work this way is explained in the
part that the link with text â??list of elements with local name /localName/â?
refers to:

,-<http://www.w3.org/TR/2015/REC-dom-20151119/#concept-getelementsbyt...
|
| The list of elements with local name /localName/ for a node /root/ is the
| `HTMLCollection` returned by the following algorithm:
|
| 1. If /localName/ is "*" (U+002A), return a `HTMLCollection` rooted at
| /root/, whose filter matches only elements.
|
| 2. Otherwise, if /root/'s node document is an HTML document, return a
| `HTMLCollection` rooted at /root/, whose filter matches the following
| descendant elements:
|
| * Whose namespace is the HTML namespace and whose local name is
| /localName/ converted to ASCII lowercase.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

That excludes â??FOOâ? elements *in the HTML namespace* with
getElementsByTagName("FOO"), and leaves only â??fooâ? elements *in that
namespace*.

| * Whose namespace is not the HTML namespace and whose local name is
| /localName/.
^^^^^^^^^^^

That includes â??FOOâ? elements *not in the HTML namespace* with
getElementsByTagName("FOO").

| 3. Otherwise, return a `HTMLCollection` rooted at /root/, whose filter
| matches descendant elements whose local name is /localName/.

> [troll bait]

Nice try.

--
PointedEars
FAQ: <http://PointedEars.... | SVN: <http://PointedEars.de...
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-...
Please do not cc me. / Bitte keine Kopien per E-Mail.