Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#10429 closed bug (fixed)

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

Reported by: [email protected] Owned by: Timmy Willison
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.

Change History (5)

comment:1 Changed 11 years ago by Rick Waldron

Component: unfiledattributes
Owner: set to [email protected]
Priority: undecidedlow
Status: newpending

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

comment:2 Changed 11 years ago by [email protected]

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.

comment:3 Changed 11 years ago by Timmy Willison

Keywords: removeAttr added
Milestone: None1.7
Owner: changed from [email protected] to Timmy Willison
Priority: lowblocker
Status: newassigned

Yep, that shouldn't be throwing an error.

comment:4 Changed 11 years ago by Timmy Willison

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".

comment:5 Changed 11 years ago by Timmy Willison

Resolution: fixed
Status: assignedclosed

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

Changeset: ce8d9c0ca59a8f03e119c80ed29c7dbc65efdd85

Note: See TracTickets for help on using tickets.