Bug Tracker

Modify

Ticket #14074 (closed bug: fixed)

Opened 10 months ago

Last modified 5 months ago

jQuery 1 throws an error on window ready when there is an element in the DOM with the id 'nodeName'

Reported by: me@… Owned by:
Priority: low Milestone: 1.11
Component: core Version: 1.10.1
Keywords: Cc:
Blocking: Blocked by:

Description

When triggering the window ready event jQuery 1, since version 1.8.0, throws the error:

  Uncaught TypeError: Object #<HTMLSpanElement> has no method 'toLowerCase'

on the line:

    var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];

The error is thrown when an element exists in the DOM with the id: "nodeName" or window.nodeName is defined as something

This is caused by passing the window object into acceptData, which is meant for DOM Elements. When the nodeName property is defined on the window object to be anything which doesn't have a toLowerCase function, the error is thrown.

JSFiddle test case:  http://jsfiddle.net/6HWPr/5/

Bug originally posted to StackOverflow:  http://stackoverflow.com/q/17329025/772035

Change History

comment:1 Changed 10 months ago by timmywil

  • Priority changed from undecided to low
  • Status changed from new to open
  • Component changed from unfiled to core

Well, that's strange. This is certainly not high priority, but acceptData could probably check nodeType === 1 instead.

comment:2 Changed 10 months ago by dmethvin

  • Milestone changed from None to 1.next

comment:3 Changed 5 months ago by Richard Gibson

  • Status changed from open to closed
  • Resolution set to fixed

Fix #14074: element id="nodeName". Close gh-1389. (cherry picked from commit 126d596b56924613687329b7aab4f0cdf4b593b3)

Conflicts:

src/data.js src/data/accepts.js test/unit/core.js test/unit/data.js

Changeset: c66a5e70f2745048b30b7e7e8801d70ce9c640c7

comment:4 Changed 5 months ago by dmethvin

  • Milestone changed from 1.next to 1.11

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.