aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRick Waldron <waldron.rick@gmail.com>2013-03-03 19:40:33 -0500
committerRick Waldron <waldron.rick@gmail.com>2013-03-03 19:40:33 -0500
commit692afbcc5f719392c729997eacb234c07d2a6c78 (patch)
treefe06fe3e0fe6b75a06097d3007446701300272b4 /test
parent91824bd2923b99b03fd1a9c4447b46fd7cc96615 (diff)
downloadjquery-692afbcc5f719392c729997eacb234c07d2a6c78.tar.gz
jquery-692afbcc5f719392c729997eacb234c07d2a6c78.zip
Fixes #13551. Guard against illegal data access by undefined elem-owner
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/unit/data.js11
1 files changed, 11 insertions, 0 deletions
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 );
+ }
+});