Skip to content

Commit b270dff

Browse files
author
Chris K
committed
Converted id to class.
1 parent f831f02 commit b270dff

File tree

5 files changed

+34
-40
lines changed

5 files changed

+34
-40
lines changed

src/ecma-debugger/js-source-view.js

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ cls.JsSourceView = function(id, name, container_class)
88
// split out one general class to handle partial view ( yield count of lines )
99

1010
var self = this;
11-
var frame_id = 'js-source';
12-
var container_id = 'js-source-content';
13-
var container_line_nr_id = 'js-source-line-numbers';
11+
var frame_id = '';
12+
var container_class_name = 'js-source-content';
13+
var container_selector = "." + container_class_name;
14+
var container_line_nr_class = 'js-source-line-numbers';
15+
var container_line_nr_selector = "container > .js-source-line-numbers";
1416
var scroll_id = 'js-source-scroller';
1517
var scroll_content_id = 'js-source-scroll-content';
1618
var scroll_container_id = 'js-source-scroll-container';
@@ -68,7 +70,7 @@ cls.JsSourceView = function(id, name, container_class)
6870
{
6971
ret[ret.length] = templates.line_nummer();
7072
}
71-
return ret.concat(['id', container_line_nr_id]);
73+
return ret.concat(['class', container_line_nr_class]);
7274
}
7375

