#10429 closed bug (fixed)
IE7 - invalid procedure call or argument when calling removeAttr('contenteditable');
Reported by: | 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
Component: | unfiled → attributes |
---|---|
Owner: | set to [email protected]… |
Priority: | undecided → low |
Status: | new → pending |
comment:2 Changed 11 years ago by
Status: | pending → 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 11 years ago by
Keywords: | removeAttr added |
---|---|
Milestone: | None → 1.7 |
Owner: | changed from [email protected]… to Timmy Willison |
Priority: | low → blocker |
Status: | new → assigned |
Yep, that shouldn't be throwing an error.
comment:4 Changed 11 years ago by
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
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Add a hook for removing contenteditable in IE6/7 and remove the unnecessary jQuery.attrFix. Fixes #10429.
Changeset: ce8d9c0ca59a8f03e119c80ed29c7dbc65efdd85
Make a fiddle in another browser, where the error doesn't occur and we can run it in IE7