312
312
nDescendants = descendants.size();
315
if (nDescendants > 1) {
317
for (i = 0; i < nDescendants; i++) {
319
oNode = descendants.item(i);
321
if (nFirstEnabled === -1 && !oNode.get(DISABLED)) {
326
// If the user didn't specify a value for the
327
// "activeDescendant" attribute try to infer it from
330
// Need to pass "2" when using "getAttribute" for IE to get
331
// the attribute value as it is set in the markup.
332
// Need to use "parseInt" because IE always returns the
333
// value as a number, whereas all other browsers return
334
// the attribute as a string when accessed
335
// via "getAttribute".
337
if (nActiveDescendant < 0 &&
338
parseInt(oNode.getAttribute(TAB_INDEX, 2), 10) === 0) {
340
nActiveDescendant = i;
344
oNode.set(TAB_INDEX, -1);
353
descendantsMap[sID] = i;
358
// If the user didn't specify a value for the
359
// "activeDescendant" attribute and no default value could be
360
// determined from the markup, then default to 0.
362
if (nActiveDescendant < 0) {
363
nActiveDescendant = 0;
367
oNode = descendants.item(nActiveDescendant);
369
// Check to make sure the active descendant isn't disabled,
370
// and fall back to the first enabled descendant if it is.
372
if (!oNode || oNode.get(DISABLED)) {
373
oNode = descendants.item(nFirstEnabled);
374
nActiveDescendant = nFirstEnabled;
377
this._lastNodeIndex = nDescendants - 1;
378
this._descendants = descendants;
379
this._descendantsMap = descendantsMap;
381
this.set(ACTIVE_DESCENDANT, nActiveDescendant);
383
// Need to set the "tabIndex" attribute here, since the
384
// "activeDescendantChange" event handler used to manage
385
// the setting of the "tabIndex" attribute isn't wired up yet.
387
oNode.set(TAB_INDEX, 0);
315
for (i = 0; i < nDescendants; i++) {
317
oNode = descendants.item(i);
319
if (nFirstEnabled === -1 && !oNode.get(DISABLED)) {
324
// If the user didn't specify a value for the
325
// "activeDescendant" attribute try to infer it from
328
// Need to pass "2" when using "getAttribute" for IE to get
329
// the attribute value as it is set in the markup.
330
// Need to use "parseInt" because IE always returns the
331
// value as a number, whereas all other browsers return
332
// the attribute as a string when accessed
333
// via "getAttribute".
335
if (nActiveDescendant < 0 &&
336
parseInt(oNode.getAttribute(TAB_INDEX, 2), 10) === 0) {
338
nActiveDescendant = i;
343
oNode.set(TAB_INDEX, -1);
353
descendantsMap[sID] = i;
358
// If the user didn't specify a value for the
359
// "activeDescendant" attribute and no default value could be
360
// determined from the markup, then default to 0.
362
if (nActiveDescendant < 0) {
363
nActiveDescendant = 0;
367
oNode = descendants.item(nActiveDescendant);
369
// Check to make sure the active descendant isn't disabled,
370
// and fall back to the first enabled descendant if it is.
372
if (!oNode || oNode.get(DISABLED)) {
373
oNode = descendants.item(nFirstEnabled);
374
nActiveDescendant = nFirstEnabled;
377
this._lastNodeIndex = nDescendants - 1;
378
this._descendants = descendants;
379
this._descendantsMap = descendantsMap;
381
this.set(ACTIVE_DESCENDANT, nActiveDescendant);
383
// Need to set the "tabIndex" attribute here, since the
384
// "activeDescendantChange" event handler used to manage
385
// the setting of the "tabIndex" attribute isn't wired up yet.
388
oNode.set(TAB_INDEX, 0);