hterm: add more ids to elements
This makes it easier to figure out what these random things are for
when you're browsing the DOM.
Change-Id: I0b2c3ccde97ced9efd03f6e6dfbe708a489141cd
Reviewed-on: https://chromium-review.googlesource.com/607552
Reviewed-by: Brandon Gilmore <varz@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/hterm/js/hterm_scrollport.js b/hterm/js/hterm_scrollport.js
index 8576ece..1b2bb8f 100644
--- a/hterm/js/hterm_scrollport.js
+++ b/hterm/js/hterm_scrollport.js
@@ -366,6 +366,7 @@
// This is the main container for the fixed rows.
this.rowNodes_ = doc.createElement('div');
+ this.rowNodes_.id = 'hterm:row-nodes';
this.rowNodes_.style.cssText = (
'display: block;' +
'position: fixed;' +
@@ -388,10 +389,12 @@
// only used to hold rows that are part of the selection but are currently
// scrolled off the top or bottom of the visible range.
this.topFold_ = doc.createElement('x-fold');
+ this.topFold_.id = 'hterm:top-fold-for-row-selection';
this.topFold_.style.cssText = 'display: block;';
this.rowNodes_.appendChild(this.topFold_);
this.bottomFold_ = this.topFold_.cloneNode();
+ this.bottomFold_.id = 'hterm:bottom-fold-for-row-selection';
this.rowNodes_.appendChild(this.bottomFold_);
// This hidden div accounts for the vertical space that would be consumed by
@@ -404,6 +407,7 @@
// select and scroll at the same time). Without this, the selection gets
// out of whack.
this.scrollArea_ = doc.createElement('div');
+ this.scrollArea_.id = 'hterm:scrollarea';
this.scrollArea_.style.cssText = 'visibility: hidden';
this.screen_.appendChild(this.scrollArea_);
@@ -414,6 +418,7 @@
// Note: This must be http:// else Chrome cannot create the element correctly.
var xmlns = 'http://www.w3.org/2000/svg';
this.svg_ = this.div_.ownerDocument.createElementNS(xmlns, 'svg');
+ this.svg_.id = 'hterm:zoom-detector';
this.svg_.setAttribute('xmlns', xmlns);
this.svg_.setAttribute('version', '1.1');
this.svg_.style.cssText = (
@@ -426,7 +431,7 @@
// We send focus to this element just before a paste happens, so we can
// capture the pasted text and forward it on to someone who cares.
this.pasteTarget_ = doc.createElement('textarea');
- this.pasteTarget_.id = 'ctrl-v-paste-target';
+ this.pasteTarget_.id = 'hterm:ctrl-v-paste-target';
this.pasteTarget_.setAttribute('tabindex', '-1');
this.pasteTarget_.style.cssText = (
'position: absolute;' +
@@ -659,6 +664,7 @@
if (!this.ruler_) {
this.ruler_ = this.document_.createElement('div');
+ this.ruler_.id = 'hterm:ruler-character-size';
this.ruler_.style.cssText = (
'position: absolute;' +
'top: 0;' +
@@ -670,11 +676,13 @@
// We need to put the text in a span to make the size calculation
// work properly in Firefox
this.rulerSpan_ = this.document_.createElement('span');
+ this.rulerSpan_.id = 'hterm:ruler-span-workaround';
this.rulerSpan_.innerHTML =
('X'.repeat(lineLength) + '\r').repeat(numberOfLines);
this.ruler_.appendChild(this.rulerSpan_);
this.rulerBaseline_ = this.document_.createElement('span');
+ this.rulerSpan_.id = 'hterm:ruler-baseline';
// We want to collapse it on the baseline
this.rulerBaseline_.style.fontSize = '0px';
this.rulerBaseline_.textContent = 'X';
diff --git a/hterm/js/hterm_terminal.js b/hterm/js/hterm_terminal.js
index 374e71c..a7f8506 100644
--- a/hterm/js/hterm_terminal.js
+++ b/hterm/js/hterm_terminal.js
@@ -104,6 +104,7 @@
// Terminal bell sound.
this.bellAudio_ = this.document_.createElement('audio');
+ this.bellAudio_.id = 'hterm:bell-audio';
this.bellAudio_.setAttribute('preload', 'auto');
// All terminal bell notifications that have been generated (not necessarily
@@ -1429,6 +1430,7 @@
this.document_.head.appendChild(style);
this.cursorNode_ = this.document_.createElement('div');
+ this.cursorNode_.id = 'hterm:terminal-cursor';
this.cursorNode_.className = 'cursor-node';
this.cursorNode_.style.cssText =
('position: absolute;' +
@@ -1454,6 +1456,7 @@
//
// It's a hack, but it's the cleanest way I could find.
this.scrollBlockerNode_ = this.document_.createElement('div');
+ this.scrollBlockerNode_.id = 'hterm:mouse-drag-scroll-blocker';
this.scrollBlockerNode_.style.cssText =
('position: absolute;' +
'top: -99px;' +
@@ -2722,6 +2725,7 @@
return;
this.zoomWarningNode_ = this.document_.createElement('div');
+ this.zoomWarningNode_.id = 'hterm:zoom-warning';
this.zoomWarningNode_.style.cssText = (
'color: black;' +
'background-color: #ff2222;' +
@@ -2848,6 +2852,7 @@
setTimeout(this.showOverlay.bind(this, hterm.notifyCopyMessage, 500), 200);
var copySource = this.document_.createElement('pre');
+ copySource.id = 'hterm:copy-to-clipboard-source';
copySource.textContent = str;
copySource.style.cssText = (
'-webkit-user-select: text;' +