File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -345,12 +345,12 @@ describe('Parser', function () {
345345 } )
346346 } )
347347
348- describe ( 'latestChild ()' , function ( ) {
348+ describe ( 'lastChild ()' , function ( ) {
349349
350350 it ( 'returns the deepest last child' , function ( ) {
351351 const source = linkWithSpan
352352 const target = document . createTextNode ( 'bar' )
353- expect ( parser . latestChild ( source ) . isEqualNode ( target ) ) . toEqual ( true )
353+ expect ( parser . lastChild ( source ) . isEqualNode ( target ) ) . toEqual ( true )
354354 } )
355355 } )
356356
Original file line number Diff line number Diff line change @@ -301,7 +301,7 @@ export default class Cursor {
301301
302302 // Move the cursor after the last visible character of the host.
303303 moveAtTextEnd ( element ) {
304- return this . moveAtEnd ( parser . latestChild ( element ) )
304+ return this . moveAtEnd ( parser . lastChild ( element ) )
305305 }
306306
307307 setHost ( element ) {
Original file line number Diff line number Diff line change @@ -193,16 +193,24 @@ export function isSameNode (target, source) {
193193/**
194194 * Return the deepest last child of a node.
195195 *
196- * @method latestChild
196+ * @method lastChild
197197 * @param {HTMLElement } container The container to iterate on.
198198 * @return {HTMLElement } The deepest last child in the container.
199199 */
200- export function latestChild ( container ) {
200+ export function lastChild ( container ) {
201201 return container . lastChild
202- ? latestChild ( container . lastChild )
202+ ? lastChild ( container . lastChild )
203203 : container
204204}
205205
206+ /**
207+ * Obsolete version of {{#crossLink "lastChild"}}{{/crossLink}}.
208+ */
209+ export function latestChild ( container ) {
210+ console . warn ( "Editable.js: Using obsolete function parser.latestCild(), use lastChild() instead" )
211+ return lastChild ( container )
212+ }
213+
206214/**
207215 * Checks if a documentFragment has no children.
208216 * Fragments without children can cause errors if inserted into ranges.
You can’t perform that action at this time.
0 commit comments