473,322 Members | 1,690 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

prototype.js issue: IE thinks $() ain't the same as document.getElementById()

[X-posted to the ruby-on-rails-spinoffs mailing list...]

JavaScripters:

Steps to reproduce the bug:

Save this in "outer.html":

<div id='updateMe'></div>
<iframe src='inner.html'/>

Now save this into "inner.html":

<input type='button' value='control'
onclick="window.parent.location.href =
&quot;javascript:void(document.getElementById('upd ateMe').innerHTML
= 'control')&quot;"/>

<script src="/javascripts/prototype.js?1168956448"
type="text/javascript"></script>

<input type='button' value='experiment'
onclick="window.parent.location.href =
&quot;javascript:void($('updateMe').innerHTML =
'experiment')&quot;"/>

Surf Internet Explorer (7 BTW) to outer.html, and observe two buttons.

Click 'control', and observe that the outer.html's div updates to 'control'.

Observed behavior:

Click 'experiment', and observe a null-object crash. $() could not find the
same value as getElementById().

Expected behavior:

Because the javascript:void trick evaluates in the context of the target
frame (not the source frame), the behaviors of $() and getElementById()
should be exactly the same inside the javascript:void() line as inside the
target frame, right?

(BTW I suspect from related evidence that the code "works" in Firefox...)

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!
Jan 19 '07 #1
2 2208
Phlip wrote:
[X-posted to the ruby-on-rails-spinoffs mailing list...]
Mention of prototype.js in these parts is a great way of bringing down a
ton of bricks!

--
Ian Collins.
Jan 19 '07 #2

Phlip wrote:
[X-posted to the ruby-on-rails-spinoffs mailing list...]
Not cross-posted, multi-posted. Your answer is in the rails spin-offs
group.

In short, it is bleedin' obvious that Prototype's $() is not the same
as getElementById(), nor is simply a short substitute (though it can
be, and often is, used as such).

Your "bug" is not a bug but a misconception on your behalf.
--
Rob

Jan 19 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Brian Genisio | last post by:
Hi all, Does anyone know of a way in IE to determine the prototype name of an object? For instance, in Mozilla, I can say: junk = document.getElementById("myID"); alert(junk.toString());
8
by: Elf M. Sternberg | last post by:
One of the complaints about prototype.js (google for it if you're not familiar with it) is that it's poorly documented. I have this inkling that the key to understanding prototype.js is in the...
12
by: petermichaux | last post by:
Hi, I've been reading the recent posts and older archives of comp.lang.javascript and am surprised by the sentiments expressed about the prototype.js library for a few reasons: 1) The library...
1
by: drnicwilliams | last post by:
The Prototype library gives us the $() operation for converting a DOM element id into the DOM element: $('element-id'). It also appends a bunch of functions to the resulting object. Sometimes...
6
by: Nico VanHaaster | last post by:
Hello all, I have run across an issue with IE 6.0+. I have a page that makes an XMLHttpRequest to the webserver to update a report on the page. The first time you hit the refresh report button...
3
omerbutt
by: omerbutt | last post by:
hi there i have downloaded a prototype tooltip from http://www.nickstakenburg.com/projects/prototip/ the logic it uses is to call the script after creating the <div> for example i am using the...
1
Stang02GT
by: Stang02GT | last post by:
Here is the issue that I am having. I have two text feilds where users need to enter a "From Date:" and a "To Date:" they then hit a update button and my code will pull back the data for the date...
1
by: chaitanyadotcom | last post by:
As per my application i need to create tabs using iFrame dynamically. There are totally 4 buttons in my application where for each button i provide a link. Where in it will dynamically create a tab...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.