Skip to main content

Bug Tracker

Side navigation

#10891 closed bug (wontfix)

Opened November 25, 2011 06:48AM UTC

Closed February 28, 2012 03:02AM UTC

Last modified March 21, 2014 08:37AM UTC

object not support "toLowerCase" property or method

Reported by: jacklondon.chen@gmail.com Owned by: jacklondon.chen@gmail.com
Priority: low Milestone: None
Component: core Version: 1.7.1
Keywords: nodeName Cc:
Blocked by: Blocking:
Description

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.

Attachments (0)
Change History (20)

Changed November 28, 2011 07:38PM UTC by sindresorhus comment:1

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.

Changed November 28, 2011 10:19PM UTC by sindresorhus comment:2

owner: → jacklondon.chen@gmail.com
status: newpending

Changed December 01, 2011 06:14AM UTC by jacklondon.chen@gmail.com comment:3

status: pendingnew

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 Transitional//EN">

and these two work all time:

<!DOCTYPE HTML PUBLIC "-W3CDTD HTML 4.01EN" "http:www.w3.org/TR/html4/strict.dtd">

<!DOCTYPE html>

Changed December 01, 2011 07:10AM UTC by jacklondon.chen@gmail.com comment:4

the complete code has saved on jsFiddle at:

http://jsfiddle.net/vGhR2/1/

Changed December 01, 2011 07:12AM UTC by jacklondon.chen@gmail.com comment:5

and jsFiddle auto-generate page start with:

<!DOCTYPE html>

which makes it running without error.

Changed December 01, 2011 10:25AM UTC by sindresorhus comment:6

component: unfiledcore
keywords: → nodeName
priority: undecidedlow
status: newopen

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.

Old discussion.

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.

Changed December 01, 2011 03:11PM UTC by jacklondon.chen@gmail.com comment:7

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.

Changed December 02, 2011 08:45AM UTC by jacklondon.chen@gmail.com comment:8

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.

Changed February 28, 2012 01:04AM UTC by john@creanium.net comment:9

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".

Changed February 28, 2012 03:02AM UTC by rwaldron comment:10

resolution: → wontfix
status: openclosed

It's not jQuery's problem that some rogue Java development package is bad at picking names.

Changed February 28, 2012 04:58AM UTC by jacklondon.chen@gmail.com comment:11

Is there any document said we cannot use input name="nodeName"?

javascript document ? No!

jquery document ? No!

Changed March 23, 2012 10:58AM UTC by deepaksinghkushwah@gmail.com comment:12

Change elem.nodeName.toLowerCase()to elem.nodeName.toString().toLowerCase() will resolve this problem at line number 1899.

Changed March 23, 2012 11:00AM UTC by deepaksinghkushwah@gmail.com comment:13

I have used uncompress jquery file. Change string in Jquery file.

Changed September 06, 2012 03:55AM UTC by mike_jq@superior.ath.cx comment:14

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.

Changed September 06, 2012 01:17PM UTC by dmethvin comment:15

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">.

http://kangax.github.com/domlint/

Changed September 06, 2012 01:18PM UTC by dmethvin comment:16

description: 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. \ \ <script language="JavaScript" type="text/JavaScript"> \ <!-- \ init_paging_table_css(); \ //--> \ </script> \ \ .js \ function init_paging_table_css() { \ jq(document).ready(function() { \ jq("#paging_table tbody tr").mouseover( \ function() { \ jq(this).addClass("paging_table_mouseover_row"); \ jq("#paging_table theader").removeClass( \ "paging_table_mouseover_row"); \ }); \ \ and the html page struct is : \ body \ form \ table \ thead \ tr \ td \ tbody \ tr \ td \ tfoot \ tr \ tdwe 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. \

Changed October 23, 2012 05:54AM UTC by Estigy comment:17

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.

Changed February 27, 2013 03:01PM UTC by tom@net-programator.cz comment:18

Changed January 05, 2014 02:24AM UTC by dmethvin comment:19

#14667 is a duplicate of this ticket.

Changed March 21, 2014 08:37AM UTC by mst@mstsoft.com comment:20

I just lost half an hour tracking this down, jquery 2.1.0, called input name "nodeName".

I recommend adding a check for this condition and raising an error like "You cannot use reserved words" instead of this non-descriptive error that comes up.