Open Bug 407880 Opened 17 years ago Updated 2 years ago

error console should throw up a warning when pre-dom1 javascript element fetching is used

Categories

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

enhancement

Tracking

()

UNCONFIRMED

People

(Reporter: michiel, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11 Currently the error console does not generate an error when javascript is used to access an attribute of a document element such as "document.formname.action = 'index.html'". Allowing this kind of pre-DOM1 accessing of attributes as if they are element names should be discouraged by way of a warning that this is deprecated javascript and may be incorrectly resolved. If we have the following html code: <form name="moo" action="/" method="get"><input type="hidden" name="action" value="random text/></form>, then using "document.moo.action" will point to two things, namely the form's "action" attribute, as well as the input element with name "action" nested in the form element. Reproducible: Always Steps to Reproduce: 1. create html file with <form name="moo" action="/" method="get"><input type="hidden" name="action" value="random text/></form><script>document.moo.action="index.html"</script> somewhere in it 2. Open file in firefox with error console open 3. notice firefox silently accepts this technically illegal because ambiguous javascript Actual Results: error console will remain silent on the ambiguous javascript Expected Results: error console should have issued an ambiguity warning a la "assignment mismatch: document element accessed as element attribute instead at line ..." particularly because firefox is the only browser to silently accept ambiguous javascript like this, it is very hard to debug a website that runs fine in firefox, but breaks in IE or Opera because neither of those browsers will accurately spot the problem. Given that firefox can disambiguate (correctly understanding document.moo.action="index.html" as an attribute assignment, and document.moo.action.value="some val" as assigning a string to the input element's value attribute), it should be possible to issue an error console warning when it performs this disambiguation. bug marked major because it's technically allowing illegal javascript, which makes firefox a less suitable browser for testing websites.
major->enhancement
Severity: major → enhancement
Component: Error Console → DOM: Level 0
OS: Windows XP → All
Product: Firefox → Core
QA Contact: error.console → general
Hardware: PC → All
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
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.