-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(jqLite): Adding more support for custom element tagnames #10619
Conversation
Before this change, jqLite would allow you to create elements such as "my-foo" and "div-foo" but would not allow you to create certain elements such as "tr-foo" and "td-foo". This is incorrect as well as undocumented and unexpected.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA) at https://cla.developers.google.com/. If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check the information on your CLA or see this help article on setting the email on your git commits. Once you've done that, please reply here to let us know. If you signed the CLA as a corporation, please let us know the company's name. |
This bug also exists in jQuery and I hope to find some time soon to send a patch their way as well. |
Same fix as #10618. |
Wow, both pull requests were created at almost the same time! What would you like me to do with this pull request? I can close it if you like. |
I like the fact that there are tests for more elements (it shouldn't make any actual difference, but feels better 😃). nodes = jqLite('<x>y<x/>');
expect(nodes.length).toBe(1);
expect(nodeName_(nodes)).toBe('x');
expect(nodes.html()).toBe('y'); It would also be nice to have similar tests for If you can add these test, I would close my PR in favor of this one 😛 |
Perfect. Give me a day or two.
|
The bug has been fixed on the jQuery side (thx @LeonardoBraga), but it seems that the fix will be released in version 3.0 (which according to the roadmap is planned for Q1 2015). Not sure if/when Angular 1.x will make the switch to jQuery 3.x.
|
We should fix this at jqLite (using the same pattern that was used in jQuery) and have tests that only run with jqLite. Do please add a comment in the test pointing to jQuery issue and the fact that this will work as expected in jQuery 3.0 |
What needs to be done:
@richardaday: Would you like to take care of these in this PR ? |
this has been on hold for a while --- do we want this? Since it won't do anything to help people using jQuery, I'm not sure. Really don't want to monkey patch jQuery again |
@LeonardoBraga the downside I see is that it will mean an inconsistency between jqLite and the jQuery version used by most applications, I'm not super keen on that. But I'm undecided, I think @petebacondarwin should make the call on this. |
that said, by all means send a PR, since this one has not been updated since January |
Bumping this to 1.5 as it is not a regression and we need to think about it a little. @mzgol do you have a view on this? |
IMO it's not bad that it creates inconsistency with jQuery as it's just fixing a bug. jQuery has fixed this bug as well and it will be included in 3.0.0 when it's released. I don't see it blocking that if Angular is used with jQuery 2.1.1 this bug will appear; we can say it's a jQuery bug and you have to either use jqLite or upgrade to jQuery 3.0.0 or later to have it working. Review comments still need to be addressed, though, like the @gkalpak's one: #10619 (comment). I'd just omit the relevant tests in jQuery <3.0.0 and not all jQueries. If the PR is ready before the final 1.4 release then we can land it IMO. |
@LeonardoBraga, do you plan to submit a PR for this ? |
@mzgol, what is the best option for verifying the jQuery version used in tests ? |
If you just want to check if it's 3.0.0 or newer, the easiest would be to: if (window.jQuery && Number(window.jQuery.fn.jquery.split('.')[0]) >= 3) { /* code */ } as If we wanted more fine-grained version comparisons (the above code is ugly and doesn't scale behind major checks), it'd be best to use the semver module: if (window.jQuery && semver.satisfies(window.jQuery.fn.jquery, '>=3.0.0')) { /* code */ } I know @IgorMinar has been recently trying to reduce used dependencies instead of adding new ones, though. :-) EDIT: we already have |
Ckecking for 3.0.0 or newer would suffice, so the former approach is fine. Thx ! |
Closing in favor of #12759 (due to inactivity). |
Before this change, jqLite would allow you to create elements such as
"my-foo" and "div-foo" but would not allow you to create certain
elements such as "tr-foo" and "td-foo". This is incorrect as well as
undocumented and unexpected.