فهرست منبع

Rewrite comments of child tag functions

Simpler is better. The function names are already descriptive.
Weiyi Lou 10 سال پیش
والد
کامیت
831471183c
1فایلهای تغییر یافته به همراه3 افزوده شده و 16 حذف شده
  1. 3 16
      tags/terminal.tag

+ 3 - 16
tags/terminal.tag

@@ -145,14 +145,9 @@
     }
   }
 
-  /**
-   * Empty the display.
-   *
-   * An extra update is needed for subsequent changes to `output` (e.g. `add()`,
-   * `restore()`) to display properly.
-   */
   clear() {
     this.output.length = 0
+    // This is needed for subsequent changes to `output` to display properly.
     this.update()
   }
 
@@ -168,17 +163,9 @@
     }
   }
 
-  /**
-   * Make sure whitespace displays correctly.
-   *
-   * Keep the following:
-   *
-   * - Newlines.
-   * - Whitespace for display. This means all spaces that are not within tags.
-   */
   preserveWhiteSpace(text) {
     text = text.replace(/(?:\r\n|\r|\n)/g, '<br />')
-    // Search for tags or whitespace. Replace whitespace, leave the tags.
+    // Search for tags or whitespace. Escape whitespace, leave tags.
     text = text.replace(/<[^<]+>|( )/g, function(match, group1) {
       if (group1 == " ") { return '&nbsp;' }
       return match
@@ -236,7 +223,7 @@
 <raw>
   <span></span>
 
-  // Initialise contents from tag options, but expose `write()` for updating.
+  // Initialise HTML from tag options and expose `write()` for updating.
   write(text) {
     this.root.innerHTML = text
   }