mirror of
https://github.com/fastmail/Squire.git
synced 2025-02-22 14:56:23 -05:00
Fix getFontInfo iteration up tree
This commit is contained in:
parent
3afa14bf40
commit
e133f26db1
3 changed files with 41 additions and 37 deletions
|
@ -2974,7 +2974,8 @@ proto.getFontInfo = function ( range ) {
|
|||
if ( element.nodeType === TEXT_NODE ) {
|
||||
element = element.parentNode;
|
||||
}
|
||||
while ( seenAttributes < 4 && element && ( style = element.style ) ) {
|
||||
while ( seenAttributes < 4 && element ) {
|
||||
if ( style = element.style ) {
|
||||
if ( !fontInfo.color && ( attr = style.color ) ) {
|
||||
fontInfo.color = attr;
|
||||
seenAttributes += 1;
|
||||
|
@ -2992,11 +2993,12 @@ proto.getFontInfo = function ( range ) {
|
|||
fontInfo.size = attr;
|
||||
seenAttributes += 1;
|
||||
}
|
||||
}
|
||||
element = element.parentNode;
|
||||
}
|
||||
}
|
||||
return fontInfo;
|
||||
};
|
||||
};
|
||||
|
||||
proto._addFormat = function ( tag, attributes, range ) {
|
||||
// If the range is collapsed we simply insert the node by wrapping
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -794,7 +794,8 @@ proto.getFontInfo = function ( range ) {
|
|||
if ( element.nodeType === TEXT_NODE ) {
|
||||
element = element.parentNode;
|
||||
}
|
||||
while ( seenAttributes < 4 && element && ( style = element.style ) ) {
|
||||
while ( seenAttributes < 4 && element ) {
|
||||
if ( style = element.style ) {
|
||||
if ( !fontInfo.color && ( attr = style.color ) ) {
|
||||
fontInfo.color = attr;
|
||||
seenAttributes += 1;
|
||||
|
@ -812,11 +813,12 @@ proto.getFontInfo = function ( range ) {
|
|||
fontInfo.size = attr;
|
||||
seenAttributes += 1;
|
||||
}
|
||||
}
|
||||
element = element.parentNode;
|
||||
}
|
||||
}
|
||||
return fontInfo;
|
||||
};
|
||||
};
|
||||
|
||||
proto._addFormat = function ( tag, attributes, range ) {
|
||||
// If the range is collapsed we simply insert the node by wrapping
|
||||
|
|
Loading…
Add table
Reference in a new issue