Ticket #10891 (closed bug: wontfix)
object not support "toLowerCase" property or method
| Reported by: | jacklondon.chen@… | Owned by: | jacklondon.chen@… |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | core | Version: | 1.7.1 |
| Keywords: | nodeName | Cc: | |
| Blocking: | Blocked by: |
Description (last modified by dmethvin) (diff)
we got a runtime error using Microsoft IE 9.0.8112.16421, jquery-1.7.1.js line 5188: if ( elem.nodeName.toLowerCase() === cur ) {
the error message is: Error: object not support "toLowerCase" property or method.
in IE 9 debug watch windows, we found that elem is a DispHTMLFormElement object , and elem.nodeName is DispHTMLInputElement but orignal, we use (jquery-1.3.2.js + IE 9.0.8112.16421) and run without errors.
Change History
comment:2 Changed 18 months ago by sindresorhus
- Owner set to jacklondon.chen@…
- Status changed from new to pending
comment:3 Changed 18 months ago by jacklondon.chen@…
- Status changed from pending to new
I have found an alternative soluction for this issue. change the DOCTYPE will work. the original DOCTYPE only work with jquery-1.3.2.js is: <!DOCTYPE HTML PUBLIC "-W3CDTD HTML 4.0 TransitionalEN">
and these two work all time: <!DOCTYPE HTML PUBLIC "-W3CDTD HTML 4.01EN" " http://www.w3.org/TR/html4/strict.dtd"> <!DOCTYPE html>
comment:4 Changed 18 months ago by jacklondon.chen@…
the complete code has saved on jsFiddle at: http://jsfiddle.net/vGhR2/1/
comment:5 Changed 18 months ago by jacklondon.chen@…
and jsFiddle auto-generate page start with: <!DOCTYPE html> which makes it running without error.
comment:6 Changed 18 months ago by sindresorhus
- Keywords nodeName added
- Priority changed from undecided to low
- Status changed from new to open
- Component changed from unfiled to core
Simplified testcase
Reproducible in IE7 and all other IE quirks.
You've encountered this problem because one of your HTML tags is: <input name="nodeName">
You should avoid using properties or methods of a form in the name attribute.
As you can see in the discussion, it isn't practical for jQuery to guard against all these methods.
In my opinion this is a wontfix, but will let a core member decide it's fate.
It should at least be documented somewhere.
comment:7 Changed 18 months ago by jacklondon.chen@…
there is no document tell us that we cannot use <input name="nodeName">, and no document says we cannot use <input value="id">, or <input value="input">, or <input value="value">. Why jquery-1.3.2.js can work but juery-1.7.1.js cannot? I think this is a version compatibility issue. And there is also no document says that jQuery not support <!DOCTYPE HTML PUBLIC "-W3CDTD HTML 4.0 TransitionalEN">. Maybe the document should suggest we use <!DOCTYPE html> in the beginning of pages. Sorry for my poor English.
comment:8 Changed 18 months ago by jacklondon.chen@…
I find the root cause for this issue. for doctype of TransitionalEN in IE9, there is a strange DOM: document.forms[0].nodeName will be the <input> DOM object with name ="nodeName" . So, I suggest, if jQuery don't want to support doctype of TransitionalEN, just write it in document. Or, just change code at line 5188 in jquery-1.7.1.js from: if ( elem.nodeName.toLowerCase() === cur ) { to if (typeof elem.nodeName === "string" && elem.nodeName.toLowerCase() === cur ) {
this will work.
comment:9 Changed 15 months ago by john@…
I too just got bit by this bug. We have an internal webapp that uses a Java Content Repository. "Node Name" is a common way to refer to objects in the repository, so we have several forms that have hidden inputs with id= or name="nodeName". I just spent the last 4 hours trying to figure out why jQuery was complaining when I was trying to bind a submit handler to the form.
I just now figured out it was because the form had a hidden input named "nodeName".
comment:10 Changed 15 months ago by rwaldron
- Status changed from open to closed
- Resolution set to wontfix
It's not jQuery's problem that some rogue Java development package is bad at picking names.
comment:11 Changed 15 months ago by jacklondon.chen@…
Is there any document said we cannot use input name="nodeName"? javascript document ? No! jquery document ? No!
comment:12 Changed 14 months ago by deepaksinghkushwah@…
Change elem.nodeName.toLowerCase()to elem.nodeName.toString().toLowerCase() will resolve this problem at line number 1899.
comment:13 Changed 14 months ago by deepaksinghkushwah@…
I have used uncompress jquery file. Change string in Jquery file.
comment:14 Changed 9 months ago by mike_jq@…
Did exactly the same. I'm not using any "Java" lib or anything I'm just getting this error straight out in Firefox with jQuery 1.7.2. I changed all references a.nodeName.toLowerCase() to a.nodeName.toString().toLowerCase() and everything is working as expected.
comment:15 Changed 9 months ago by dmethvin
there is no document tell us that we cannot use <input name="nodeName">, and no document says we cannot use <input value="id">, or <input value="input">, or <input value="value">.
comment:17 Changed 7 months ago by Estigy
Just to add my 10 cent: I encountered the same bug just now, using jQuery v1.8.2.
BUT: I don't have any element of id or name "nodeName" anywhere in my code.
Switching back to v1.7.2 got me rid of the problem.
comment:18 Changed 3 months ago by tom@…
Got the same error: Description and sollution here:
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.
Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.