Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chrome/content/composer.js

Issue 6520005931827200: Issue 2259 - Removed non-standard JavaScript code from Element Hiding Helper (Closed)
Patch Set: Turned knownClasses into a Set as well Created April 4, 2015, 3:28 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/aardvark.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/composer.js
===================================================================
--- a/chrome/content/composer.js
+++ b/chrome/content/composer.js
@@ -101,11 +101,10 @@
};
}
else {
- obj.__defineGetter__(key, function() {
- return orig[key];
- });
- obj.__defineSetter__(key, function(value) {
- orig[key] = value;
+ Object.defineProperty(obj, key, {
+ get: () => orig[key],
+ set: value => { orig[key] = value; },
+ enumerable: true
});
}
}
@@ -249,12 +248,9 @@
expression += "#" + escapeName(attr.selected).replace(/^([^a-zA-Z\\])/, escapeChar).replace(/\\(\s)$/, escapeChar);
else if (attr.name == "class" && /\S/.test(attr.selected))
{
- let knownClasses = {};
- for each (let cls in attr.value.split(/\s+/))
- knownClasses[cls] = true;
-
- let classes = attr.selected.split(/\s+/).filter(function(cls) cls != "");
- if (classes.every(function(cls) knownClasses.hasOwnProperty(cls)))
+ let knownClasses = new Set(attr.value.split(/\s+/));
Sebastian Noack 2015/04/04 15:30:21 While introducing Sets and changing this code anyw
+ let classes = attr.selected.split(/\s+/).filter(cls => cls != "");
+ if (classes.every(cls => knownClasses.has(cls)))
expression += "." + classes.map(escapeName).join(".");
else
useFallback = true;
« no previous file with comments | « no previous file | lib/aardvark.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld