-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Conversation
next() is supposed to return the next sibling element and it should ignore text nodes. To achieve this, nextElementSibling() should be used instead of nextSibling().
Much better! Did you say you signed the CLA? |
@petebacondarwin Yes, I signed it. |
@Keyamoon Great! Unfortunately I.E. 8 doesn't like your unit test! http://ci.angularjs.org/job/angular.js-pete/21/testReport/ If you can fix one you can probably fix both! Good luck. |
@petebacondarwin My implementation of next() uses |
nextElementSibling is not supported in IE8 but nextSibling is. To make next() work in IE8, we can check the nodeType to see whether it's a DOM element or not. If it's not an element, we will move to the next sibling node using nextSibling.
Great this passes the CI: http://ci.angularjs.org/job/angular.js-pete/22/console |
Added it to the Triaged Milestone and will ping core devs to get it merged. |
@petebacondarwin Thank you 👍 |
LGTM. I made a few small changes and squashed the commits into a single commit. waiting for the CI server to verify the changes on all browsers |
merged! |
next() must return the next sibling element and it should ignore text nodes between elements. In the sample element that was prepared for testing, there was no text or space between the two elements (
<b>b</b>
and<i>i</i>
) to check if next() was ignoring text nodes properly.To get the next sibling element,
nextElementSibling
must be used instead ofnextSibling
becausenextSibling
doesn't ignore text nodes.