Skip to main content

Bug Tracker

Side navigation

#7946 closed bug (duplicate)

Opened January 11, 2011 03:44PM UTC

Closed March 25, 2011 06:06PM UTC

Last modified March 10, 2012 08:37AM UTC

JS error in IE8, when jQuery.each is used on document.styleSheets

Reported by: anonymous Owned by: dmethvin
Priority: high Milestone: 1.6
Component: core Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:
Description

When trying the HTML sample below, IE8 throws an "Error: Invalid procedure call or argument". This happens because a nonexistent entry is accessed on the styleSheets collection.

<html>

<head>

<style>

</style>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>

<script>

$.each(document.styleSheets, function(i) {

alert(i);

});

</script>

</head>

</html>

Attachments (0)
Change History (5)

Changed January 13, 2011 10:13AM UTC by anonymous comment:1

jsFiddle sample URL: http://jsfiddle.net/GgrSV/

Changed January 17, 2011 07:28PM UTC by rwaldron comment:2

component: unfiledcore
keywords: → needsreview
priority: undecidedhigh
status: newopen

Confirmed.

Marked as high, but needs closer review

Changed March 25, 2011 05:45PM UTC by dmethvin comment:3

keywords: needsreview
milestone: 1.next1.6
owner: → dmethvin
status: openassigned

Looks like the attempt to reference object[ ++i ] when i is out of bounds is causing an exception in IE. The fix looks pretty simple though.

Changed March 25, 2011 06:06PM UTC by dmethvin comment:4

resolution: → duplicate
status: assignedclosed

Changed March 25, 2011 06:06PM UTC by dmethvin comment:5

Duplicate of #4366.