Skip to main content

Bug Tracker

Side navigation

#14894 closed bug (fixed)

Opened March 17, 2014 03:13PM UTC

Closed April 30, 2014 03:04PM UTC

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

Reported by: jsmreese@pureshare.com 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.

Attachments (0)
Change History (7)

Changed March 17, 2014 03:49PM UTC by rwaldron comment:1

owner: → rwaldron
status: newassigned

Confirmed

Changed March 17, 2014 04:16PM UTC by John Madhavan-Reese <jsmreese@pureshare.com> comment:2

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

Chrome reports a properly named attribute object.

Changed March 17, 2014 05:14PM UTC by John Madhavan-Reese <jsmreese@pureshare.com> comment:3

Changed March 18, 2014 07:56PM UTC by dmethvin comment:4

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.

Changed March 18, 2014 07:56PM UTC by dmethvin comment:5

component: unfileddata
priority: undecidedlow

Changed March 31, 2014 04:20PM UTC by dmethvin comment:6

owner: rwaldrondmethvin

Changed April 30, 2014 03:04PM UTC by Dave Methvin comment:7

resolution: → fixed
status: assignedclosed

Data: Work around IE11 bug with onpageshow attribute

Fixes #14894

Changeset: b8133e282ceebf502c7c08d849b176a929c9c450