I do not know if this fully answers your question, but you can retrieve the classes as follows.
Example:
HTML
<div id="minhaDiv" class="classe1 classe2 classe3"></div>
JS
var classes = document.getElementById("minhaDiv").className.split(' ');
console.log(classes);
or
Jquery
var classes = $("#minhaDiv").attr("class").split(' ');
console.log(classes);
The variable will be populated with an Array containing all the classes that are set in the element.
Result (Console)
["class1", "class2", "class3"]
DEMO - Example
And if you support the element.classList browser, just do so that the backup will be the same.
Example 2:
JS
var classes = document.getElementById("minhaDiv").classList;
console.log(classes);
DEMO - Example 2