From 692afbcc5f719392c729997eacb234c07d2a6c78 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Sun, 3 Mar 2013 19:40:33 -0500 Subject: Fixes #13551. Guard against illegal data access by undefined elem-owner Signed-off-by: Rick Waldron --- test/unit/data.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/unit/data.js') diff --git a/test/unit/data.js b/test/unit/data.js index d6f979984..72e55e15e 100644 --- a/test/unit/data.js +++ b/test/unit/data.js @@ -670,3 +670,14 @@ test( "JSON data- attributes can have newlines", function() { equal( x.data("some").foo, "bar", "got a JSON data- attribute with spaces" ); x.remove(); }); + +test(".data doesn't throw when calling selection is empty. #13551", function() { + expect(1); + + try { + jQuery( null ).data( "prop" ); + ok( true, "jQuery(null).data('prop') does not throw" ); + } catch ( e ) { + ok( false, e.message ); + } +}); -- cgit v1.2.3