Bug Tracker

Opened 3 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:


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 3 years ago by rwaldron

  • Owner set to rwaldron
  • Status changed from new to assigned


comment:2 Changed 3 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 3 years ago by dmethvin

  • Milestone changed from None to 1.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.


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 3 years ago by dmethvin

  • Component changed from unfiled to data
  • Priority changed from undecided to low

comment:6 Changed 3 years ago by dmethvin

  • Owner changed from rwaldron to dmethvin

comment:7 Changed 3 years ago by Dave Methvin

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

Data: Work around IE11 bug with onpageshow attribute

Fixes #14894

Changeset: b8133e282ceebf502c7c08d849b176a929c9c450

Note: See TracTickets for help on using tickets.