@@ -51,26 +51,27 @@ function highlightLines(pre, lines, classes) {
51
51
var line = document . createElement ( 'div' ) ;
52
52
53
53
line . textContent = Array ( end - start + 2 ) . join ( ' \n' ) ;
54
+ line . setAttribute ( 'aria-hidden' , 'true' ) ;
54
55
line . className = ( classes || '' ) + ' line-highlight' ;
55
56
56
- //if the line-numbers plugin is enabled, then there is no reason for this plugin to display the line numbers
57
- if ( ! hasClass ( pre , 'line-numbers' ) ) {
58
- line . setAttribute ( 'data-start' , start ) ;
57
+ //if the line-numbers plugin is enabled, then there is no reason for this plugin to display the line numbers
58
+ if ( ! hasClass ( pre , 'line-numbers' ) ) {
59
+ line . setAttribute ( 'data-start' , start ) ;
59
60
60
- if ( end > start ) {
61
- line . setAttribute ( 'data-end' , end ) ;
62
- }
63
- }
61
+ if ( end > start ) {
62
+ line . setAttribute ( 'data-end' , end ) ;
63
+ }
64
+ }
64
65
65
66
line . style . top = ( start - offset - 1 ) * lineHeight + 'px' ;
66
67
67
- //allow this to play nicely with the line-numbers plugin
68
- if ( hasClass ( pre , 'line-numbers' ) ) {
69
- //need to attack to pre as when line-numbers is enabled, the code tag is relatively which screws up the positioning
70
- pre . appendChild ( line ) ;
71
- } else {
72
- ( pre . querySelector ( 'code' ) || pre ) . appendChild ( line ) ;
73
- }
68
+ //allow this to play nicely with the line-numbers plugin
69
+ if ( hasClass ( pre , 'line-numbers' ) ) {
70
+ //need to attack to pre as when line-numbers is enabled, the code tag is relatively which screws up the positioning
71
+ pre . appendChild ( line ) ;
72
+ } else {
73
+ ( pre . querySelector ( 'code' ) || pre ) . appendChild ( line ) ;
74
+ }
74
75
}
75
76
}
76
77
@@ -90,7 +91,7 @@ function applyHash() {
90
91
91
92
var id = hash . slice ( 0 , hash . lastIndexOf ( '.' ) ) ,
92
93
pre = document . getElementById ( id ) ;
93
-
94
+
94
95
if ( ! pre ) {
95
96
return ;
96
97
}
0 commit comments