-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Inconsistent behaviour on IE8 #4029
Comments
A corresponding plunker: http://plnkr.co/edit/Dy7FgW?p=preview Works in Chrome, for example, but (when downloaded and served by local http) fails in IE 8 with "unknown runtime errorundefined". |
The error is being thrown at this point: https://github.com/angular/angular.js/blob/master/src/jqLite.js#L523 |
It is difficult to fix this bug in any realistic way. The easiest workaround is only to do this sort of thing on a DIV, since IE8 seems happier about DIVs. |
I'm not 100% sure that's the problem, because in this example the |
P.S. Can I ask how you tracked down the error, because I couldn't seem to get any useful info out of the IE8 Developer Tools, and I was frustrated not to be able to at least get a stack trace? |
I can confirm that switching the initial element to a |
Finally figured out how to debug these issues. Indeed, the error is actually due to a different (but related) cause: it happens when attributes are copied from the old element to the new element, in mergeTemplateAttributes. At the point this fails, the code is attempting to set the In this specific example, the I'd naively hope that a workaround may be possible in this case... |
A simple workaround would be to avoid splicing identical attribute values together with a space: concatenation with spaces likely makes sense only in the case of |
Here's the simple workaround, with a test: https://github.com/purcell/angular.js/compare/merge-identical-attributes And then the more rigorous alternative, which is to explicitly prefer the source HTML attributes over those in the the replacement element unless the attributes are https://github.com/purcell/angular.js/compare/give-priority-to-original-attributes |
This avoids issues with IE 8, where certain attributes cannot be set on in-document elements, e.g. 'type' on <input> See angular#4029
In fact even that isn't sufficient: the The full minimal workaround, then, is the following: https://github.com/purcell/angular.js/compare/avoid-setting-unchanged-attrs |
Basically, it sounds as though we need a sufficient work around for IE8. Getting/Setting as classes instead of as actual DOM attributes. |
@thebigredgeek Not exactly sure what you mean. The workaround I posted above (ie. f919241 + 6d6554f) is working nicely for me, though: without this, it's not even possible to replace an |
Merging an <input> with an <input> in IE8 will automatically break because the "type" attribute may not be set automatically on in-document elements. This change makes Angular replace only unchanged attributes. Additionally, source and target attributes are only merged by concatenation if their values differ, to avoid unexpected results such as 'type="text text"'. Closes angular#4029
@purcell "Finally figured out how to debug these issues." |
@guillaume86 IIRC I had to run it under the debugger and set it to break on errors, but I might be remembering completely wrong. Re. this particular issue, I've long since abandoned Angular, and I believe Angular has dropped IE8 support, so I imagine this can be closed. |
@purcell Yes I have to stay on 1.2.x for that reason (last with IE8 support). Note to future self or anyone having the problem: |
This issue is specific to IE8 that only has support in the 1.2.x branch, but this branch is open only for regressions and security issues. Closing this |
I'm not sure if this is a supported case, but I can use a directive to merge attributes into a DOM element, so given
and
I'll get this in the DOM:
This is handy because the directive can "plug in" the ng-model and ng-change directives on my behalf.
However, in IE8 I get an unhelpful error: "This command is not supported.undefined". Sigh.
Am I doing something stupid (most likely), or is this a bug?
(This is all with Angular 1.2.0-rc.2.)
The text was updated successfully, but these errors were encountered: