Skip to main content

Bug Tracker

Side navigation

#10429 closed bug (fixed)

Opened October 05, 2011 06:31PM UTC

Closed October 06, 2011 09:18PM UTC

Last modified March 09, 2012 12:14AM UTC

IE7 - invalid procedure call or argument when calling removeAttr('contenteditable');

Reported by: brian@brianjohn.com Owned by: timmywil
Priority: blocker Milestone: 1.7
Component: attributes Version: 1.6.4
Keywords: removeAttr Cc:
Blocked by: Blocking:
Description

When calling .removeAttr('contenteditable') on a span I get a JS error in IE7 on line 2485 of jquery-1.6.4.js. The error says "Invalid procedure call or argument".

I tried to make a jsfiddle for this but jsfiddle appears to be broken in IE7.

Attachments (0)
Change History (5)

Changed October 05, 2011 06:53PM UTC by rwaldron comment:1

component: unfiledattributes
owner: → brian@brianjohn.com
priority: undecidedlow
status: newpending

Make a fiddle in another browser, where the error doesn't occur and we can run it in IE7

Changed October 06, 2011 12:58AM UTC by brian@brianjohn.com comment:2

status: pendingnew

Sure here you go:

http://jsfiddle.net/f1sherman/5XVX3/3/

Unfortunately I couldn't test it because I get a JS error when I try to load the page in IE7.

Changed October 06, 2011 01:51PM UTC by timmywil comment:3

keywords: → removeAttr
milestone: None1.7
owner: brian@brianjohn.comtimmywil
priority: lowblocker
status: newassigned

Yep, that shouldn't be throwing an error.

Changed October 06, 2011 05:42PM UTC by timmywil comment:4

In the meantime, set contenteditable to 'false' instead. Since contenteditable is an enumerated attribute, removing it and setting it to 'false' has the same effect.

$(elem).attr('contenteditable', 'false');

Internally, we set attributes to empty string before removal, but IE balks and throws an error because empty string is not a "valid value" for contenteditable (even though it actually is, ironically). Both removeAttribute and removeAttributeNode have no effect on contenteditable in IE6/7, so in order to kill the behavior of contenteditable, it HAS to be set to 'false'. We can provide an attrHook that does this in 1.7, but if removeAttr is used to remove contenteditable and then one tries to get contenteditable, he or she will get undefined in all browsers where contenteditable was actually removed and 'false' in IE6/7 (which is really unavoidable). Either way, I recommend using the other values "true", "false", or "inherit".

Changed October 06, 2011 09:18PM UTC by timmywil comment:5

resolution: → fixed
status: assignedclosed

Add a hook for removing contenteditable in IE6/7 and remove the unnecessary jQuery.attrFix. Fixes #10429.

Changeset: ce8d9c0ca59a8f03e119c80ed29c7dbc65efdd85