From 91b2ffdf49ee441eb7cd56beb0740d375e13fbe1 Mon Sep 17 00:00:00 2001 From: jlukic Date: Mon, 2 Mar 2015 11:35:39 -0500 Subject: [PATCH] #1896, add 'get id' to all modules with element namespace, move uniqueID generation to 'create id' --- src/definitions/modules/dropdown.js | 10 +++++----- src/definitions/modules/modal.js | 6 +++--- src/definitions/modules/popup.js | 4 ++-- src/definitions/modules/sidebar.js | 7 ++----- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index 7a2500fdb..0c81df0ce 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -141,9 +141,9 @@ $.fn.dropdown = function(parameters) { create: { id: function() { - module.verbose('Creating unique id for element'); - id = module.get.uniqueID(); + id = (Math.random().toString(16) + '000000000').substr(2,8); elementNamespace = '.' + id; + module.verbose('Creating unique id for element', id); } }, @@ -823,6 +823,9 @@ $.fn.dropdown = function(parameters) { }, get: { + id: function() { + return id; + }, text: function() { return $text.text(); }, @@ -970,9 +973,6 @@ $.fn.dropdown = function(parameters) { value = module.get.text(); } return $selectedItem || false; - }, - uniqueID: function() { - return (Math.random().toString(16) + '000000000').substr(2,8); } }, diff --git a/src/definitions/modules/modal.js b/src/definitions/modules/modal.js index 0ec6183a2..d88fb69d6 100644 --- a/src/definitions/modules/modal.js +++ b/src/definitions/modules/modal.js @@ -120,9 +120,9 @@ $.fn.modal = function(parameters) { $dimmer = $dimmable.dimmer('get dimmer'); }, id: function() { - module.verbose('Creating unique id for element'); - id = module.get.uniqueID(); + id = (Math.random().toString(16) + '000000000').substr(2,8); elementNamespace = '.' + id; + module.verbose('Creating unique id for element', id); } }, @@ -192,7 +192,7 @@ $.fn.modal = function(parameters) { }, get: { - uniqueID: function() { + id: function() { return (Math.random().toString(16) + '000000000').substr(2,8); } }, diff --git a/src/definitions/modules/popup.js b/src/definitions/modules/popup.js index ef48110c5..00cee59ce 100644 --- a/src/definitions/modules/popup.js +++ b/src/definitions/modules/popup.js @@ -246,9 +246,9 @@ $.fn.popup = function(parameters) { }, createID: function() { - module.verbose('Creating unique id for element'); - id = module.get.uniqueID(); + id = (Math.random().toString(16) + '000000000').substr(2,8); elementNamespace = '.' + id; + module.verbose('Creating unique id for element', id); }, // determines popup state diff --git a/src/definitions/modules/sidebar.js b/src/definitions/modules/sidebar.js index 9b049d49e..3002cb636 100644 --- a/src/definitions/modules/sidebar.js +++ b/src/definitions/modules/sidebar.js @@ -114,8 +114,8 @@ $.fn.sidebar = function(parameters) { create: { id: function() { - module.verbose('Creating unique id for element'); - id = module.get.uniqueID(); + id = (Math.random().toString(16) + '000000000').substr(2,8); + module.verbose('Creating unique id for element', id); elementNamespace = '.' + id; } }, @@ -730,9 +730,6 @@ $.fn.sidebar = function(parameters) { return transitions[transition]; } } - }, - uniqueID: function() { - return (Math.random().toString(16) + '000000000').substr(2,8); } },