summaryrefslogtreecommitdiffstats
path: root/toolkit/components/reader/JSDOMParser.js
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-05-26 17:47:52 +0200
committerGitHub <noreply@github.com>2020-05-26 17:47:52 +0200
commit725e2b731f98b07837ea9315b923f43009dbe792 (patch)
tree677d4906d83a7dc2b801ce50ec951af18e631508 /toolkit/components/reader/JSDOMParser.js
parent4d373c1d360b29f94026b72c6f66e4ad313732cf (diff)
parent77cd9147cce8dc820da51833ff664132aa62097b (diff)
downloadUXP-725e2b731f98b07837ea9315b923f43009dbe792.tar
UXP-725e2b731f98b07837ea9315b923f43009dbe792.tar.gz
UXP-725e2b731f98b07837ea9315b923f43009dbe792.tar.lz
UXP-725e2b731f98b07837ea9315b923f43009dbe792.tar.xz
UXP-725e2b731f98b07837ea9315b923f43009dbe792.zip
Merge pull request #1567 from Ascrod/readerview
Reader Updates
Diffstat (limited to 'toolkit/components/reader/JSDOMParser.js')
-rw-r--r--toolkit/components/reader/JSDOMParser.js34
1 files changed, 18 insertions, 16 deletions
diff --git a/toolkit/components/reader/JSDOMParser.js b/toolkit/components/reader/JSDOMParser.js
index ab2f503e1..2d3d6f156 100644
--- a/toolkit/components/reader/JSDOMParser.js
+++ b/toolkit/components/reader/JSDOMParser.js
@@ -315,6 +315,7 @@
}
}
getElems(this);
+ elems._isLiveNodeList = true;
return elems;
}
@@ -503,17 +504,9 @@
},
setValue: function(newValue) {
this._value = newValue;
- delete this._decodedValue;
},
- setDecodedValue: function(newValue) {
- this._value = encodeHTML(newValue);
- this._decodedValue = newValue;
- },
- getDecodedValue: function() {
- if (typeof this._decodedValue === "undefined") {
- this._decodedValue = (this._value && decodeHTML(this._value)) || "";
- }
- return this._decodedValue;
+ getEncodedValue: function() {
+ return encodeHTML(this._value);
},
};
@@ -673,6 +666,14 @@
this.setAttribute("src", str);
},
+ get srcset() {
+ return this.getAttribute("srcset") || "";
+ },
+
+ set srcset(str) {
+ this.setAttribute("srcset", str);
+ },
+
get nodeName() {
return this.tagName;
},
@@ -689,7 +690,7 @@
for (var j = 0; j < child.attributes.length; j++) {
var attr = child.attributes[j];
// the attribute value will be HTML escaped.
- var val = attr.value;
+ var val = attr.getEncodedValue();
var quote = (val.indexOf('"') === -1 ? '"' : "'");
arr.push(" " + attr.name + "=" + quote + val + quote);
}
@@ -767,8 +768,9 @@
getAttribute: function (name) {
for (var i = this.attributes.length; --i >= 0;) {
var attr = this.attributes[i];
- if (attr.name === name)
- return attr.getDecodedValue();
+ if (attr.name === name) {
+ return attr.value;
+ }
}
return undefined;
},
@@ -777,11 +779,11 @@
for (var i = this.attributes.length; --i >= 0;) {
var attr = this.attributes[i];
if (attr.name === name) {
- attr.setDecodedValue(value);
+ attr.setValue(value);
return;
}
}
- this.attributes.push(new Attribute(name, encodeHTML(value)));
+ this.attributes.push(new Attribute(name, value));
},
removeAttribute: function (name) {
@@ -945,7 +947,7 @@
// Read the attribute value (and consume the matching quote)
var value = this.readString(c);
- node.attributes.push(new Attribute(name, value));
+ node.attributes.push(new Attribute(name, decodeHTML(value)));
return;
},