[Pkg-javascript-commits] [node-cssstyle] 06/39: changed cssText output to match what WebKit does.

Wolfgang Borgert debacle at moszumanska.debian.org
Sat Sep 20 20:22:33 UTC 2014


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to branch master
in repository node-cssstyle.

commit 175c474be2298824727ad1e379c014ff41f998dd
Author: Chad Walker <chad at chad-cat-lore-eddie.com>
Date:   Thu Jul 12 21:13:04 2012 -0700

    changed cssText output to match what WebKit does.
    
    added a function to set the length, it was causing the Array functions I was calling to silently fail.
---
 lib/CSSStyleDeclaration.js | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/lib/CSSStyleDeclaration.js b/lib/CSSStyleDeclaration.js
index c93871c..cf08501 100644
--- a/lib/CSSStyleDeclaration.js
+++ b/lib/CSSStyleDeclaration.js
@@ -124,10 +124,24 @@ var CSSStyleDeclaration = function CSSStyleDeclaration() {
             if (priority !== '') {
                 priority = " !" + priority;
             }
-            properties.push(name + ": " + value + priority);
+            properties.push(name, ': ', value, priority, '; ');
         }
-        return properties.join("; ");
+        return properties.join('');
     };
+
+    /**
+     * This deletes indices if the new length is less then the current
+     * length. If the new length is more, it does nothing, the new indices
+     * will be undefined until set.
+     **/
+    var setLength = function (new_length) {
+        var i;
+        for (i = new_length; i < length; i++) {
+            delete this[i];
+        }
+        length = new_length;
+    };
+
     Object.defineProperties(this, {
         parentRule: {
             get: function () { return null; },
@@ -135,6 +149,7 @@ var CSSStyleDeclaration = function CSSStyleDeclaration() {
         },
         length: {
             get: function () { return length; },
+            set: function (v) { return setLength.apply(this, arguments); },
             enumerable: true
         },
         setProperty: {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-cssstyle.git



More information about the Pkg-javascript-commits mailing list