1231
1231
[data-md ] > : last-child {
1232
1232
margin-bottom : 0 ;
1233
1233
}</ style >
1234
- < style > /* style-counters */
1235
-
1236
- body {
1237
- counter-reset : example figure issue;
1238
- }
1239
- .issue {
1240
- counter-increment : issue;
1241
- }
1242
- .issue : not (.no-marker )::before {
1243
- content : "Issue " counter (issue);
1244
- }
1245
-
1246
- .example {
1247
- counter-increment : example;
1248
- }
1249
- .example : not (.no-marker )::before {
1250
- content : "Example " counter (example);
1251
- }
1252
- .invalid .example : not (.no-marker )::before ,
1253
- .illegal .example : not (.no-marker )::before {
1254
- content : "Invalid Example" counter (example);
1255
- }
1256
-
1257
- figcaption {
1258
- counter-increment : figure;
1259
- }
1260
- figcaption : not (.no-marker )::before {
1261
- content : "Figure " counter (figure) " " ;
1262
- }</ style >
1263
- < style > /* style-syntax-highlighting */
1264
- pre .idl .highlight { color : # 708090 ; }
1265
- .highlight : not (.idl ) { background : hsl (24 , 20% , 95% ); }
1266
- code .highlight { padding : .1em ; border-radius : .3em ; }
1267
- pre .highlight , pre > code .highlight { display : block; padding : 1em ; margin : .5em 0 ; overflow : auto; border-radius : 0 ; }
1268
- c- [a ] { color : # 990055 } /* Keyword.Declaration */
1269
- c- [b ] { color : # 990055 } /* Keyword.Type */
1270
- c- [c ] { color : # 708090 } /* Comment */
1271
- c- [d ] { color : # 708090 } /* Comment.Multiline */
1272
- c- [e ] { color : # 0077aa } /* Name.Attribute */
1273
- c- [f ] { color : # 669900 } /* Name.Tag */
1274
- c- [g ] { color : # 222222 } /* Name.Variable */
1275
- c- [k ] { color : # 990055 } /* Keyword */
1276
- c- [l ] { color : # 000000 } /* Literal */
1277
- c- [m ] { color : # 000000 } /* Literal.Number */
1278
- c- [n ] { color : # 0077aa } /* Name */
1279
- c- [o ] { color : # 999999 } /* Operator */
1280
- c- [p ] { color : # 999999 } /* Punctuation */
1281
- c- [s ] { color : # a67f59 } /* Literal.String */
1282
- c- [t ] { color : # a67f59 } /* Literal.String.Single */
1283
- c- [u ] { color : # a67f59 } /* Literal.String.Double */
1284
- c- [cp ] { color : # 708090 } /* Comment.Preproc */
1285
- c- [c1 ] { color : # 708090 } /* Comment.Single */
1286
- c- [cs ] { color : # 708090 } /* Comment.Special */
1287
- c- [kc ] { color : # 990055 } /* Keyword.Constant */
1288
- c- [kn ] { color : # 990055 } /* Keyword.Namespace */
1289
- c- [kp ] { color : # 990055 } /* Keyword.Pseudo */
1290
- c- [kr ] { color : # 990055 } /* Keyword.Reserved */
1291
- c- [ld ] { color : # 000000 } /* Literal.Date */
1292
- c- [nc ] { color : # 0077aa } /* Name.Class */
1293
- c- [no ] { color : # 0077aa } /* Name.Constant */
1294
- c- [nd ] { color : # 0077aa } /* Name.Decorator */
1295
- c- [ni ] { color : # 0077aa } /* Name.Entity */
1296
- c- [ne ] { color : # 0077aa } /* Name.Exception */
1297
- c- [nf ] { color : # 0077aa } /* Name.Function */
1298
- c- [nl ] { color : # 0077aa } /* Name.Label */
1299
- c- [nn ] { color : # 0077aa } /* Name.Namespace */
1300
- c- [py ] { color : # 0077aa } /* Name.Property */
1301
- c- [ow ] { color : # 999999 } /* Operator.Word */
1302
- c- [mb ] { color : # 000000 } /* Literal.Number.Bin */
1303
- c- [mf ] { color : # 000000 } /* Literal.Number.Float */
1304
- c- [mh ] { color : # 000000 } /* Literal.Number.Hex */
1305
- c- [mi ] { color : # 000000 } /* Literal.Number.Integer */
1306
- c- [mo ] { color : # 000000 } /* Literal.Number.Oct */
1307
- c- [sb ] { color : # a67f59 } /* Literal.String.Backtick */
1308
- c- [sc ] { color : # a67f59 } /* Literal.String.Char */
1309
- c- [sd ] { color : # a67f59 } /* Literal.String.Doc */
1310
- c- [se ] { color : # a67f59 } /* Literal.String.Escape */
1311
- c- [sh ] { color : # a67f59 } /* Literal.String.Heredoc */
1312
- c- [si ] { color : # a67f59 } /* Literal.String.Interpol */
1313
- c- [sx ] { color : # a67f59 } /* Literal.String.Other */
1314
- c- [sr ] { color : # a67f59 } /* Literal.String.Regex */
1315
- c- [ss ] { color : # a67f59 } /* Literal.String.Symbol */
1316
- c- [vc ] { color : # 0077aa } /* Name.Variable.Class */
1317
- c- [vg ] { color : # 0077aa } /* Name.Variable.Global */
1318
- c- [vi ] { color : # 0077aa } /* Name.Variable.Instance */
1319
- c- [il ] { color : # 000000 } /* Literal.Number.Integer.Long */
1320
- </ style >
1321
1234
< style > /* style-selflinks */
1322
1235
1323
1236
.heading , .issue , .note , .example , li , dt {
1364
1277
a .self-link ::before { content : "¶" ; }
1365
1278
.heading > a .self-link ::before { content : "§" ; }
1366
1279
dfn > a .self-link ::before { content : "#" ; }</ style >
1280
+ < style > /* style-counters */
1281
+
1282
+ body {
1283
+ counter-reset : example figure issue;
1284
+ }
1285
+ .issue {
1286
+ counter-increment : issue;
1287
+ }
1288
+ .issue : not (.no-marker )::before {
1289
+ content : "Issue " counter (issue);
1290
+ }
1291
+
1292
+ .example {
1293
+ counter-increment : example;
1294
+ }
1295
+ .example : not (.no-marker )::before {
1296
+ content : "Example " counter (example);
1297
+ }
1298
+ .invalid .example : not (.no-marker )::before ,
1299
+ .illegal .example : not (.no-marker )::before {
1300
+ content : "Invalid Example" counter (example);
1301
+ }
1302
+
1303
+ figcaption {
1304
+ counter-increment : figure;
1305
+ }
1306
+ figcaption : not (.no-marker )::before {
1307
+ content : "Figure " counter (figure) " " ;
1308
+ }</ style >
1367
1309
< style > /* style-autolinks */
1368
1310
1369
1311
.css .css , .property .property , .descriptor .descriptor {
1426
1368
[data-link-type = biblio ] {
1427
1369
white-space : pre;
1428
1370
}</ style >
1371
+ < style > /* style-dfn-panel */
1372
+
1373
+ .dfn-panel {
1374
+ position : absolute;
1375
+ z-index : 35 ;
1376
+ height : auto;
1377
+ width : -webkit-fit-content;
1378
+ width : fit-content;
1379
+ max-width : 300px ;
1380
+ max-height : 500px ;
1381
+ overflow : auto;
1382
+ padding : 0.5em 0.75em ;
1383
+ font : small Helvetica Neue, sans-serif, Droid Sans Fallback;
1384
+ background : # DDDDDD ;
1385
+ color : black;
1386
+ border : outset 0.2em ;
1387
+ }
1388
+ .dfn-panel : not (.on ) { display : none; }
1389
+ .dfn-panel * { margin : 0 ; padding : 0 ; text-indent : 0 ; }
1390
+ .dfn-panel > b { display : block; }
1391
+ .dfn-panel a { color : black; }
1392
+ .dfn-panel a : not (: hover ) { text-decoration : none !important ; border-bottom : none !important ; }
1393
+ .dfn-panel > b + b { margin-top : 0.25em ; }
1394
+ .dfn-panel ul { padding : 0 ; }
1395
+ .dfn-panel li { list-style : inside; }
1396
+ .dfn-panel .activated {
1397
+ display : inline-block;
1398
+ position : fixed;
1399
+ left : .5em ;
1400
+ bottom : 2em ;
1401
+ margin : 0 auto;
1402
+ max-width : calc (100vw - 1.5em - .4em - .5em );
1403
+ max-height : 30vh ;
1404
+ }
1405
+
1406
+ .dfn-paneled { cursor : pointer; }
1407
+ </ style >
1408
+ < style > /* style-syntax-highlighting */
1409
+ pre .idl .highlight { color : # 708090 ; }
1410
+ .highlight : not (.idl ) { background : hsl (24 , 20% , 95% ); }
1411
+ code .highlight { padding : .1em ; border-radius : .3em ; }
1412
+ pre .highlight , pre > code .highlight { display : block; padding : 1em ; margin : .5em 0 ; overflow : auto; border-radius : 0 ; }
1413
+ c- [a ] { color : # 990055 } /* Keyword.Declaration */
1414
+ c- [b ] { color : # 990055 } /* Keyword.Type */
1415
+ c- [c ] { color : # 708090 } /* Comment */
1416
+ c- [d ] { color : # 708090 } /* Comment.Multiline */
1417
+ c- [e ] { color : # 0077aa } /* Name.Attribute */
1418
+ c- [f ] { color : # 669900 } /* Name.Tag */
1419
+ c- [g ] { color : # 222222 } /* Name.Variable */
1420
+ c- [k ] { color : # 990055 } /* Keyword */
1421
+ c- [l ] { color : # 000000 } /* Literal */
1422
+ c- [m ] { color : # 000000 } /* Literal.Number */
1423
+ c- [n ] { color : # 0077aa } /* Name */
1424
+ c- [o ] { color : # 999999 } /* Operator */
1425
+ c- [p ] { color : # 999999 } /* Punctuation */
1426
+ c- [s ] { color : # a67f59 } /* Literal.String */
1427
+ c- [t ] { color : # a67f59 } /* Literal.String.Single */
1428
+ c- [u ] { color : # a67f59 } /* Literal.String.Double */
1429
+ c- [cp ] { color : # 708090 } /* Comment.Preproc */
1430
+ c- [c1 ] { color : # 708090 } /* Comment.Single */
1431
+ c- [cs ] { color : # 708090 } /* Comment.Special */
1432
+ c- [kc ] { color : # 990055 } /* Keyword.Constant */
1433
+ c- [kn ] { color : # 990055 } /* Keyword.Namespace */
1434
+ c- [kp ] { color : # 990055 } /* Keyword.Pseudo */
1435
+ c- [kr ] { color : # 990055 } /* Keyword.Reserved */
1436
+ c- [ld ] { color : # 000000 } /* Literal.Date */
1437
+ c- [nc ] { color : # 0077aa } /* Name.Class */
1438
+ c- [no ] { color : # 0077aa } /* Name.Constant */
1439
+ c- [nd ] { color : # 0077aa } /* Name.Decorator */
1440
+ c- [ni ] { color : # 0077aa } /* Name.Entity */
1441
+ c- [ne ] { color : # 0077aa } /* Name.Exception */
1442
+ c- [nf ] { color : # 0077aa } /* Name.Function */
1443
+ c- [nl ] { color : # 0077aa } /* Name.Label */
1444
+ c- [nn ] { color : # 0077aa } /* Name.Namespace */
1445
+ c- [py ] { color : # 0077aa } /* Name.Property */
1446
+ c- [ow ] { color : # 999999 } /* Operator.Word */
1447
+ c- [mb ] { color : # 000000 } /* Literal.Number.Bin */
1448
+ c- [mf ] { color : # 000000 } /* Literal.Number.Float */
1449
+ c- [mh ] { color : # 000000 } /* Literal.Number.Hex */
1450
+ c- [mi ] { color : # 000000 } /* Literal.Number.Integer */
1451
+ c- [mo ] { color : # 000000 } /* Literal.Number.Oct */
1452
+ c- [sb ] { color : # a67f59 } /* Literal.String.Backtick */
1453
+ c- [sc ] { color : # a67f59 } /* Literal.String.Char */
1454
+ c- [sd ] { color : # a67f59 } /* Literal.String.Doc */
1455
+ c- [se ] { color : # a67f59 } /* Literal.String.Escape */
1456
+ c- [sh ] { color : # a67f59 } /* Literal.String.Heredoc */
1457
+ c- [si ] { color : # a67f59 } /* Literal.String.Interpol */
1458
+ c- [sx ] { color : # a67f59 } /* Literal.String.Other */
1459
+ c- [sr ] { color : # a67f59 } /* Literal.String.Regex */
1460
+ c- [ss ] { color : # a67f59 } /* Literal.String.Symbol */
1461
+ c- [vc ] { color : # 0077aa } /* Name.Variable.Class */
1462
+ c- [vg ] { color : # 0077aa } /* Name.Variable.Global */
1463
+ c- [vi ] { color : # 0077aa } /* Name.Variable.Instance */
1464
+ c- [il ] { color : # 000000 } /* Literal.Number.Integer.Long */
1465
+ </ style >
1429
1466
< body class ="h-entry ">
1430
1467
< div class ="head ">
1431
1468
< p data-fill-with ="logo "> < a class ="logo " href ="https://www.w3.org/ "> < img alt ="W3C " height ="48 " src ="https://www.w3.org/StyleSheets/TR/2016/logos/W3C " width ="72 "> </ a > </ p >
@@ -1479,6 +1516,11 @@ <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
1479
1516
< li > < a href ="#introduction "> < span class ="secno "> 1</ span > < span class ="content "> Introduction</ span > </ a >
1480
1517
< li > < a href ="#idl-specification "> < span class ="secno "> 2</ span > < span class ="content "> IDL specification</ span > </ a >
1481
1518
< li > < a href ="#conformance "> < span class ="secno "> </ span > < span class ="content "> Conformance</ span > </ a >
1519
+ < li >
1520
+ < a href ="#index "> < span class ="secno "> </ span > < span class ="content "> Index</ span > </ a >
1521
+ < ol class ="toc ">
1522
+ < li > < a href ="#index-defined-here "> < span class ="secno "> </ span > < span class ="content "> Terms defined by this specification</ span > </ a >
1523
+ </ ol >
1482
1524
< li >
1483
1525
< a href ="#references "> < span class ="secno "> </ span > < span class ="content "> References</ span > </ a >
1484
1526
< ol class ="toc ">
@@ -1492,7 +1534,14 @@ <h2 class="heading settled" data-level="1" id="introduction"><span class="secno"
1492
1534
< h2 class ="heading settled " data-level ="2 " id ="idl-specification "> < span class ="secno "> 2. </ span > < span class ="content "> IDL specification</ span > < a class ="self-link " href ="#idl-specification "> </ a > </ h2 >
1493
1535
< p > The Streams definition doesn’t use WebIDL much, but the WebRTC spec does.
1494
1536
This specification shows the IDL extensions for WebRTC.</ p >
1495
- < pre class ="idl highlight def "> </ pre >
1537
+ < pre class ="idl highlight def "> < c- b > callback</ c- > < dfn class ="dfn-paneled idl-code " data-dfn-type ="callback " data-export id ="callbackdef-encoderdecorator "> < code > < c- g > EncoderDecorator</ c- > </ code > </ dfn > = < a class ="n " data-link-type ="idl-name "> < c- n > Encoder</ c- > </ a > (< a class ="n " data-link-type ="idl-name "> < c- n > Encoder</ c- > </ a > < dfn class ="idl-code " data-dfn-for ="EncoderDecorator " data-dfn-type ="argument " data-export id ="dom-encoderdecorator-encoder "> < code > < c- g > encoder</ c- > </ code > < a class ="self-link " href ="#dom-encoderdecorator-encoder "> </ a > </ dfn > , < a class ="n " data-link-type ="idl-name "> < c- n > Config</ c- > </ a > < dfn class ="idl-code " data-dfn-for ="EncoderDecorator " data-dfn-type ="argument " data-export id ="dom-encoderdecorator-config "> < code > < c- g > config</ c- > </ code > < a class ="self-link " href ="#dom-encoderdecorator-config "> </ a > </ dfn > );
1538
+ < c- b > callback</ c- > < dfn class ="dfn-paneled idl-code " data-dfn-type ="callback " data-export id ="callbackdef-decoderdecorator "> < code > < c- g > DecoderDecorator</ c- > </ code > </ dfn > = < a class ="n " data-link-type ="idl-name "> < c- n > Decoder</ c- > </ a > (< a class ="n " data-link-type ="idl-name "> < c- n > Decoder</ c- > </ a > < dfn class ="idl-code " data-dfn-for ="DecoderDecorator " data-dfn-type ="argument " data-export id ="dom-decoderdecorator-encoder "> < code > < c- g > encoder</ c- > </ code > < a class ="self-link " href ="#dom-decoderdecorator-encoder "> </ a > </ dfn > , < a class ="n " data-link-type ="idl-name "> < c- n > Config</ c- > </ a > < dfn class ="idl-code " data-dfn-for ="DecoderDecorator " data-dfn-type ="argument " data-export id ="dom-decoderdecorator-config "> < code > < c- g > config</ c- > </ code > < a class ="self-link " href ="#dom-decoderdecorator-config "> </ a > </ dfn > );
1539
+
1540
+ < c- b > partial</ c- > < c- b > dictionary</ c- > < a class ="idl-code " data-link-type ="dictionary "> < c- g > RTCConfiguration</ c- > </ a > {
1541
+ < a class ="n " data-link-type ="idl-name " href ="#callbackdef-encoderdecorator " id ="ref-for-callbackdef-encoderdecorator "> < c- n > EncoderDecorator</ c- > </ a > < dfn class ="idl-code " data-dfn-for ="RTCConfiguration " data-dfn-type ="dict-member " data-export data-type ="EncoderDecorator " id ="dom-rtcconfiguration-encoderfactory "> < code > < c- g > encoderFactory</ c- > </ code > < a class ="self-link " href ="#dom-rtcconfiguration-encoderfactory "> </ a > </ dfn > ;
1542
+ < a class ="n " data-link-type ="idl-name " href ="#callbackdef-decoderdecorator " id ="ref-for-callbackdef-decoderdecorator "> < c- n > DecoderDecorator</ c- > </ a > < dfn class ="idl-code " data-dfn-for ="RTCConfiguration " data-dfn-type ="dict-member " data-export data-type ="DecoderDecorator " id ="dom-rtcconfiguration-decoderfactory "> < code > < c- g > decoderFactory</ c- > </ code > < a class ="self-link " href ="#dom-rtcconfiguration-decoderfactory "> </ a > </ dfn > ;
1543
+ };
1544
+ </ pre >
1496
1545
</ main >
1497
1546
< div data-fill-with ="conformance ">
1498
1547
< h2 class ="no-ref no-num heading settled " id ="conformance "> < span class ="content "> Conformance</ span > < a class ="self-link " href ="#conformance "> </ a > </ h2 >
@@ -1640,11 +1689,95 @@ <h2 class="no-ref no-num heading settled" id="conformance"><span class="content"
1640
1689
1641
1690
} ) ( ) ;
1642
1691
</ script >
1692
+ < h2 class ="no-num no-ref heading settled " id ="index "> < span class ="content "> Index</ span > < a class ="self-link " href ="#index "> </ a > </ h2 >
1693
+ < h3 class ="no-num no-ref heading settled " id ="index-defined-here "> < span class ="content "> Terms defined by this specification</ span > < a class ="self-link " href ="#index-defined-here "> </ a > </ h3 >
1694
+ < ul class ="index ">
1695
+ < li > < a href ="#callbackdef-decoderdecorator "> DecoderDecorator</ a > < span > , in §2</ span >
1696
+ < li > < a href ="#dom-rtcconfiguration-decoderfactory "> decoderFactory</ a > < span > , in §2</ span >
1697
+ < li > < a href ="#callbackdef-encoderdecorator "> EncoderDecorator</ a > < span > , in §2</ span >
1698
+ < li > < a href ="#dom-rtcconfiguration-encoderfactory "> encoderFactory</ a > < span > , in §2</ span >
1699
+ </ ul >
1643
1700
< h2 class ="no-num no-ref heading settled " id ="references "> < span class ="content "> References</ span > < a class ="self-link " href ="#references "> </ a > </ h2 >
1644
1701
< h3 class ="no-num no-ref heading settled " id ="normative "> < span class ="content "> Normative References</ span > < a class ="self-link " href ="#normative "> </ a > </ h3 >
1645
1702
< dl >
1646
1703
< dt id ="biblio-rfc2119 "> [RFC2119]
1647
1704
< dd > S. Bradner. < a href ="https://tools.ietf.org/html/rfc2119 "> Key words for use in RFCs to Indicate Requirement Levels</ a > . March 1997. Best Current Practice. URL: < a href ="https://tools.ietf.org/html/rfc2119 "> https://tools.ietf.org/html/rfc2119</ a >
1648
1705
</ dl >
1649
1706
< h2 class ="no-num no-ref heading settled " id ="idl-index "> < span class ="content "> IDL Index</ span > < a class ="self-link " href ="#idl-index "> </ a > </ h2 >
1650
- < pre class ="idl highlight def "> </ pre >
1707
+ < pre class ="idl highlight def "> < c- b > callback</ c- > < a href ="#callbackdef-encoderdecorator "> < code > < c- g > EncoderDecorator</ c- > </ code > </ a > = < a class ="n " data-link-type ="idl-name "> < c- n > Encoder</ c- > </ a > (< a class ="n " data-link-type ="idl-name "> < c- n > Encoder</ c- > </ a > < a href ="#dom-encoderdecorator-encoder "> < code > < c- g > encoder</ c- > </ code > </ a > , < a class ="n " data-link-type ="idl-name "> < c- n > Config</ c- > </ a > < a href ="#dom-encoderdecorator-config "> < code > < c- g > config</ c- > </ code > </ a > );
1708
+ < c- b > callback</ c- > < a href ="#callbackdef-decoderdecorator "> < code > < c- g > DecoderDecorator</ c- > </ code > </ a > = < a class ="n " data-link-type ="idl-name "> < c- n > Decoder</ c- > </ a > (< a class ="n " data-link-type ="idl-name "> < c- n > Decoder</ c- > </ a > < a href ="#dom-decoderdecorator-encoder "> < code > < c- g > encoder</ c- > </ code > </ a > , < a class ="n " data-link-type ="idl-name "> < c- n > Config</ c- > </ a > < a href ="#dom-decoderdecorator-config "> < code > < c- g > config</ c- > </ code > </ a > );
1709
+
1710
+ < c- b > partial</ c- > < c- b > dictionary</ c- > < a class ="idl-code " data-link-type ="dictionary "> < c- g > RTCConfiguration</ c- > </ a > {
1711
+ < a class ="n " data-link-type ="idl-name " href ="#callbackdef-encoderdecorator " id ="ref-for-callbackdef-encoderdecorator① "> < c- n > EncoderDecorator</ c- > </ a > < a data-type ="EncoderDecorator " href ="#dom-rtcconfiguration-encoderfactory "> < code > < c- g > encoderFactory</ c- > </ code > </ a > ;
1712
+ < a class ="n " data-link-type ="idl-name " href ="#callbackdef-decoderdecorator " id ="ref-for-callbackdef-decoderdecorator① "> < c- n > DecoderDecorator</ c- > </ a > < a data-type ="DecoderDecorator " href ="#dom-rtcconfiguration-decoderfactory "> < code > < c- g > decoderFactory</ c- > </ code > </ a > ;
1713
+ };
1714
+
1715
+ </ pre >
1716
+ < aside class ="dfn-panel " data-for ="callbackdef-encoderdecorator ">
1717
+ < b > < a href ="#callbackdef-encoderdecorator "> #callbackdef-encoderdecorator</ a > </ b > < b > Referenced in:</ b >
1718
+ < ul >
1719
+ < li > < a href ="#ref-for-callbackdef-encoderdecorator "> 2. IDL specification</ a >
1720
+ </ ul >
1721
+ </ aside >
1722
+ < aside class ="dfn-panel " data-for ="callbackdef-decoderdecorator ">
1723
+ < b > < a href ="#callbackdef-decoderdecorator "> #callbackdef-decoderdecorator</ a > </ b > < b > Referenced in:</ b >
1724
+ < ul >
1725
+ < li > < a href ="#ref-for-callbackdef-decoderdecorator "> 2. IDL specification</ a >
1726
+ </ ul >
1727
+ </ aside >
1728
+ < script > /* script-dfn-panel */
1729
+
1730
+ document . body . addEventListener ( "click" , function ( e ) {
1731
+ var queryAll = function ( sel ) { return [ ] . slice . call ( document . querySelectorAll ( sel ) ) ; }
1732
+ // Find the dfn element or panel, if any, that was clicked on.
1733
+ var el = e . target ;
1734
+ var target ;
1735
+ var hitALink = false ;
1736
+ while ( el . parentElement ) {
1737
+ if ( el . tagName == "A" ) {
1738
+ // Clicking on a link in a <dfn> shouldn't summon the panel
1739
+ hitALink = true ;
1740
+ }
1741
+ if ( el . classList . contains ( "dfn-paneled" ) ) {
1742
+ target = "dfn" ;
1743
+ break ;
1744
+ }
1745
+ if ( el . classList . contains ( "dfn-panel" ) ) {
1746
+ target = "dfn-panel" ;
1747
+ break ;
1748
+ }
1749
+ el = el . parentElement ;
1750
+ }
1751
+ if ( target != "dfn-panel" ) {
1752
+ // Turn off any currently "on" or "activated" panels.
1753
+ queryAll ( ".dfn-panel.on, .dfn-panel.activated" ) . forEach ( function ( el ) {
1754
+ el . classList . remove ( "on" ) ;
1755
+ el . classList . remove ( "activated" ) ;
1756
+ } ) ;
1757
+ }
1758
+ if ( target == "dfn" && ! hitALink ) {
1759
+ // open the panel
1760
+ var dfnPanel = document . querySelector ( ".dfn-panel[data-for='" + el . id + "']" ) ;
1761
+ if ( dfnPanel ) {
1762
+ dfnPanel . classList . add ( "on" ) ;
1763
+ var rect = el . getBoundingClientRect ( ) ;
1764
+ dfnPanel . style . left = window . scrollX + rect . right + 5 + "px" ;
1765
+ dfnPanel . style . top = window . scrollY + rect . top + "px" ;
1766
+ var panelRect = dfnPanel . getBoundingClientRect ( ) ;
1767
+ var panelWidth = panelRect . right - panelRect . left ;
1768
+ if ( panelRect . right > document . body . scrollWidth && ( rect . left - ( panelWidth + 5 ) ) > 0 ) {
1769
+ // Reposition, because the panel is overflowing
1770
+ dfnPanel . style . left = window . scrollX + rect . left - ( panelWidth + 5 ) + "px" ;
1771
+ }
1772
+ } else {
1773
+ console . log ( "Couldn't find .dfn-panel[data-for='" + el . id + "']" ) ;
1774
+ }
1775
+ } else if ( target == "dfn-panel" ) {
1776
+ // Switch it to "activated" state, which pins it.
1777
+ el . classList . add ( "activated" ) ;
1778
+ el . style . left = null ;
1779
+ el . style . top = null ;
1780
+ }
1781
+
1782
+ } ) ;
1783
+ </ script >
0 commit comments