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

Unified Diff: qunit/tests/cssEscaping.js

Issue 29371763: Issue 4795 - Use modern JavaScript syntax (Closed)
Patch Set: Workaround limiation with iterating element collections in older versions of Chrome Created Jan. 16, 2017, 8:46 a.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
Index: qunit/tests/cssEscaping.js
diff --git a/qunit/tests/cssEscaping.js b/qunit/tests/cssEscaping.js
index 5986646293ff46de59655ed24bf0bd9d214306fa..8f3975bd68be42942fb9610c2caf520aceda0636 100644
--- a/qunit/tests/cssEscaping.js
+++ b/qunit/tests/cssEscaping.js
@@ -1,27 +1,28 @@
-(function()
+"use strict";
+
{
- var filterClasses = require("filterClasses");
- var Filter = filterClasses.Filter;
- var ElemHideFilter = filterClasses.ElemHideFilter;
+ let filterClasses = require("filterClasses");
+ let Filter = filterClasses.Filter;
+ let ElemHideFilter = filterClasses.ElemHideFilter;
- var filterComposer = require("filterComposer");
- var escapeCSS = filterComposer.escapeCSS;
- var quoteCSS = filterComposer.quoteCSS;
+ let filterComposer = require("filterComposer");
+ let escapeCSS = filterComposer.escapeCSS;
+ let quoteCSS = filterComposer.quoteCSS;
module("CSS escaping");
- test("CSS escaping", function()
+ test("CSS escaping", () =>
{
function testSelector(opts)
{
- var mustMatch = opts.mustMatch !== false;
- var doc = document.implementation.createHTMLDocument();
+ let mustMatch = opts.mustMatch !== false;
+ let doc = document.implementation.createHTMLDocument();
- var style = doc.createElement("style");
+ let style = doc.createElement("style");
doc.documentElement.appendChild(style);
style.sheet.insertRule(opts.selector + " {}", 0);
- var element;
+ let element;
try
{
element = doc.createElement(opts.tagName || "div");
@@ -37,14 +38,14 @@
if (element)
{
- for (var attr in opts.attributes)
+ for (let attr in opts.attributes)
element.setAttribute(attr, opts.attributes[attr]);
doc.documentElement.appendChild(element);
}
- var foundElement = doc.querySelector(opts.selector);
- var filter = Filter.fromText("##" + opts.selector);
+ let foundElement = doc.querySelector(opts.selector);
+ let filter = Filter.fromText("##" + opts.selector);
if (!(filter instanceof ElemHideFilter))
{
@@ -87,9 +88,9 @@
});
}
- for (var i = 1; i < 0x80; i++)
+ for (let i = 1; i < 0x80; i++)
{
- var chr = String.fromCharCode(i);
+ let chr = String.fromCharCode(i);
// Make sure that all ASCII characters are correctly escaped.
testEscape(chr);
@@ -106,4 +107,4 @@
// Test some non-ASCII characters. However, those shouldn't require escaping.
testEscape("\uD83D\uDE3B\u2665\u00E4");
});
-})();
+}

Powered by Google App Engine
This is Rietveld