From b3c90a5494084278b38993b69e0d8e0982dde0e5 Mon Sep 17 00:00:00 2001 From: Vsevolod Shmyroff Date: Mon, 24 Oct 2016 17:24:27 +0300 Subject: [PATCH] fix identify --- common.blocks/identify/identify.vanilla.js | 12 ++++++++---- test/dist/fixtures/desktop.html | 12 ++++++------ test/dist/fixtures/touch.html | 10 +++++----- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/common.blocks/identify/identify.vanilla.js b/common.blocks/identify/identify.vanilla.js index dcc04735..3db39ea6 100644 --- a/common.blocks/identify/identify.vanilla.js +++ b/common.blocks/identify/identify.vanilla.js @@ -6,15 +6,19 @@ modules.define('identify', function(provide) { var counter = 0, expando = '__' + (+new Date), + global = this.global, get = function() { return 'uniq' + (++counter); }, identify = function(obj) { if((typeof obj === 'object' && obj !== null) || typeof obj === 'function') { - var key = 'uniqueID' in obj && obj !== document ? - 'uniqueID' : - expando; // Use when possible native uniqueID for elements in IE - + var key; + if('uniqueID' in obj) { + obj === global.document && (obj = obj.documentElement); + key = 'uniqueID'; + } else { + key = expando; + } return key in obj? obj[key] : obj[key] = get(); diff --git a/test/dist/fixtures/desktop.html b/test/dist/fixtures/desktop.html index a4a6ba87..d7956f29 100644 --- a/test/dist/fixtures/desktop.html +++ b/test/dist/fixtures/desktop.html @@ -27,10 +27,10 @@ - - + + @@ -38,19 +38,19 @@ - - - + + + - + diff --git a/test/dist/fixtures/touch.html b/test/dist/fixtures/touch.html index 47d5e8d0..d0cbda5f 100644 --- a/test/dist/fixtures/touch.html +++ b/test/dist/fixtures/touch.html @@ -25,24 +25,24 @@ }); }()); - + - + - + - - + +