0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 07:13:08 -05:00

Check for null parent in getPath

This commit is contained in:
Neil Jenkins 2016-03-26 11:32:59 +11:00
parent 923a0efd1a
commit 3ff9a46ea9
3 changed files with 9 additions and 13 deletions

View file

@ -263,12 +263,10 @@ function isOrContains ( parent, node ) {
}
function getPath ( node, root ) {
var parent = node.parentNode,
path, id, className, classNames, dir;
if ( node === root ) {
path = '';
} else {
path = getPath( parent, root );
var path = '';
var id, className, classNames, dir;
if ( node && node !== root ) {
path = getPath( node.parentNode, root );
if ( node.nodeType === ELEMENT_NODE ) {
path += ( path ? '>' : '' ) + node.nodeName;
if ( id = node.id ) {

File diff suppressed because one or more lines are too long

View file

@ -92,12 +92,10 @@ function isOrContains ( parent, node ) {
}
function getPath ( node, root ) {
var parent = node.parentNode,
path, id, className, classNames, dir;
if ( node === root ) {
path = '';
} else {
path = getPath( parent, root );
var path = '';
var id, className, classNames, dir;
if ( node && node !== root ) {
path = getPath( node.parentNode, root );
if ( node.nodeType === ELEMENT_NODE ) {
path += ( path ? '>' : '' ) + node.nodeName;
if ( id = node.id ) {