This test makes sure the closest() API works correctly

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS theTarget.closest("#theTarget") is theTarget
PASS theTarget.closest("ancestor") is ancestor
PASS theTarget.closest("tribe ancestor") is ancestor
PASS theTarget.closest("tribe > ancestor") is ancestor
PASS theTarget.closest("realm + ancestor") is ancestor
PASS theTarget.closest("realm ~ ancestor") is ancestor
PASS theTarget.closest("tribe, ancestor") is ancestor
PASS theTarget.closest("ancestor, tribe") is ancestor
PASS theTarget.closest("tribe realm") is null
PASS theTarget.closest("tribe realm throne") is null
PASS theTarget.closest("tribe realm ancestor") is null
PASS theTarget.closest("realm > ancestor") is null
PASS theTarget.closest("throne + ancestor") is null
PASS theTarget.closest("throne ~ ancestor") is null
PASS theTarget.closest(".classic") is ancestor
FAIL theTarget.closest("john") should be [object HTMLUnknownElement]. Was null.
PASS theTarget.closest("doe") is null
PASS theTarget.closest("ancestor[name=old]") is ancestor
PASS theTarget.closest("ancestor[name=young]") is null
PASS theTarget.closest(null) is null
PASS theTarget.closest(undefined) is null
PASS sour.closest("lemon") is sour
PASS sour.closest("a, b, c, d, e, f, g, h, i") is i
PASS sour.closest("a, b, c, d, e, f, g, h") is h
PASS sour.closest("a, b, c, d, e, f, g") is g
PASS sour.closest("a, b, c, d, e, f") is f
PASS sour.closest("a, b, c, d, e") is e
PASS sour.closest("a, b, c") is c
PASS sour.closest("a, b") is b
PASS sour.closest("a") is a
PASS sour.closest("i, h, g, f, e, d, c, b, a") is i
PASS sour.closest("h, g, f, e, d, c, b, a") is h
PASS sour.closest("g, f, e, d, c, b, a") is g
PASS sour.closest("f, e, d, c, b, a") is f
PASS sour.closest("e, d, c, b, a") is e
PASS sour.closest("d, c, b, a") is d
PASS sour.closest("c, b, a") is c
PASS sour.closest("b, a") is b
PASS sour.closest("a") is a
PASS document.closest is undefined
PASS document.closest() threw exception TypeError: document.closest is not a function. (In 'document.closest()', 'document.closest' is undefined).
PASS theTarget.closest() threw exception TypeError: Not enough arguments.
PASS theTarget.closest("") threw exception Error: SyntaxError: DOM Exception 12.
PASS theTarget.closest(".123") threw exception Error: SyntaxError: DOM Exception 12.
PASS theTarget.closest("    ") threw exception Error: SyntaxError: DOM Exception 12.
PASS theTarget.closest(")") threw exception Error: SyntaxError: DOM Exception 12.
PASS theTarget.closest("(") threw exception Error: SyntaxError: DOM Exception 12.
PASS theTarget.closest("()") threw exception Error: SyntaxError: DOM Exception 12.
PASS theTarget.closest("^_^") threw exception Error: SyntaxError: DOM Exception 12.
PASS theTarget.closest("{") threw exception Error: SyntaxError: DOM Exception 12.
PASS theTarget.closest("}") threw exception Error: SyntaxError: DOM Exception 12.
PASS theTarget.closest("{}") threw exception Error: SyntaxError: DOM Exception 12.
PASS successfullyParsed is true

TEST COMPLETE

