mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-31 11:54:03 -05:00
Check for null parent in getPath
This commit is contained in:
parent
923a0efd1a
commit
3ff9a46ea9
3 changed files with 9 additions and 13 deletions
|
@ -263,12 +263,10 @@ function isOrContains ( parent, node ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPath ( node, root ) {
|
function getPath ( node, root ) {
|
||||||
var parent = node.parentNode,
|
var path = '';
|
||||||
path, id, className, classNames, dir;
|
var id, className, classNames, dir;
|
||||||
if ( node === root ) {
|
if ( node && node !== root ) {
|
||||||
path = '';
|
path = getPath( node.parentNode, root );
|
||||||
} else {
|
|
||||||
path = getPath( parent, root );
|
|
||||||
if ( node.nodeType === ELEMENT_NODE ) {
|
if ( node.nodeType === ELEMENT_NODE ) {
|
||||||
path += ( path ? '>' : '' ) + node.nodeName;
|
path += ( path ? '>' : '' ) + node.nodeName;
|
||||||
if ( id = node.id ) {
|
if ( id = node.id ) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -92,12 +92,10 @@ function isOrContains ( parent, node ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPath ( node, root ) {
|
function getPath ( node, root ) {
|
||||||
var parent = node.parentNode,
|
var path = '';
|
||||||
path, id, className, classNames, dir;
|
var id, className, classNames, dir;
|
||||||
if ( node === root ) {
|
if ( node && node !== root ) {
|
||||||
path = '';
|
path = getPath( node.parentNode, root );
|
||||||
} else {
|
|
||||||
path = getPath( parent, root );
|
|
||||||
if ( node.nodeType === ELEMENT_NODE ) {
|
if ( node.nodeType === ELEMENT_NODE ) {
|
||||||
path += ( path ? '>' : '' ) + node.nodeName;
|
path += ( path ? '>' : '' ) + node.nodeName;
|
||||||
if ( id = node.id ) {
|
if ( id = node.id ) {
|
||||||
|
|
Loading…
Reference in a new issue