From 0c1b4376d36d9495b1e025a8fb4d43496c8c1b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Wed, 27 Jan 2016 21:17:29 +0100 Subject: [PATCH] Core: Fix issue with RegExp detection if object is from another context. --- src/item/Item.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/item/Item.js b/src/item/Item.js index adeced69..3b146b69 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -1916,12 +1916,14 @@ new function() { // // Scope to inject various item event handlers // Compare further with the _class property value instead. value = this._class; } - if (compare instanceof RegExp) { - return compare.test(value); - } else if (typeof compare === 'function') { + if (typeof compare === 'function') { return !!compare(value); - } else if (Base.isPlainObject(compare)) { - return matchObject(compare, value); + } else if (compare) { + if (compare.test) { // RegExp-ish + return compare.test(value); + } else if (Base.isPlainObject(compare)) { + return matchObject(compare, value); + } } return Base.equals(value, compare); }