Open Bug 387927 Opened 14 years ago Updated 2 years ago

Event handlers don't fire in form fields when the id matches the function name

Categories

(Core :: DOM: Core & HTML, defect, P5)

defect

Tracking

()

UNCONFIRMED

People

(Reporter: mattsch, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.4) Gecko/20070601 SeaMonkey/1.1.2
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.4) Gecko/20070601 SeaMonkey/1.1.2

Event handlers don't fire in form fields when the id matches the function name.  I will attach a testcase to demonstrate this.

Reproducible: Always

Steps to Reproduce:
1. Name a function the same as an id for a form field.
2. Call that function from an event handler on a form field.
Actual Results:  
Throws a javascript error saying: [functionName] is not a function.

Expected Results:  
Event handler executes the function.
I think bug 252763 comment 2 basically describes what's going on here.
Component: General → DOM
OS: Linux → All
Product: Firefox → Core
QA Contact: general → general
Hardware: PC → All
Version: unspecified → Trunk
It would be nice if DOM0 compatibility was turned off based on DOCTYPE.
This is probably a WONTFIX; because we didn't do this originally, we probably can't start doing it now without breaking sites.
Erm, that comment wasn't clear: breaking backwards compatibility is essentially infeasible because there are most likely sites in standards mode using this functionality.
Bug 256932 says the "global namespace pollution" feature was only added for quirks mode...
We're talking specifically about form controls here.  I think they're a special case.
According to Zbarsky's comment, I thought it had something to do with DOM0.  Yes I think global namespace pollution should be turned off for standards compliance mode then especially if it was only originally meant for quirks mode.
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.