onclick actions not executed in <a> tag

RESOLVED WORKSFORME

Status

()

Core
DOM: Core & HTML
RESOLVED WORKSFORME
13 years ago
13 years ago

People

(Reporter: farrier, Unassigned)

Tracking

({testcase})

Trunk
x86
Windows 2000
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

Following link always works, but onclick="return false" should prevent this.

<a href="test3.html" onclick="return false">click me 3</a>

Following link always displays the "are you sure?" dialog, but reloads the page
BEFORE displaying the dialog.

<a onclick="return confirm('are you sure?');" href="same_page.html">refresh page</a>

Following link never displays the "are you sure?" dialog, and just loads
other_page.html.

<a onclick="return confirm('are you sure?');" href="other_page.html">new page</a>

Following form works fine, correctly asking for confirmation, and only
submitting the form if the user clicks "OK".

<form action="same_or_different_page.html">
<input type="submit" onclick="return confirm('sure?');" />
</form>


Reproducible: Always

Steps to Reproduce:
1. Create a file with the above links in.
2. Click the links.


Actual Results:  
The onclick action only runs if the link links to the same page, and even then,
it only runs AFTER the page has reloaded.

However, other firefox users have not confirmed this behaviour.

Expected Results:  
It should display a dialog asking "are you sure?" and only load the link href if
the user clicks "OK", NOT if the user clicks "cancel", and DEFINITELY NOT before
the user has clicked anything at all.

Possibly a dup of:
 https://bugzilla.mozilla.org/show_bug.cgi?id=64395
though I think maybe that guy was having a different but similar issue.

I only marked this as "normal", since although a major feature is broken (the
whole "are you sure?" thing is pretty important for userfriendly websites,
imho), nobody else appears able to reproduce it.

about:buildconfig

Build platform
target
i686-pc-cygwin

Build tools
Compiler 	Version 	Compiler flags
$(CYGWIN_WRAPPER) cl 	12.00.8804 	-TC -nologo -W3 -nologo -Gy -Fd$(PDBFILE)
$(CYGWIN_WRAPPER) cl 	12.00.8804 	-TP -nologo -W3 -nologo -Gy -Fd$(PDBFILE)

Configure arguments
--disable-ldap --disable-mailnews
--enable-extensions=cookie,xml-rpc,xmlextras,pref,transformiix,universalchardet,webservices,inspector,gnomevfs,negotiateauth
--enable-crypto --disable-composer --enable-single-profile
--disable-profilesharing --enable-optimize --disable-debug --disable-tests
--enable-static --disable-shared --enable-official-branding

Comment 1

13 years ago
Created attachment 173589 [details]
Reduced testcase from reporter's code

Comment 2

13 years ago
When I try the provided testcase with Mozilla 1.8b build 2005020504 and with
Firefox 1.0 build 20041107 under XP Pro SP2, I get the expected results for the
3 links and for the submit button.

I also get the expected results at the provided URL.

WORKSFORME

Reporter, can you verify/confirm you have javascript support enabled?
Keywords: testcase
Not a JS engine bug in any case.  Probably evang, but throwing to DOM level 0
for now.

/be
Assignee: general → general
Component: JavaScript Engine → DOM: Level 0

Comment 4

13 years ago
wfm in ff 1.0, a trunk ff from 20050204, mozilla 1.7.3, 1.7.6 from 20050205
Worksforme as well.  Marking so, but please reopen if you can reproduce this in
a current trunk build.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.