]> git.donarmstrong.com Git - dactyl.git/blobdiff - common/modules/highlight.jsm
Imported Upstream version 1.1+hg7904
[dactyl.git] / common / modules / highlight.jsm
index e25b7cc1f5d71adee0103944a26321b8326be465..501edde272d2406b3f2043df60678caa0ce2f3e5 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2014 Kris Maglione <maglione.k at Gmail>
 //
 // This work is licensed for reuse under an MIT license. Details are
 // given in the LICENSE.txt file included with this file.
@@ -125,7 +125,7 @@ var Highlights = Module("Highlight", {
         if (/^[[>+: ]/.test(args[1]))
             obj.selector = this.selector(obj.class) + args[1];
         else if (args[1])
-            obj.selector = this.selector(args[1]);
+            obj.selector = this.selector(args[1].replace(/^,/, ""));
 
         if (old && old.value != old.defaultValue)
             obj.value = old.value;
@@ -134,8 +134,12 @@ var Highlights = Module("Highlight", {
             obj.style.enabled = true;
         else
             this.loaded.__defineSetter__(obj.class, function () {
-                delete this[obj.class];
-                this[obj.class] = true;
+                Object.defineProperty(this, obj.class, {
+                    value: true,
+                    configurable: true,
+                    enumerable: true,
+                    writable: true
+                });
 
                 if (obj.class === obj.baseClass)
                     for (let h in highlight)
@@ -200,11 +204,11 @@ var Highlights = Module("Highlight", {
         node.setAttributeNS(NS, "highlight", group);
 
         let groups = group.split(" ");
-        for each (let group in groups)
+        for (let group of groups)
             this.loaded[group] = true;
 
         if (applyBindings)
-            for each (let group in groups) {
+            for (let group of groups) {
                 if (applyBindings.bindings && group in applyBindings.bindings)
                     applyBindings.bindings[group](node, applyBindings);
                 else if (group in template.bindings)
@@ -275,7 +279,7 @@ var Highlights = Module("Highlight", {
      * If Star is provided, the style is applied as an agent sheet.
      *
      * The new styles are lazily activated unless Bang or *eager* is
-     * provided. See {@link Util#xmlToDom}.
+     * provided.
      *
      * @param {string} css The rules to load. See {@link Highlights#css}.
      * @param {boolean} eager When true, load all provided rules immediately.