Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#5910 closed defect (fixed)

dojo.isString(null) results in an exception

Reported by: guest Owned by: anonymous
Priority: high Milestone: 1.1
Component: Core Version: 1.0
Keywords: Cc:
Blocked By: Blocking:

Description

dojo.isString(null) can result in an exception in IE7.

This is most apparent on dojotoolkit.org. Loading up the website results in JS errors in IE. Debugging in Visual studio reveals that the following statement is problematic:

	return typeof it == "string" || it instanceof String; // Boolean

The Visual Studio reports "Object expected" when running "it instanceof String" when "it" is null and has typeof object.

The isArray function appears to already take this into account and performs the following:

	return it && it instanceof Array || typeof it == "array"; // Boolean

Attachments (1)

lang.js.patch (447 bytes) - added by guest 12 years ago.
[Patch][CLA - Matthew Knapp]

Download all attachments as: .zip

Change History (6)

comment:1 Changed 12 years ago by Adam Peller

Milestone: 1.1

comment:2 Changed 12 years ago by Adam Peller

most likely, dojo.isFunction suffers from the same bug

Changed 12 years ago by guest

Attachment: lang.js.patch added

[Patch][CLA - Matthew Knapp]

comment:3 Changed 12 years ago by alex

Resolution: fixed
Status: newclosed

(In [12551]) fix dojo.isString() for IE to correctly handle cases where "" is passed. Fixes #5910. !strict

comment:4 Changed 12 years ago by alex

(In [12552]) silly IE6... Fixes #5910. !strict

comment:5 Changed 12 years ago by alex

(In [12553]) updating isFunction w/ same error handling as isArray has for null being passed on IE. Refs #5910. !strict

Note: See TracTickets for help on using tickets.