bnebeytcha.co.il - javascript for show/hide not working

RESOLVED FIXED

Status

Tech Evangelism Graveyard
Hebrew
RESOLVED FIXED
14 years ago
3 years ago

People

(Reporter: ittay freiman, Unassigned)

Tracking

Details

(URL)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5a) Gecko/20030905 Mozilla Firebird/0.6.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5a) Gecko/20030905 Mozilla Firebird/0.6.1

The example page contains forum messages, where a click on the message header
should produce the message content. however, it does not.

I've looked into this and there are two reasons:
1. the link is defined as <a href="javascript:show_hide(id_7114)">...</a>. I
found that this somehow means the function isn't called (i've edited the page
and added an alert() call). When the link is changed to have single quotes
around the argument (javascript:show_hide('id_7114')), the function is called.

2. the function itself has a syntax of msg_id.style.display to change the
attribute. this doesn't work. in the javascript console i get the message
'Error: msg_id.style has no properties'. if i change the function to use
document.getElementById(msg_id).style.display, everything works ok.

obviously, this page works perfectly in IE. also, this error *HAS NOTHING TO DO
WITH HEBREW*. the simple fact is that a lot of hebrew sites don't work right in
anything other than IE.



Reproducible: Always

Steps to Reproduce:
1.
2.
3.
The page is relying on a "feature" of IE that window.x is the same object as
document.getElementById("x").  So when it calls:

  show_hide(id_7114)

it should really be doing

  show_hide(document.getElementById("id_7114"))

if it wants the code to work in all DOM-compliant browsers (including IE).

Mozilla has no plans to pollute the window namespace by sticking all IDs in
there like IE does.
Assignee: rogerl → hebrew
Status: UNCONFIRMED → NEW
Component: JavaScript Engine → Hebrew
Ever confirmed: true
Product: Browser → Tech Evangelism
QA Contact: PhilSchwartau → hebrew
Version: Trunk → unspecified
(Reporter)

Comment 2

14 years ago
IMHO mozilla should strive to support any page out there, since the de-facto
standard is IE. at my home, i use IE since i have no choice, because many sites
just don't work well with mozilla.

maybe there should be a 'dirty' mode that the user can toggle which will enable
all IE specific features.

*ALSO* note that this was not the only problem. the most serious problem was
that a call to show_hide without quotes around the parameter didn't actually
call the function.
> maybe there should be a 'dirty' mode that the user can toggle which will enable
> all IE specific features.

Implementing this would take a lot more time than implementing all the rest of
Mozilla put together (since it would require duplicating all of IE bug-for-bug
in _addition_ to implementing things the way they should be implemented).  In
any case, if the goal is to make an exact copy of IE, why bother?

As for the function not being called, that's because without the quotes the
argument is an identifier, and since it does not resolve to a value you get an
"unknown identifier" error (see the JavaScript console; the exact error text may
be slightly different, but the upshow is "trying to use a variable name without
saying what it actually is").  IE will throw the same exact error if the object
with that ID is removed from the page.

(Reporter)

Comment 4

14 years ago
Opera works well with the javascript. 
Opera copies some IE features, albeit buggily.  As a result, scripts like this
sometimes work in Opera, sometimes not; and the page author never knows whether
they will.

Comment 6

13 years ago
Conforming summary to TFM item 10 at 
http://www.mozilla.org/projects/tech-evangelism/site/procedures.html#file-new
Summary: javascript for show/hide not working → bnebeytcha.co.il - javascript for show/hide not working

Comment 7

9 years ago
Although the bad js code is still the same, Firefox seems to tolerate this now, so it works well in FF 3.0.6.
Still it gives a warning, w3c incompatible.

Updated

9 years ago
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
Product: Tech Evangelism → Tech Evangelism Graveyard
You need to log in before you can comment on or make changes to this bug.