commit
ce88c8db40
|
@ -41,16 +41,23 @@ var componentHandler = (function() {
|
||||||
* will have.
|
* will have.
|
||||||
*/
|
*/
|
||||||
function upgradeDomInternal(jsClass, cssClass) {
|
function upgradeDomInternal(jsClass, cssClass) {
|
||||||
if (cssClass === undefined) {
|
if (jsClass === undefined && cssClass === undefined) {
|
||||||
var registeredClass = findRegisteredClass_(jsClass);
|
for (var i = 0; i < registeredComponents_.length; i++) {
|
||||||
if (registeredClass) {
|
upgradeDomInternal(registeredComponents_[i].className,
|
||||||
cssClass = registeredClass.cssClass;
|
registeredComponents_[i].cssClass);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (cssClass === undefined) {
|
||||||
|
var registeredClass = findRegisteredClass_(jsClass);
|
||||||
|
if (registeredClass) {
|
||||||
|
cssClass = registeredClass.cssClass;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var elements = document.querySelectorAll('.' + cssClass);
|
var elements = document.querySelectorAll('.' + cssClass);
|
||||||
for (var n = 0; n < elements.length; n++) {
|
for (var n = 0; n < elements.length; n++) {
|
||||||
upgradeElementInternal(elements[n], jsClass);
|
upgradeElementInternal(elements[n], jsClass);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +167,8 @@ window.addEventListener('load', function() {
|
||||||
* tested, adds a wsk-js class to the <html> element. It then upgrades all WSK
|
* tested, adds a wsk-js class to the <html> element. It then upgrades all WSK
|
||||||
* components requiring JavaScript.
|
* components requiring JavaScript.
|
||||||
*/
|
*/
|
||||||
if ('classList' in document.createElement('div') && 'querySelector' in document && 'addEventListener' in window && Array.prototype.forEach) {
|
if ('classList' in document.createElement('div') && 'querySelector' in document &&
|
||||||
|
'addEventListener' in window && Array.prototype.forEach) {
|
||||||
document.documentElement.classList.add('wsk-js');
|
document.documentElement.classList.add('wsk-js');
|
||||||
componentHandler.upgradeAllRegistered();
|
componentHandler.upgradeAllRegistered();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue