-
Notifications
You must be signed in to change notification settings - Fork 27.5k
ng-disabled doesn't remove "disabled" attribute when jquery is loaded #16778
Comments
This is a jQuery issue. You should use jQuery 3.x with AngularJS 1.7.x anyway, and this is fixed with the latest jQuery. |
Bullshit. It is not fixed with the latest jquery. Please check what is included in my example - the latest version of both:
|
Also tried with jqueries latest git version and it is the exact same problem |
And it only seems to be a problem for XHTML and not HTML |
Oh interesting. The demo (which was using 2.x when I checked) didn't work for me, so I created my own demo to check and I missed the XHTML requirement. Indeed, it doesn't work as expected on XHTML. This is because jQuery detects it as an XML document and handles it differently (i.e. just sets the attribute value to true/false, even for boolean attributes). @mgol or @jbedard might know more about this jQuery behavior. In any case, I'm afraid there is not much we can do. It either looks like a jQuery issues/limitiation or (if it boils down to AngularJS incorrectly using the jQuery APIs on XHTML documents) it is a limitation in AngularJS we will not be addressed at this point, as we are already months deep into LTS mode. |
I was probably debugging this the same time as you :p I came to the same conclusion. I don't know the history behind this though. I thought the XHTML vs html(5 only?) difference was |
See my analysis at jquery/jquery#4249 (comment). tl;dr is jQuery skips special boolean attrs treatment in XML nodes for historical reasons. I think AngularJS could call |
…h jQuery jQuery skips special boolean attrs treatment in XML nodes for historical reasons and hence AngularJS cannot freely call `.attr(attrName, false) with such attributes. To avoid issues in XHTML, call `removeAttr` in such cases instead. Ref jquery/jquery#4249 Fixes angular#16778
Since we're planning a release soon this may make it as well, let's reopen. |
PR: #16779 |
…h jQuery jQuery skips special boolean attrs treatment in XML nodes for historical reasons and hence AngularJS cannot freely call `.attr(attrName, false) with such attributes. To avoid issues in XHTML, call `removeAttr` in such cases instead. Ref jquery/jquery#4249 Fixes angular#16778
jQuery skips special boolean attrs treatment in XML nodes for historical reasons and hence AngularJS cannot freely call `.attr(attrName, false) with such attributes. To avoid issues in XHTML, call `removeAttr` in such cases instead. Ref jquery/jquery#4249 Fixes angular#16778
jQuery skips special boolean attrs treatment in XML nodes for historical reasons and hence AngularJS cannot freely call `.attr(attrName, false) with such attributes. To avoid issues in XHTML, call `removeAttr` in such cases instead. Ref jquery/jquery#4249 Fixes angular#16778
jQuery skips special boolean attrs treatment in XML nodes for historical reasons and hence AngularJS cannot freely call `.attr(attrName, false) with such attributes. To avoid issues in XHTML, call `removeAttr` in such cases instead. Ref jquery/jquery#4249 Fixes #16778 Closes #16779
jQuery skips special boolean attrs treatment in XML nodes for historical reasons and hence AngularJS cannot freely call `.attr(attrName, false) with such attributes. To avoid issues in XHTML, call `removeAttr` in such cases instead. Ref jquery/jquery#4249 Fixes #16778 Closes #16779
I'm submitting a ...
Current behavior:
ng-disable creates disabled="false"/ng-disabled="true" attributes for elements when jquery was loaded before angularjs.
Expected / new behavior:
disabled attribute is removed when ng-disabled evaluates to false
Minimal reproduction of the problem with instructions:
http://next.plnkr.co/edit/1GxYGSKho4H0nDAD
(tested in chromium)
AngularJS version: 1.7.5 (or whatever your server currently ships)
Browser: all? (tested in chrome 70.0.3538.110 | Firefox 60.3.0esr)
The text was updated successfully, but these errors were encountered: