[FIX] web_editor: editor hang on an infinite loop

In the `getMatchedCSSRule`, the transcoder try to find the real value of
a `text-align: inherit` css rule by ascending the html tree until it
finds a `text-align` with a meaningful value. By default is exits if it
reachs the `<html>` top node but doesn't exit if a call to `.parent()`
exits the dom (the behavior of jquery is to return a dummy element when
calling `.parent()` on an element that has no parent). This lead to an
infinite loop for badly formatted html content.

opw-1951095

closes odoo/odoo#32014

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
This commit is contained in:
Julien Castiaux
2019-03-21 13:45:12 +00:00
parent 78d351aa4d
commit e9026bd522
@@ -174,7 +174,7 @@ function getMatchedCSSRules(a) {
break;
}
$el = $el.parent();
} while (!$el.is('html'));
} while ($el.length && !$el.is('html'));
}
return style;