misc: avoid some more errors with malformed properties vs match() that expects strings

This commit is contained in:
jean-emmanuel 2022-02-08 08:54:37 +01:00
parent 0cf8d1e42f
commit b0e9642af7
3 changed files with 7 additions and 6 deletions

View file

@ -167,12 +167,13 @@ class UiDragResize extends UiWidget {
updateRectangle() {
var widgets = this.widgets,
widget = widgets[0]
widget = widgets[0],
layout = String(widget.parent.getProp('layout'))
var handlesVisibility = [
widget.parent.getProp('layout') === 'default', // nw
widget.parent.getProp('layout').match(/horizontal|default/), // e
widget.parent.getProp('layout').match(/vertical|default/), // s
layout === 'default', // nw
layout.match(/horizontal|default/), // e
layout.match(/vertical|default/), // s
]
handlesVisibility.push(handlesVisibility[1] && handlesVisibility[2]) // se

View file

@ -278,7 +278,7 @@ class Menu extends MenuBase {
scrollY = 0,
stop = this.getProp('ignoreTabs') ? /root/ : /root|tab/
while (parent && parent.props && !parent.getProp('type').match(stop)) {
while (parent && parent.props && !String(parent.getProp('type')).match(stop)) {
parent.modalBreakout += (this.opened ? 1 : -1)
if (parent.modalBreakout > 0) parent.container.classList.add('modal-breakout')

View file

@ -179,7 +179,7 @@ class Modal extends Panel {
var parent = this.parent,
stop = this.getProp('ignoreTabs') ? /root/ : /root|tab/
while (parent && parent.props && !parent.getProp('type').match(stop)) {
while (parent && parent.props && !String(parent.getProp('type')).match(stop)) {
parent.modalBreakout += (this.value ? 1 : -1)
if (parent.modalBreakout > 0) parent.container.classList.add('modal-breakout')