diff options
author | Rick Waldron <waldron.rick@gmail.com> | 2013-03-03 19:40:33 -0500 |
---|---|---|
committer | Rick Waldron <waldron.rick@gmail.com> | 2013-03-03 19:40:33 -0500 |
commit | 692afbcc5f719392c729997eacb234c07d2a6c78 (patch) | |
tree | fe06fe3e0fe6b75a06097d3007446701300272b4 /src | |
parent | 91824bd2923b99b03fd1a9c4447b46fd7cc96615 (diff) | |
download | jquery-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 'src')
-rw-r--r-- | src/data.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/data.js b/src/data.js index 63796c5ba..dfd8555a0 100644 --- a/src/data.js +++ b/src/data.js @@ -85,7 +85,7 @@ Data.prototype = { // Either a valid cache is found, or will be created. // New caches will be created and the unlock returned, // allowing direct access to the newly created - // empty data object. + // empty data object. A valid owner object must be provided. var cache = this.cache[ this.key( owner ) ]; return key === undefined ? @@ -255,9 +255,12 @@ jQuery.fn.extend({ var data, camelKey = jQuery.camelCase( key ); - // Get the Data... - if ( value === undefined ) { - + // The calling jQuery object (element matches) is not empty + // (and therefore has an element appears at this[0]) and the + // `value` parameter was not undefined. An empty jQuery object + // will result in `undefined` for elem = this[0] which will + // throw an exception if an attempt to read a data cache is made. + if ( elem && value === undefined ) { // Attempt to get data from the cache // with the key as-is data = data_user.get( elem, key ); |