mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Replace *most* cases of var
with let
/const
in the examples/
folder
These changes were done automatically, by using the `gulp lint --fix` command, in preparation for the next patch.
This commit is contained in:
parent
56fd01bf8d
commit
276fa4ad8f
15 changed files with 196 additions and 194 deletions
|
@ -2,7 +2,7 @@
|
|||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function xmlEncode(s) {
|
||||
var i = 0,
|
||||
let i = 0,
|
||||
ch;
|
||||
s = String(s);
|
||||
while (
|
||||
|
@ -19,7 +19,7 @@ function xmlEncode(s) {
|
|||
if (i >= s.length) {
|
||||
return s;
|
||||
}
|
||||
var buf = s.substring(0, i);
|
||||
let buf = s.substring(0, i);
|
||||
while (i < s.length) {
|
||||
ch = s[i++];
|
||||
switch (ch) {
|
||||
|
@ -82,8 +82,8 @@ DOMElement.prototype = {
|
|||
// Assuming that there is only one matching attribute for a given name,
|
||||
// across all namespaces.
|
||||
if (NS) {
|
||||
var suffix = ":" + name;
|
||||
for (var fullName in this.attributes) {
|
||||
const suffix = ":" + name;
|
||||
for (const fullName in this.attributes) {
|
||||
if (fullName.slice(-suffix.length) === suffix) {
|
||||
return this.attributes[fullName];
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ DOMElement.prototype = {
|
|||
},
|
||||
|
||||
appendChild: function DOMElement_appendChild(element) {
|
||||
var childNodes = this.childNodes;
|
||||
const childNodes = this.childNodes;
|
||||
if (!childNodes.includes(element)) {
|
||||
childNodes.push(element);
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ DOMElement.prototype = {
|
|||
},
|
||||
|
||||
cloneNode: function DOMElement_cloneNode() {
|
||||
var newNode = new DOMElement(this.nodeName);
|
||||
const newNode = new DOMElement(this.nodeName);
|
||||
newNode.childNodes = this.childNodes;
|
||||
newNode.attributes = this.attributes;
|
||||
newNode.textContent = this.textContent;
|
||||
|
@ -125,9 +125,9 @@ DOMElement.prototype = {
|
|||
// getSerializer because that allows you to process the chunks as they come
|
||||
// instead of requiring the whole image to fit in memory.
|
||||
toString: function DOMElement_toString() {
|
||||
var buf = [];
|
||||
var serializer = this.getSerializer();
|
||||
var chunk;
|
||||
const buf = [];
|
||||
const serializer = this.getSerializer();
|
||||
let chunk;
|
||||
while ((chunk = serializer.getNext()) !== null) {
|
||||
buf.push(chunk);
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ DOMElementSerializer.prototype = {
|
|||
* @returns {string|null} null if the element has fully been serialized.
|
||||
*/
|
||||
getNext: function DOMElementSerializer_getNext() {
|
||||
var node = this._node;
|
||||
const node = this._node;
|
||||
switch (this._state) {
|
||||
case 0: // Start opening tag.
|
||||
++this._state;
|
||||
|
@ -174,7 +174,7 @@ DOMElementSerializer.prototype = {
|
|||
/* falls through */
|
||||
case 3: // Serialize any attributes and end opening tag.
|
||||
if (this._loopIndex < this._attributeKeys.length) {
|
||||
var name = this._attributeKeys[this._loopIndex++];
|
||||
const name = this._attributeKeys[this._loopIndex++];
|
||||
return " " + name + '="' + xmlEncode(node.attributes[name]) + '"';
|
||||
}
|
||||
++this._state;
|
||||
|
@ -194,7 +194,7 @@ DOMElementSerializer.prototype = {
|
|||
if (value !== null) {
|
||||
return value;
|
||||
}
|
||||
var nextChild = node.childNodes[this._loopIndex++];
|
||||
const nextChild = node.childNodes[this._loopIndex++];
|
||||
if (nextChild) {
|
||||
this._childSerializer = new DOMElementSerializer(nextChild);
|
||||
} else {
|
||||
|
@ -227,7 +227,7 @@ const document = {
|
|||
},
|
||||
|
||||
createElementNS(NS, element) {
|
||||
var elObject = new DOMElement(element);
|
||||
const elObject = new DOMElement(element);
|
||||
return elObject;
|
||||
},
|
||||
|
||||
|
@ -262,7 +262,7 @@ Image.prototype = {
|
|||
exports.document = document;
|
||||
exports.Image = Image;
|
||||
|
||||
var exported_symbols = Object.keys(exports);
|
||||
const exported_symbols = Object.keys(exports);
|
||||
|
||||
exports.setStubs = function (namespace) {
|
||||
exported_symbols.forEach(function (key) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue