@@ -172,12 +172,14 @@ require(["core/pubsubhub"], function( respecEvents ) {
172
172
propList [ title ] = { is : type , title : title , name : content , desc : desc , roles : [ ] } ;
173
173
var abstract = container . querySelector ( "." + type + "-applicability" ) ;
174
174
if ( ( abstract . textContent || abstract . innerText ) === "All elements of the base markup" ) {
175
- globalSP . push ( { is : type , title : title , name : content , desc : desc , prohibited : false } ) ;
176
- }
175
+ globalSP . push ( { is : type , title : title , name : content , desc : desc , prohibited : false , deprecated : false } ) ;
176
+ }
177
177
else if ( ( abstract . textContent || abstract . innerText ) === "All elements of the base markup except for some roles or elements that prohibit its use" ) {
178
- globalSP . push ( { is : type , title : title , name : content , desc : desc , prohibited : true } ) ;
178
+ globalSP . push ( { is : type , title : title , name : content , desc : desc , prohibited : true , deprecated : false } ) ;
179
179
}
180
-
180
+ else if ( ( abstract . textContent || abstract . innerText ) === "Use as a global deprecated in ARIA 1.2" ) {
181
+ globalSP . push ( { is : type , title : title , name : content , desc : desc , prohibited : false , deprecated : true } ) ;
182
+ }
181
183
// the rdef is gone. if we are in a div, convert that div to a section
182
184
183
185
if ( container . nodeName . toLowerCase ( ) == "div" ) {
@@ -222,13 +224,16 @@ require(["core/pubsubhub"], function( respecEvents ) {
222
224
var lItem = sortedList [ i ] ;
223
225
globalSPIndex += "<li>" ;
224
226
if ( lItem . is === "state" ) {
225
- globalSPIndex += "<sref title=\"" + lItem . name + "\">" + lItem . name + " (state)</sref>" ;
227
+ globalSPIndex += "<sref " + ( lItem . prohibited ? "data-prohibited " : "" ) + ( lItem . deprecated ? "data-deprecated " : "" ) + " title=\"" + lItem . name + "\">" + lItem . name + " (state)</sref>" ;
226
228
} else {
227
- globalSPIndex += "<pref>" + lItem . name + "</pref>" ;
229
+ globalSPIndex += "<pref " + ( lItem . prohibited ? "data-prohibited " : "" ) + ( lItem . deprecated ? "data-deprecated " : "" ) + " >" + lItem . name + "</pref>" ;
228
230
}
229
231
if ( lItem . prohibited ) {
230
232
globalSPIndex += " (Except where prohibited)" ;
231
233
}
234
+ if ( lItem . deprecated ) {
235
+ globalSPIndex += " (Global use deprecated in ARIA 1.2)"
236
+ }
232
237
globalSPIndex += "</li>\n" ;
233
238
}
234
239
parentNode = document . querySelector ( "#global_states" ) ;
@@ -330,8 +335,9 @@ require(["core/pubsubhub"], function( respecEvents ) {
330
335
var type = ( item . localName === "pref" ? "property" : "state" ) ;
331
336
var req = $ ( node ) . hasClass ( "role-required-properties" ) ;
332
337
var dis = $ ( node ) . hasClass ( "role-disallowed" ) ;
333
- attrs . push ( { is : type , name : name , required : req , disallowed : dis } ) ;
334
-
338
+ var dep = item . hasAttribute ( "data-deprecated" ) ;
339
+ attrs . push ( { is : type , name : name , required : req , disallowed : dis , deprecated : dep } ) ;
340
+
335
341
// remember that the state or property is
336
342
// referenced by this role
337
343
propList [ name ] . roles . push ( title ) ;
@@ -419,24 +425,41 @@ require(["core/pubsubhub"], function( respecEvents ) {
419
425
} ) ;
420
426
}
421
427
}
422
- var sortedList = [ ] ;
423
- sortedList = myList . sort ( function ( a , b ) { return a . name < b . name ? - 1 : a . name > b . name ? 1 : 0 } ) ;
428
+
429
+ var reducedList = myList . reduce ( ( uniqueList , item ) => {
430
+ return uniqueList . includes ( item ) ? uniqueList : [ ...uniqueList , item ]
431
+ } , [ ] )
432
+
433
+ var sortedList = reducedList . sort ( ( a , b ) => {
434
+ if ( a . name == b . name ) {
435
+ // Ensure deprecated false properties occur first
436
+ if ( a . deprecated !== b . deprecated ) {
437
+ return a . deprecated ? 1 : b . deprecated ? - 1 : 0
438
+ }
439
+ }
440
+ return a . name < b . name ? - 1 : a . name > b . name ? 1 : 0
441
+ } , [ ] )
442
+
424
443
var prev ;
425
444
for ( var k = 0 ; k < sortedList . length ; k ++ ) {
426
- var role = sortedList [ k ] ;
445
+ var property = sortedList [ k ] ;
427
446
var req = "" ;
428
- if ( role . required ) {
447
+ var dep = "" ;
448
+ if ( property . required ) {
429
449
req = " <strong>(required)</strong>" ;
430
450
}
431
- if ( prev != role . name ) {
451
+ if ( property . deprecated ) {
452
+ dep = " <strong>(deprecated on this role in ARIA 1.2)</strong>"
453
+ }
454
+ if ( prev != property . name ) {
432
455
output += "<li>" ;
433
- if ( role . is === "state" ) {
434
- output += "<sref title=\"" + role . name + "\" >" + role . name + " (state) </sref>" + req ;
456
+ if ( property . is === "state" ) {
457
+ output += "<sref>" + property . name + "</sref> (state) " + req + dep ;
435
458
} else {
436
- output += "<pref>" + role . name + "</pref>" + req ;
459
+ output += "<pref>" + property . name + "</pref>" + req + dep ;
437
460
}
438
461
output += "</li>\n" ;
439
- prev = role . name ;
462
+ prev = property . name ;
440
463
}
441
464
}
442
465
if ( output !== "" ) {
@@ -510,6 +533,55 @@ require(["core/pubsubhub"], function( respecEvents ) {
510
533
placeholder . innerHTML = output ;
511
534
}
512
535
}
536
+ else if ( placeholder && ( ( ( placeholder . textContent || placeholder . innerText ) === "Use as a global deprecated in ARIA 1.2" ) ) && item . roles . length )
537
+ {
538
+ // update the used in roles list
539
+ var sortedList = [ ] ;
540
+ sortedList = item . roles . sort ( ) ;
541
+ //remove roletype from the sorted list
542
+ const index = sortedList . indexOf ( 'roletype' ) ;
543
+ if ( index > - 1 ) {
544
+ sortedList . splice ( index , 1 ) ;
545
+ }
546
+
547
+
548
+ for ( var j = 0 ; j < sortedList . length ; j ++ ) {
549
+ output += "<li><rref>" + sortedList [ j ] + "</rref></li>\n" ;
550
+ }
551
+ if ( output !== "" ) {
552
+ output = "<ul>\n" + output + "</ul>\n" ;
553
+ }
554
+ placeholder . innerHTML = output ;
555
+ // also update any inherited roles
556
+ var myList = [ ] ;
557
+ $ . each ( item . roles , function ( j , role ) {
558
+ var children = getAllSubRoles ( role ) ;
559
+ // Some subroles have required properties which are also required by the superclass.
560
+ // Example: The checked state of radio, which is also required by superclass checkbox.
561
+ // We only want to include these one time, so filter out the subroles.
562
+ children = $ . grep ( children , function ( subrole ) {
563
+ return $ . inArray ( subrole , propList [ item . name ] . roles ) == - 1 ;
564
+ } ) ;
565
+ $ . merge ( myList , children ) ;
566
+ } ) ;
567
+ placeholder = section . querySelector ( ".state-descendants, .property-descendants" ) ;
568
+ if ( placeholder && myList . length ) {
569
+ sortedList = myList . sort ( ) ;
570
+ output = "" ;
571
+ var last = "" ;
572
+ for ( j = 0 ; j < sortedList . length ; j ++ ) {
573
+ var sItem = sortedList [ j ] ;
574
+ if ( last != sItem ) {
575
+ output += "<li><rref>" + sItem + "</rref></li>\n" ;
576
+ last = sItem ;
577
+ }
578
+ }
579
+ if ( output !== "" ) {
580
+ output = "<ul>\n" + output + "</ul>\n" ;
581
+ }
582
+ placeholder . innerHTML = output ;
583
+ }
584
+ }
513
585
} ) ;
514
586
515
587
// spit out the index
0 commit comments