Ticket #10429 (closed bug: fixed)
IE7 - invalid procedure call or argument when calling removeAttr('contenteditable');
| Reported by: | brian@… | Owned by: | timmywil |
|---|---|---|---|
| Priority: | blocker | Milestone: | 1.7 |
| Component: | attributes | Version: | 1.6.4 |
| Keywords: | removeAttr | Cc: | |
| Blocking: | Blocked by: |
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
comment:1 Changed 20 months ago by rwaldron
- Owner set to brian@…
- Priority changed from undecided to low
- Status changed from new to pending
- Component changed from unfiled to attributes
comment:2 Changed 20 months ago by brian@…
- Status changed from pending to new
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 20 months ago by timmywil
- Keywords removeAttr added
- Owner changed from brian@… to timmywil
- Priority changed from low to blocker
- Status changed from new to assigned
- Milestone changed from None to 1.7
Yep, that shouldn't be throwing an error.
comment:4 Changed 20 months ago by timmywil
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 20 months ago by timmywil
- Status changed from assigned to closed
- Resolution set to fixed
Add a hook for removing contenteditable in IE6/7 and remove the unnecessary jQuery.attrFix. Fixes #10429.
Changeset: ce8d9c0ca59a8f03e119c80ed29c7dbc65efdd85
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

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