New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AngularJS's ng-disabled doesn't remove "disabled" attribute when jquery is loaded #4249
Comments
Here's a jQuery only version: http://next.plnkr.co/edit/QlL18WpsOlkofGJ0 |
I don't need a jQuery only version. I am talking about a bug which breaks angularJS. |
@CharlemagneLasse A jQuery-only version is needed for us to confirm there's an issue lying on the jQuery side. An even simpler test case: https://next.plnkr.co/edit/MFIiCjoCv4k3sOPA The issue lies in https://github.com/jquery/jquery/blob/3.3.1/src/attributes/attr.js#L44 where XML nodes are explicitly excluded from @timmywil It's not clear to me from that old ticket description why it's more important in XML documents to be able to set boolean attribute values to any value than in regular HTML documents. Do you remember the reasons? From what I understand the original issue wanted to set those attrs on a custom node where they don't have special meaning. That could be achieved by changing boolean attrs logic to account for the Any change we do related to such old code will need to be treated as a breaking change and so will need to wait for 4.0. One related issue from the past: #2946. @jbedard I think AngularJS could be changed to invoke |
…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
We document that Here's the way I remember it. The |
This was 7 years ago so bear with me if I misremember some details. I'll attempt to explain. The boolean hook is there both for back-compat-lots of code still out there with
Not even the strings "true" and "false" are technically allowed.
The point is simply to write valid DOM despite common, predictable misuse of the API. An attribute in an XML document that happens to have the same name as a boolean attribute, such as The original bug wasn't really related to XML exactly, but it did make me think of this distinction when the user tried to access what looked like boolean attributes on a custom tag. As @mgol said, the The boolean setter hook remains in place to remove boolean attributes whenever someone tries to set As for what changes to make, I'm not sure. It's my understanding that boolean attributes also have no special meaning or behavior in a pure XML document (which is different than XML in HTML), even on tags that happen to be named |
…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
Sizzle has a PR that should address this. XHTML will follow the HTML path and all should work as expected, unless anything we haven't foreseen comes up, which sometimes happens. |
Sizzle PR: jquery/sizzle#436 |
I added this to the |
Fixes jquerygh-1756 Fixes jquerygh-4170 Fixes jquerygh-4249
I'm submitting a ...
Current behavior:
ng-disable creates disabled="false"/ng-disabled="true" attributes for elements when jquery was loaded before angularjs. This was observed only for XHTML
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 - should be the same behavior in any XHTML aware browser)
AngularJS version: 1.7.5 (or whatever your server currently ships)
Browser: all? (tested in chrome 70.0.3538.110 | Firefox 60.3.0esr)
This was already submitted to angularJS but they say it is the fault of jquery: angular/angular.js#16778
The text was updated successfully, but these errors were encountered: