Click here to get back home

Automatic tag variables in IE

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Automatic tag variables in IE acw 07-02-2008
Posted by acw on July 2, 2008, 1:03 pm
Please log in for more thread options
I am trying to understand how IE handles automatic tag variables.

I know that IE will create a global variable each time it finds a tag
with its name or id attribute set. If you have more than one tag with
the same name or id (yes this is bad) on a page then that global
variable goes from being a tag reference to being a collection of
references.

In most cases if you remove the duplicate tag the global var becomes a
tag reference again. Other times it remains a collection but with only
one element.

Getting completely away from using the automatic variables is not an
option. So, I am trying to understand how the variables are handled by
IE. Does anyone know what determines whether the global variable is
reverted to a tag reference or left as a collection when the duplicate
tags are removed from the page?


============================================================

For example, if we start with
.
<div id="container1"></div>
<div id="container2"></div>
.

then do ...

.
container1.innerHTML = "<span id='sometext'>some text</span>"
...
container2.innerHTML = "<span id='sometext'>some more text</span>"
.



The global var sometext is a collection with two elements.


If we do the following


container2.innerHTML = ""


The global var sometext is usually pointing to the first span. Other
times is a collection and sometext[0] points to the first span.




TIA!

Posted by Jonathan N. Little on July 2, 2008, 1:25 pm
Please log in for more thread options
acw wrote:
> I am trying to understand how IE handles automatic tag variables.
>
> I know that IE will create a global variable each time it finds a tag
> with its name or id attribute set. If you have more than one tag with
> the same name or id (yes this is bad) on a page then that global
> variable goes from being a tag reference to being a collection of
> references.
>
> In most cases if you remove the duplicate tag the global var becomes a
> tag reference again. Other times it remains a collection but with only
> one element.
>
> Getting completely away from using the automatic variables is not an
> option. So, I am trying to understand how the variables are handled by
> IE. Does anyone know what determines whether the global variable is
> reverted to a tag reference or left as a collection when the duplicate
> tags are removed from the page?
>
>
> ============================================================
>
> For example, if we start with
> .
> <div id="container1"></div>
> <div id="container2"></div>
> .
>
> then do ...
>
> .
> container1.innerHTML = "<span id='sometext'>some text</span>"
> ...
> container2.innerHTML = "<span id='sometext'>some more text</span>"
> .
>
>
>
> The global var sometext is a collection with two elements.
>
>
> If we do the following
>
>
> container2.innerHTML = ""
>
>
> The global var sometext is usually pointing to the first span. Other
> times is a collection and sometext[0] points to the first span.
>

The flaw is in a document all IDs must be unique, and IDs cannot be
arrays...


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Posted by acw on July 2, 2008, 1:41 pm
Please log in for more thread options
Jonathan,

Thanks for the response.

Yes ids do need to be unique. In this case that are not and, because
of the nature of the project, I am not in a position to make them
unique.


I am really just wanting to understand how IE handles the automatic
vars.


TIA




> acw wrote:
> > I am trying to understand how IE handles automatic tag variables.
>
> > I know that IE will create a global variable each time it finds a tag
> > with its name or id attribute set. If you have more than one tag with
> > the same name or id (yes this is bad) on a page then that global
> > variable goes from being a tag reference to being a collection of
> > references.
>
> > In most cases if you remove the duplicate tag the global var becomes a
> > tag reference again. Other times it remains a collection but with only
> > one element.
>
> > Getting completely away from using the automatic variables is not an
> > option. So, I am trying to understand how the variables are handled by
> > IE. Does anyone know what determines whether the global variable is
> > reverted to a tag reference or left as a collection when the duplicate
> > tags are removed from the page?
>
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> > For example, if we start with
> > .
> > <div id=3D"container1"></div>
> > <div id=3D"container2"></div>
> > .
>
> > then do ...
>
> > .
> > container1.innerHTML =3D "<span id=3D'sometext'>some text</span>"
> > ...
> > container2.innerHTML =3D "<span id=3D'sometext'>some more text</span>"
> > .
>
> > The global var sometext is a collection with two elements.
>
> > If we do the following
>
> > container2.innerHTML =3D ""
>
> > The global var sometext is usually pointing to the first span. Other
> > times is a collection and sometext[0] points to the first span.
>
> The flaw is in a document all IDs must be unique, and IDs cannot be
> arrays...
>
> --
> Take care,
>
> Jonathan
> -------------------
> LITTLE WORKS STUDIOhttp://www.LittleWorksStudio.com- Hide quoted text -
>
> - Show quoted text -


Posted by Jonathan N. Little on July 2, 2008, 3:05 pm
Please log in for more thread options
acw wrote:
> Jonathan,
>
> Thanks for the response.
>
> Yes ids do need to be unique. In this case that are not and, because
> of the nature of the project, I am not in a position to make them
> unique.

Well that make the document invalid, then who knows? Computers like
"Yes|No", when you throw "Maybe" at them then it is up how well of an
exception handler you got...



--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Posted by Bergamot on July 2, 2008, 1:57 pm
Please log in for more thread options

acw wrote:
> I am trying to understand how IE handles automatic tag variables.

I suggest asking Microsoft how their browser works because I doubt very
many people here know or care. The IE groups are over at
microsoft.public.<something about IE>

--
Berg

Similar ThreadsPosted
Environment variables and HTML. November 28, 2004, 7:39 am
Odd occurence with extra variables in GET form July 16, 2004, 12:28 pm
How to validate HTML with variables in link? August 16, 2004, 1:35 am
Automatic Redirection December 28, 2004, 1:16 am
How can I set up an automatic membership type of program? September 11, 2005, 12:31 pm
Automatic addition of modifier to query when submitted February 9, 2008, 12:07 am
How to remove automatic printing popup from saved web page? July 3, 2005, 10:52 am
How works a software for automatic retrieval of Search Engine positioning? August 27, 2004, 3:51 am
Omega Co-Axial Automatic Chronometer 4586.75, Best Luxury Watch - www.luxury-gift.org July 2, 2008, 10:17 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap