diff options
Diffstat (limited to 'src/selector/testContext.js')
-rw-r--r-- | src/selector/testContext.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/selector/testContext.js b/src/selector/testContext.js new file mode 100644 index 000000000..a54351e64 --- /dev/null +++ b/src/selector/testContext.js @@ -0,0 +1,10 @@ +/** + * Checks a node for validity as a jQuery selector context + * @param {Element|Object=} context + * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value + */ +function testContext( context ) { + return context && typeof context.getElementsByTagName !== "undefined" && context; +} + +export default testContext; |