-
Notifications
You must be signed in to change notification settings - Fork 27.4k
parent
is null in JQLite code
#15331
Comments
There are many circumstances under which That said, jQuery seems to silently ignore a missing parent, so it might be a good idea to have the same behavior in jqLite. Thoughts, @mgol? |
I am somehow torn on this issue. On one side, not checking for the parent in |
This is the jQuery implementation: https://github.com/jquery/jquery/blob/3.1.1/src/manipulation.js#L365-L371: after: function() {
return domManip( this, arguments, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this.nextSibling );
}
} );
}, It's specifically guarded and documented:
jqLite should primarily align with jQuery where it doesn't introduce a lot of code so it seems a good idea to fix it. Generally, I think a good rule if you think some behavior is undesired in jqLite and that behavior is shared with jQuery is to report an issue to the jQuery bug tracker and make the change there first. |
Agree with @mgol that we should align with jQuery. That said, when the node On Mon, Oct 31, 2016 at 1:35 PM, Michał Gołębiowski <
|
If we decide to silently not-do-anything (as jQuery does), then we shouldn't log imo. |
I agree with @gkalpak. This seems a non-breaking feature to me so we can land it whenever we want. @adambuczynski would you like to try to create a patch? |
@mgol yes sure, will do |
Previously, the element was always assumed to have a parent and an error was thrown when that was not the case. This commit makes jqLite consistent with jQuery, which silently ignores a call on elements that do not have a parent. Fixes angular#15331
Previously, the element was always assumed to have a parent and an error was thrown when that was not the case. This commit makes jqLite consistent with jQuery, which silently ignores a call on elements that do not have a parent. Fixes angular#15331 Closes angular#15367
Previously, the element was always assumed to have a parent and an error was thrown when that was not the case. This commit makes jqLite consistent with jQuery, which silently ignores a call on elements that do not have a parent. Fixes angular#15331 Closes angular#15367 Closes angular#15475
Sentry is reporting an error in our app in Angular's source code for JQLite:
The line in question is https://github.com/angular/angular.js/blob/master/src/jqLite.js#L986
It appears under some circumstances
parent
can benull
, in which case this error pops up. It's probably a good idea to guard against unexpected values ofparent
so this error doesn't occur.This was seen happening on Angular 1.5.8, on Firefox v26 on Windows XP.
The text was updated successfully, but these errors were encountered: