]> git.donarmstrong.com Git - dactyl.git/blobdiff - common/modules/highlight.jsm
Import 1.0rc1 supporting Firefox up to 11.*
[dactyl.git] / common / modules / highlight.jsm
index 73b6b06ae7cf35ed166aa9b003e442d3285538bd..7d6cfaf03cf61a7cef814116d9128b535cc169b7 100644 (file)
@@ -2,15 +2,16 @@
 //
 // This work is licensed for reuse under an MIT license. Details are
 // given in the LICENSE.txt file included with this file.
-"use strict";
+/* use strict */
 
 Components.utils.import("resource://dactyl/bootstrap.jsm");
 defineModule("highlight", {
     exports: ["Highlight", "Highlights", "highlight"],
-    require: ["services", "styles", "util"],
-    use: ["messages", "template"]
+    require: ["services", "util"]
 }, this);
 
+this.lazyRequire("styles", ["Styles", "styles"]);
+
 var Highlight = Struct("class", "selector", "sites",
                        "defaultExtends", "defaultValue",
                        "value", "extends", "agent",
@@ -152,7 +153,7 @@ var Highlights = Module("Highlight", {
 
         let highlight = this.highlight[key] || this._create(false, [key]);
 
-        let bases = extend || highlight.extend;
+        let bases = extend || highlight.extends;
         if (append) {
             newStyle = Styles.append(highlight.value || "", newStyle);
             bases = highlight.extends.concat(bases);
@@ -349,7 +350,7 @@ var Highlights = Module("Highlight", {
                              "text-align: center"],
                             ([h.class,
                               <span style={"text-align: center; line-height: 1em;" + h.value + style}>XXX</span>,
-                              template.map(h.extends, template.highlight),
+                              template.map(h.extends, function (s) template.highlight(s), <>,</>),
                               template.highlightRegexp(h.value, /\b[-\w]+(?=:)|\/\*.*?\*\//g,
                                                        function (match) <span highlight={match[0] == "/" ? "Comment" : "Key"}>{match}</span>)
                              ]
@@ -404,7 +405,10 @@ var Highlights = Module("Highlight", {
                     {
                         command: this.name,
                         arguments: [v.class],
-                        literalArg: v.value
+                        literalArg: v.value,
+                        options: {
+                            "-link": v.extends.length ? v.extends : undefined
+                        }
                     }
                     for (v in Iterator(highlight))
                     if (v.value != v.defaultValue)