[Pkg-javascript-commits] [backbone] 63/281: relying on _.escape, and fixing a lint problem.

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 17:01:57 UTC 2014


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

js pushed a commit to tag 0.9.0
in repository backbone.

commit 3392d5fba95871dcfc88d291715c86fa5a4b0f92
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date:   Mon Oct 31 12:35:02 2011 -0400

    relying on _.escape, and fixing a lint problem.
---
 backbone.js | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/backbone.js b/backbone.js
index 2ac0640..c5473ba 100644
--- a/backbone.js
+++ b/backbone.js
@@ -92,7 +92,7 @@
         if (!callback) {
           calls[ev] = {};
         } else if (node = calls[ev]) {
-          while (prev = node, node = node.next) {
+          while ((prev = node) && (node = node.next)) {
             if (node.callback !== callback) continue;
             prev.next = node.next;
             node.context = node.callback = null;
@@ -170,7 +170,7 @@
       var html;
       if (html = this._escapedAttributes[attr]) return html;
       var val = this.attributes[attr];
-      return this._escapedAttributes[attr] = escapeHTML(val == null ? '' : '' + val);
+      return this._escapedAttributes[attr] = _.escape(val == null ? '' : '' + val);
     },
 
     // Returns `true` if the attribute contains a value that is not null
@@ -1160,9 +1160,4 @@
     };
   };
 
-  // Helper function to escape a string for HTML rendering.
-  var escapeHTML = function(string) {
-    return string.replace(/&(?!\w+;|#\d+;|#x[\da-f]+;)/gi, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, '&#x27;').replace(/\//g,'&#x2F;');
-  };
-
 }).call(this);

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



More information about the Pkg-javascript-commits mailing list