0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2025-02-23 07:15:50 -05:00

Fix getFontInfo iteration up tree

This commit is contained in:
Neil Jenkins 2016-03-18 18:55:21 +11:00
parent 3afa14bf40
commit e133f26db1
3 changed files with 41 additions and 37 deletions

View file

@ -2974,7 +2974,8 @@ proto.getFontInfo = function ( range ) {
if ( element.nodeType === TEXT_NODE ) { if ( element.nodeType === TEXT_NODE ) {
element = element.parentNode; element = element.parentNode;
} }
while ( seenAttributes < 4 && element && ( style = element.style ) ) { while ( seenAttributes < 4 && element ) {
if ( style = element.style ) {
if ( !fontInfo.color && ( attr = style.color ) ) { if ( !fontInfo.color && ( attr = style.color ) ) {
fontInfo.color = attr; fontInfo.color = attr;
seenAttributes += 1; seenAttributes += 1;
@ -2992,6 +2993,7 @@ proto.getFontInfo = function ( range ) {
fontInfo.size = attr; fontInfo.size = attr;
seenAttributes += 1; seenAttributes += 1;
} }
}
element = element.parentNode; element = element.parentNode;
} }
} }

File diff suppressed because one or more lines are too long

View file

@ -794,7 +794,8 @@ proto.getFontInfo = function ( range ) {
if ( element.nodeType === TEXT_NODE ) { if ( element.nodeType === TEXT_NODE ) {
element = element.parentNode; element = element.parentNode;
} }
while ( seenAttributes < 4 && element && ( style = element.style ) ) { while ( seenAttributes < 4 && element ) {
if ( style = element.style ) {
if ( !fontInfo.color && ( attr = style.color ) ) { if ( !fontInfo.color && ( attr = style.color ) ) {
fontInfo.color = attr; fontInfo.color = attr;
seenAttributes += 1; seenAttributes += 1;
@ -812,6 +813,7 @@ proto.getFontInfo = function ( range ) {
fontInfo.size = attr; fontInfo.size = attr;
seenAttributes += 1; seenAttributes += 1;
} }
}
element = element.parentNode; element = element.parentNode;
} }
} }