7476
templates.line_nummer = function()
@@ -209,11 +211,11 @@ cls.JsSourceView = function(id, name, container_class)
209211
{
210212
style.width = defaults['scrollbar-width'] + 'px';
211213
}
212-
if (style = sheets.getDeclaration('#js-source-content div'))
214+
if (style = sheets.getDeclaration('.js-source-content div'))
213215
{
214216
style.lineHeight = style.height = context['line-height'] + 'px';
215217
}
216-
if (style = sheets.getDeclaration('#js-source-line-numbers li'))
218+
if (style = sheets.getDeclaration('.js-source-line-numbers li'))
217219
{
218220
style.height = context['line-height'] + 'px';
219221
}
@@ -237,8 +239,7 @@ cls.JsSourceView = function(id, name, container_class)
237239
frame_id = container.id;
238240
container.innerHTML = "" +
239241
"<div id='js-source-scroll-content'>"+
240-
"<div id='js-source-content' " +
241-
"class='js-source' " +
242+
"<div class='js-source-content' " +
242243
"data-menu='js-source-content' " +
243244
"data-tooltip='" + cls.JSSourceTooltip.tooltip_name + "'></div>"+
244245
"</div>"+
@@ -251,21 +252,21 @@ cls.JsSourceView = function(id, name, container_class)
251252
}
252253
context['container-height'] = parseInt(container.style.height);
253254
var set = null, i = 0;
254-
source_content = document.getElementById(container_id);
255+
source_content = document.querySelector(container_selector);
255256
if(source_content)
256257
{
257258
if (document.getElementById(scroll_container_id))
258259
{
259260
document.getElementById(scroll_container_id).onscroll = this.scroll;
260261
}
261262
__max_lines = context['container-height'] / context['line-height'] >> 0;
262-
var lines = document.getElementById(container_line_nr_id);
263+
var lines = document.querySelector(container_line_nr_selector);
263264
if( lines )
264265
{
265266
lines.parentElement.removeChild(lines);
266267
}
267268
container.render(templates.line_nummer_container(__max_lines || 1));
268-
line_numbers = document.getElementById(container_line_nr_id);
269+
line_numbers = document.querySelector(container_line_nr_selector);
269270

270271
var selected_script_id = runtimes.getSelectedScript();
271272
if(selected_script_id && selected_script_id != __current_script.script_id)
@@ -432,14 +433,14 @@ cls.JsSourceView = function(id, name, container_class)
432433
{
433434
__max_lines = __current_script.line_arr.length;
434435
}
435-
var lines = document.getElementById(container_line_nr_id);
436+
var lines = document.querySelector(container_line_nr_selector);
436437

437438
if (lines)
438439
{
439440
lines.parentElement.removeChild(lines);
440441
}
441442
document.getElementById(frame_id).render(templates.line_nummer_container(__max_lines));
442-
line_numbers = document.getElementById(container_line_nr_id);
443+
line_numbers = document.querySelector(container_line_nr_selector);
443444
source_content.style.height = (context['line-height'] * __max_lines) +'px';
444445
__current_script.scroll_height = __current_script.line_arr.length * context['line-height'];
445446
updateScriptContext();
@@ -452,7 +453,7 @@ cls.JsSourceView = function(id, name, container_class)
452453
__max_lines = 1;
453454
document.getElementById(scroll_container_id).style.removeProperty('bottom');
454455
source_content.style.removeProperty('width');
455-
var lines = document.getElementById(container_line_nr_id);
456+
var lines = document.querySelector(container_line_nr_selector);
456457
lines.parentElement.removeChild(lines);
457458
document.getElementById(frame_id).render(templates.line_nummer_container(__max_lines));
458459
document.getElementById(scroll_id).style.height = 'auto';
@@ -481,7 +482,7 @@ cls.JsSourceView = function(id, name, container_class)
481482

482483
this.get_line_element = function(line_no)
483484
{
484-
var source_content = document.getElementById(container_id);
485+
var source_content = document.querySelector(container_selector);
485486
var lines = source_content && source_content.getElementsByTagName('div');
486487
var line = typeof line_no == "number" && lines && lines[line_no - __top_line];
487488
return line;
@@ -513,7 +514,7 @@ cls.JsSourceView = function(id, name, container_class)
513514
__timeout_clear_view = clearTimeout(__timeout_clear_view);
514515
}
515516

516-
var is_visible = (source_content = document.getElementById(container_id)) ? true : false;
517+
var is_visible = (source_content = document.querySelector(container_selector)) ? true : false;
517518
// if the view is visible it shows the first new script
518519
// before any parse error, that means in case of a parse error
519520
// the current script has not set the parse_error property
@@ -781,7 +782,7 @@ cls.JsSourceView = function(id, name, container_class)
781782

782783
this.clear_stop_at_error = function()
783784
{
784-
var source_content = document.getElementById(container_id);
785+
var source_content = document.querySelector(container_selector);
785786
var tooltip = source_content &&
786787
source_content.querySelector("." + ERROR_TOOLTIP_CLASS);
787788

@@ -802,7 +803,7 @@ cls.JsSourceView = function(id, name, container_class)
802803

803804
var __clearView = function()
804805
{
805-
if( ( source_content = document.getElementById(container_id) ) && source_content.parentElement )
806+
if( ( source_content = document.querySelector(container_selector) ) && source_content.parentElement )
806807
{
807808
var
808809
divs = source_content.parentElement.parentElement.getElementsByTagName('div'),
@@ -1250,7 +1251,7 @@ cls.JsSourceView.create_ui_widgets = function()
12501251
eventHandlers.change['set-tab-size'] = function(event, target)
12511252
{
12521253
var
1253-
style = document.styleSheets.getDeclaration("#js-source-content div"),
1254+
style = document.styleSheets.getDeclaration(".js-source-content div"),
12541255
tab_size = event.target.value;
12551256

12561257
if(style && /[0-8]/.test(tab_size))

src/ecma-debugger/jssourcetooltip.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ cls.JSSourceTooltip = function(view)
937937

938938
var _get_tab_size = function()
939939
{
940-
var style_dec = document.styleSheets.getDeclaration("#js-source-content div");
940+
var style_dec = document.styleSheets.getDeclaration(".js-source-content div");
941941
return style_dec ? parseInt(style_dec.getPropertyValue("-o-tab-size")) : 0;
942942
};
943943

src/ui-scripts/ui_framework.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ var ui_framework = new function()
202202
"<div class='js-source mono'> " +
203203
"<div id='test-line-height' class='mono'><span>1234567890</span></div> " +
204204
"<div id='js-source-scroll-content'> " +
205-
"<div id='js-source-content'> " +
205+
"<div class='js-source-content'> " +
206206
"<div style='position:absolute;width:100px;height:100px;overflow:auto'> " +
207207
"<div id='test-scrollbar-width' style='height:300px'></div> " +
208208
"</div> " +

src/ui-style/global_command_line.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ container.console
2020
.console .repl-input,
2121
.console .repl-output,
2222
.console #examine-objects .object,
23-
.console .js-source,
2423
.console examine-objects .object,
2524
.console .datetime
2625
{

src/ui-style/js-source.css

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
#js-source
2-
{
3-
position: relative;
4-
padding: 0;
5-
}
6-
7-
#js-source-scroll-content,
1+
#js-source-scroll-content,
82
#js-source-scroll-container
93
{
104
position: absolute;
@@ -25,29 +19,29 @@
2519
width: 50px;
2620
}
2721

28-
#js-source-content div
22+
.js-source-content div
2923
{
3024
color: #000;
3125
white-space: pre;
3226
padding-left: 10px;
3327
-o-tab-size: 4;
3428
}
3529

36-
#js-source-content .not-error
30+
.js-source-content .not-error
3731
{
3832
display: inline-block;
3933
padding-left: 10px;
4034
margin-left: -10px;
4135
}
4236

43-
#js-source-content .first-error-line,
44-
#js-source-content .stop-at-error
37+
.js-source-content .first-error-line,
38+
.js-source-content .stop-at-error
4539
{
4640
position: relative;
4741
overflow: visible;
4842
}
4943

50-
#js-source-content .stop-at-error
44+
.js-source-content .stop-at-error
5145
{
5246
background-color: rgba(255, 0, 0, 0.15);
5347
}
@@ -69,7 +63,7 @@
6963
}
7064

7165
/* line number */
72-
#js-source-line-numbers
66+
.js-source-line-numbers
7367
{
7468
position: absolute;
7569
left: 0;
@@ -85,12 +79,12 @@
8579
background-color: transparent;
8680
}
8781

88-
#js-source-line-numbers li
82+
.js-source-line-numbers li
8983
{
9084
position: relative;
9185
}
9286

93-
#js-source-line-numbers span
87+
.js-source-line-numbers span
9488
{
9589
position: absolute;
9690
left: 0;
@@ -100,7 +94,7 @@
10094
background: transparent url('../ui-images/line-types.png') no-repeat 0 0;
10195
}
10296

103-
#js-source-line-numbers input
97+
.js-source-line-numbers input
10498
{
10599
width: 37px;
106100
text-align: right;
@@ -109,14 +103,14 @@
109103
padding: 0;
110104
padding-right: 3px;
111105
background-color: transparent;
112-
height: 100%; /* should be the same as the line height #js-source-content li */
106+
height: 100%; /* should be the same as the line height .js-source-content li */
113107
font-size: inherit;
114108
font-family: inherit;
115109
vertical-align: middle;
116110
color: #b3b3b3;
117111
}
118112

119-
#js-source-line-numbers input:hover
113+
.js-source-line-numbers input:hover
120114
{
121115
background-color: #f0f0f0;
122116
}

0 commit comments

Comments
 (0)