Bug Tracker

Opened 4 years ago

Closed 3 years ago

#14894 closed bug (fixed)

IE11: exception when calling $.fn.data() on the body element when it has an 'onpageshow' attribute

Reported by: jsmreese@… Owned by: dmethvin
Priority: low Milestone: 1.11.1/2.1.1
Component: data Version: 2.1.0
Keywords: Cc:
Blocked by: Blocking:

Description

IE11 throws an exception when calling $.fn.data() on a jQuery collection of the body element when the body element has an 'onpageshow' attribute.

jsfiddle: http://jsfiddle.net/zvRXJ/2/

The exception throws in IE11 with all versions of jQuery I've tried (2.1.0, 1.11.0, 1.9.1, 1.6.4).

The exception does not throw in Chrome or Firefox (current stable versions) with any version of jQuery, nor in IE8 with 1.x versions of jQuery.

The exception does not throw when the body does not have 'onpageshow' but has other event-based attributes such as 'onclick' or 'onload'.

The exception still throws in IE11 if the body attribute has 'data-' attributes before or after the 'onpageshow' attribute.

Change History (7)

comment:1 Changed 4 years ago by Rick Waldron

Owner: set to Rick Waldron
Status: newassigned

Confirmed

comment:2 Changed 4 years ago by John Madhavan-Reese <jsmreese@…>

In the browser console, using $0.attributes, IE11 reports null for the 'onpageshow' attribute.

Chrome reports a properly named attribute object.

comment:4 Changed 4 years ago by dmethvin

Milestone: None1.11.1/2.1.1

Definitely something strange going on there. The onload attribute doesn't appear in the attributes list at all, but onpageshow tries to be there and fails. It would seem that both should be present in string form. We're going to ignore them both of course since we're just populating data- attributes in that loop.

http://jsfiddle.net/zvRXJ/3/

This appears to have started with IE11, I don't see the problem on IE10. Let's see if we can get Microsoft to put in a slipstream fix for IE11. If no fix is forthcoming we could put in a guard for null.

comment:5 Changed 4 years ago by dmethvin

Component: unfileddata
Priority: undecidedlow

comment:6 Changed 3 years ago by dmethvin

Owner: changed from Rick Waldron to dmethvin

comment:7 Changed 3 years ago by Dave Methvin

Resolution: fixed
Status: assignedclosed

Data: Work around IE11 bug with onpageshow attribute

Fixes #14894

Changeset: b8133e282ceebf502c7c08d849b176a929c9c450

Note: See TracTickets for help on using tickets.